Back to list
waiwai24

detecting-command-injection

by waiwai24

1🍴 0📅 Jan 4, 2026

SKILL.md


name: detecting-command-injection description: Detects OS command injection vulnerabilities by identifying unsafe system/popen/exec calls with user-controlled input. Use when analyzing command execution, shell operations, or investigating potential command injection points.

Command Injection Detection

Detection Workflow

  1. Identify command execution points: Find system(), popen(), execve(), ShellExecute(), CreateProcess() calls
  2. Trace input sources: Use xrefs_to to trace command strings to user input (network, files, environment variables)
  3. Check sanitization: Verify input validation, character escaping, command argument separation, safe API usage
  4. Assess exploitability: Can attacker inject special characters (;, &, |, `)? Control command arguments? Execute multiple commands?

Key Patterns

  • Direct system() with unvalidated user input
  • popen() with partial sanitization
  • execve with insufficient validation
  • Indirect command execution via environment variables

Output Format

Report with: id, type (system/popen/exec), severity, confidence, location, sink, source, command string, sanitization status, exploitability, payload example, mitigation.

Severity Guidelines

  • CRITICAL: Direct use of system() with unvalidated user input
  • HIGH: popen() with partial sanitization
  • MEDIUM: execve with array but insufficient validation
  • LOW: Command execution with strict whitelisting

See Also

  • patterns.md - Detailed detection patterns and exploitation scenarios
  • examples.md - Example analysis cases and code samples
  • references.md - CWE references and mitigation strategies

Score

Total Score

55/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon