Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Command Injection

ASecurity

Analyze OS command and shell injection in application code — use when reviewing subprocess, exec, system, shell=True, or user-influenced shell strings (CWE-78 / CWE-77 / A03:2021).

15 stars
0 votes
0 copies
0 views
Added 9/22/2026
securitypythonrustgoshellapisecurity

Works with

api

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add awarexone/AXguard --skill command-injection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Command Injection?

Add the live security badge to your README — it updates automatically with every re-scan.

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

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: command-injection
description: Analyze OS command and shell injection in application code — use when reviewing subprocess, exec, system, shell=True, or user-influenced shell strings (CWE-78 / CWE-77 / A03:2021).
version: "1.0.0"
author: AwareXone
license: MIT
domain: application-security
subcategory: injection
tags: [command-injection, rce, shell, cwe-78]
frameworks:
  cwe: [CWE-78, CWE-77]
  owasp_top10: [A03:2021]
  owasp_api_top10: []
  owasp_llm_top10: []
  owasp_wstg: []
  owasp_asvs: []
  mitre_attack: []
  mitre_atlas: []
  nist_csf: []
  nist_ai_rmf: []
related_skills: [ssti-analysis, path-traversal, file-upload-security, deserialization-security, security-triage, security-remediation]
related_commands: [/axguard-inject, /axguard-audit, /axguard-scan]
related_rules: [injection.]
references:
  - https://owasp.org/Top10/A03_2021-Injection/
  - https://cwe.mitre.org/data/definitions/78.html
  - https://cwe.mitre.org/data/definitions/77.html
last_reviewed: "2026-09-15"
---

# Command Injection Analysis

## Purpose

Teach defensive analysis of **OS command injection** and unsafe shell invocation: untrusted input alters the command line interpreted by a shell or exec API, yielding RCE on the application host.

## When to Use / When Not to Use

**Use when:**

- Code uses `os.system`, `subprocess` with `shell=True`, `exec`/`spawn` with string commands, `Runtime.exec`, backticks, `child_process.exec`, CI hooks, image/ffmpeg wrappers, ping/traceroute utilities.
- After AXguard hits `injection.*` shell/exec rules.
- Agent/tool runners execute model-suggested shell commands (`/axguard-agent` adjacency).

**Do not use when:**

- Process APIs use fixed argv arrays with no shell and no user-controlled binary path (still review path traversal on filenames separately).
- Pure in-process `eval` of language code (different skill / `injection.python-eval` class — still injection, but not OS command).

## Security Concepts

Shell metacharacters (`|;$&\`\n`) change command **structure**. Argument arrays avoid the shell; they do not fix a user-controlled **executable path** or unsafe flags. `shell=False` + argv is the default safe pattern when an external binary is required.

## Threat Model

Attacker goals:

1. Execute arbitrary OS commands as the app user.
2. Read secrets, pivot laterally, install persistence.
3. Abuse privileged wrappers (sudoers, setuid helpers, container breakout via mounts).

## Analysis Workflow

1. Find sinks: `system`, `popen`, `subprocess.*`, `exec(`, `spawn(`, `Runtime.exec`, `ProcessBuilder` with concatenated strings.
2. Determine if a **shell** is involved (`shell=True`, `/bin/sh -c`, string form of `exec`).
3. Trace attacker influence on command string, argv elements, env, or cwd.
4. Check whether “sanitization” is denylist-based (usually insufficient) vs allowlisted tokens.
5. Confirm whether the binary itself is fixed or user-selectable.
6. Assess runtime privileges (container root, cloud role, access to secrets mounts).
7. For AI agents: treat model/tool output as untrusted input to the same sinks.

## Evidence Requirements

- Sink location and shell vs argv mode
- Source of taint into command/args
- Missing allowlist or unsafe concatenation
- Privilege/impact context of the process

## False Positive Controls

- Hard-coded argv, no user influence
- Validated allowlist of subcommands/flags mapped server-side
- Library wrappers that only accept typed enums
- Test harnesses intentionally calling shells on fixtures

## Remediation

1. Prefer native libraries over shelling out.
2. Use argv arrays; never `shell=True` with untrusted data.
3. Allowlist executables and arguments; reject metacharacters by refusing shell entirely.
4. Drop privileges; isolate in a locked-down worker/container.
5. For agents: require human approval / strict tool allowlists for shell tools.

## Verification

```text
Detect shell sinks → Convert to argv/allowlist → Re-run axguard → Confirm no string-built shell calls remain
```

## Related Skills

- `ssti-analysis`, `deserialization-security` — alternate RCE classes
- `path-traversal`, `file-upload-security` — often chained into command tools
- `security-triage`, `security-remediation`

## Framework Mapping

- CWE-78 (OS Command Injection), CWE-77 (Command Injection)
- OWASP Top 10 2021 A03:2021 Injection

## References

- https://owasp.org/Top10/A03_2021-Injection/
- https://cwe.mitre.org/data/definitions/78.html
- https://cwe.mitre.org/data/definitions/77.html

## Research Provenance

Primary sources:

- OWASP Top 10:2021 A03 (accessed 2026-09-15)
- CWE-78, CWE-77 (accessed 2026-09-15)

Secondary / internal:

- AXGuard `rules/injection.json`, `/axguard-inject`
- AwareXone Agentic-Bug-Hunter command-injection methodology (concepts only; not copied)

Datasets:

- UVID HF dataset — category linkage concepts only (MIT license metadata review 2026-09-15)

Attribution

awarexoneawarexone
View sourceMore from awarexone →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Springboot Security

Java Spring Boot 服务中关于身份验证/授权、验证、CSRF、密钥、标头、速率限制和依赖安全的 Spring Security 最佳实践。

2456590 votes

Security Review

Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.

2456590 votes

Paperclip Task Bridge

Create, comment on, update, and list Paperclip tasks from Hermes using scoped Paperclip API credentials.

805540 votes

Summarize Status

Write a short, colloquial summary for a Paperclip summary slot: open with the 1–3 specific, concrete actions the reader needs to take right now to unblock the work, then a brief plain-language status, streaming progress as it works.

805540 votes

Paperclip Evals

Choose, inspect, validate, and report Paperclip Runner or Product E2E evaluations while preserving evidence, provenance, cost, and failure classification.

805540 votes
View all in security →