Skip to content
Back to skills

Detecting Command Injection

ASecurity

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.

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
toolsshellapi

Works with

  • api

Security analysis

A100/100

Scanned February 10, 2026

npx -y skills add majiayu000/claude-skill-registry --skill detecting-command-injection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Detecting Command Injection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Detecting Command Injection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-detecting-command-injection/badge)](https://www.skillsdirectory.com/skills/majiayu000-detecting-command-injection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.