Agent skill

Detecting Command Injection Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node childprocess.exec with template literals…

MITAuto-check passedTesting & QA

Install Detecting Command Injection Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-command-injection-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace detecting-command-injection-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/detecting-command-injection-patterns .claude/skills/detecting-command-injection-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
detecting-command-injection-patterns
GitHub stars
2.8k
Token cost
~1.3k tokens
SKILL.md length
343 words
Files
4 (incl. scripts, references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node childprocess.exec with template literals…

  • Works in 3 steps: Run the scanner → Interpret findings → Remediation
  • : pre-commit gate on code that calls out to shell utilities
  • SKILL.md covers Overview, When the skill produces findings, Prerequisites and Instructions, plus 4 more sections
  • Runs Python scripts from its folder; calls python3 and git

What it does

Detecting Command Injection Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node childprocess.exec with template literals, Ruby backticks / Kernelsystem / Kernelexec with interpolation, Go exec.Command with shell wrapping, PHP system / passthru / shellexec / backticks with $-interpolation, Java Runtime.exec with concatenated args. Use when: pre-commit gate on code that calls out to shell utilities, audit of file-processing / archive-handling…

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including scripts and reference files (for example `references/PLAYBOOK.md`, `references/THEORY.md` and `scripts/scan_cmdi.py`). Compatibility notes: Designed for Claude Code

It sits in Testing & QA, covering QA and bug reports. It works with Python, Ruby, Java and PHP. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • : pre-commit gate on code that calls out to shell utilities
  • Audit of file-processing / archive-handling / image-conversion code
  • Shell=True with anything other than a fixed literal
  • With: scan command injection

Example prompts

  • “we shell out to a tool.”
  • “scan command injection”
  • “shell=True audit”
  • “/detecting-command-injection-patterns”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Bash(python3:*), Glob, Grep

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Run the scanner
  2. Interpret findings
  3. Remediation

What it can do on your machine

Read from SKILL.md and the folder at commit 23ea8d4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Bash(python3:*)
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Detecting Command Injection Patterns loads about 1.3k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 224 tokens; SKILL.md has 343 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~224
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 23ea8d4, republished under its MIT licence (© jeremylongshore). 343 words, ~1,278 tokens.

Download SKILL.mdSave it as .claude/skills/detecting-command-injection-patterns/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
detecting-command-injection-patterns
description
Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node child_process.exec with template literals, Ruby backticks / Kernel#system / Kernel#exec with interpolation, Go exec.Command with shell wrapping, PHP system / passthru / shell_exec / backticks with $-interpolation, Java Runtime.exec with concatenated args. Use when: pre-commit gate on code that calls out to shell utilities, audit of file-processing / archive-handling / image-conversion code, post-bug-report investigation for "we shell out to a tool." Threshold: any shell-invocation API called with a string that contains a variable interpolation, OR shell=True with anything other than a fixed literal. Trigger with: "scan command injection", "shell=True audit", "find exec calls", "check os.system".
allowed-tools
Read, Bash(python3:*), Glob, Grep
compatibility
Designed for Claude Code
disallowed-tools
Bash(rm:*), Bash(curl:*)
version
3.30.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
security, static-analysis, command-injection, pentest

Detecting Command Injection Patterns

Overview

Command injection (CWE-78, OWASP A03:2021) shows up wherever an application shells out to a binary. Image conversion (convert), archive extraction (tar, unzip), video processing (ffmpeg), DNS lookup (dig), and "we just need to call this CLI tool once" are the common origins.

The vulnerability shape is universal: a string is built including user input, then handed to a shell interpreter. The shell parses the string with normal shell semantics — including ;, |, &, $(), backticks. Any of those in the user-controlled portion becomes shell-executable.

When the skill produces findings

FindingSeverityThresholdAffected control
Python subprocess.run(..., shell=True) with interpolationCRITICALf-string / concat / format argument with shell=TrueCWE-78
Python os.system(...) with interpolationCRITICALnon-literal argumentCWE-78
Python os.popen(...) with interpolationCRITICALnon-literal argumentCWE-78
Node child_process.exec(...) with template literalCRITICAL${...} in the command stringCWE-78
Node child_process.execSync(...) with templateCRITICALsameCWE-78
Ruby backticks with interpolationCRITICAL`cmd #{var}`CWE-78
Ruby Kernel#system(string) with interpolationCRITICALsystem("cmd #{var}")CWE-78
Go exec.Command("sh", "-c", ...) with interpolationHIGHshell wrapper with varCWE-78
PHP system / exec / passthru / shell_exec with $-interpCRITICALsystem("cmd $var")CWE-78
Java Runtime.exec(String) with concatHIGHsingle-string form (vs array) with varCWE-78

Prerequisites

  • Python 3.9+
  • Target source tree on local filesystem

Instructions

Step 1 — Run the scanner
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-command-injection-patterns/scripts/scan_cmdi.py /path/to/repo

Options:

Usage: scan_cmdi.py PATH [OPTIONS]

Options:
  --output FILE      Write findings to FILE
  --format FMT       json | jsonl | markdown (default: markdown)
  --min-severity SEV (default: info)
  --include-tests    Include test directories (default: excluded)
  --languages LIST   Comma-separated subset to scan
Step 2 — Interpret findings

CRITICAL = direct user-input → shell construction. Fix immediately.

HIGH = pattern where the shell layer exists but user-input reachability needs verification.

Step 3 — Remediation

The universal fix: pass arguments as a list (array), not a single string. Most APIs have a list form that bypasses shell entirely.

See references/PLAYBOOK.md for per-language patterns.

Examples

Example 1 — Pre-commit on a media-processing service
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-command-injection-patterns/scripts/scan_cmdi.py \
    --min-severity high $(git diff --name-only main...HEAD | tr '\n' ' ')
Example 2 — CI gate
yaml
- name: Command-injection scan
  run: |
    python3 plugins/security/penetration-tester/skills/detecting-command-injection-patterns/scripts/scan_cmdi.py \
        . --min-severity high

Output

JSON / JSONL / Markdown. Exit codes: 0 clean, 1 high/critical, 2 error.

Error Handling

False positives common in build scripts that interpolate fixed build constants. Verify each finding by reading whether the interpolated value is user-reachable.

Resources

  • references/THEORY.md — Why shell=True is the default footgun, per-language shell-out idioms, argument-vector vs command-string semantics
  • references/PLAYBOOK.md — Per-language safe-shellout patterns (Python subprocess list-args, Node spawn, Ruby Open3.capture3, Go exec.Command list-args, Java ProcessBuilder, PHP escapeshellarg)

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, references) in skills/.curated/detecting-command-injection-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/PLAYBOOK.md
  • references/THEORY.md
  • scripts/scan_cmdi.py

Open the folder on GitHubat commit 23ea8d4

Compare with similar skills

Detecting Command Injection Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Detecting Command Injection Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Detecting Command Injection Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.3kAutomated safety check: PassMIT
Security Reviewgithub/awesome-copilot40k1 repos~2.3kAutomated safety check: NotesMIT
Hunt DeserializationEncod3d-Sec/TORCH329—~1.7kAutomated safety check: PassMIT
Phy Regex AuditLeoYeAI/openclaw-master-skills2.2k—~5.1kAutomated safety check: PassApache-2.0
Supercovsupercorp-ai/supercov1501 repos~415Automated safety check: PassMIT
Crap Analyzerswingerman/engineer154—~1.2kAutomated safety check: PassMIT

Similar skills

  • Security Review

    github/awesome-copilot

    Official

    AI-powered codebase security scanner that reasons about code like a security researcher — tracing data flows, understanding component interactions, and catching vulnerabilities that pattern-matching…

    40k GitHub starsUsed in 1 repo~2.3k tokens
    SecurityAuto-check: notes
  • Hunt Deserialization

    Encod3d-Sec/TORCH

    Insecure deserialization hunting across Java / .NET / PHP / Python / Ruby / Node.

    329 GitHub stars~1.7k tokensUpdated 1 mo ago
    SecurityAuto-check passed
  • Phy Regex Audit

    LeoYeAI/openclaw-master-skills

    Static ReDoS (Regular Expression Denial of Service) vulnerability scanner and regex quality auditor for codebases.

    2.2k GitHub stars~5.1k tokensUpdated 2 mo ago
    SecurityAuto-check passed
  • Supercov

    supercorp-ai/supercov

    Measures test coverage and code quality in a repository with the supercov CLI, and turns what it finds into small, focused tests or fixes.

    150 GitHub starsUsed in 1 repo~415 tokens
    Testing & QAAuto-check passed
  • Crap Analyzer

    swingerman/engineer

    A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

    154 GitHub stars~1.2k tokensUpdated 15 days ago
    Testing & QAAuto-check passed
  • Sync Client Libs

    googleads/google-ads-api-developer-assistant

    Discovers Google Ads client libraries under clientlibs, verifies installed versions against GitHub latest releases, and automatically updates outdated codebases.

    100 GitHub stars~537 tokensUpdated 22 days ago
    Marketing & SEOAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Categories

Questions about Detecting Command Injection Patterns

What does Detecting Command Injection Patterns do?

Scan a source tree for command-injection vulnerable patterns: shell=True calls in Python subprocess, os.system / os.popen with interpolated strings, Node childprocess.exec with template literals…. Detecting Command Injection Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace.exec with concatenated args.

When should I use Detecting Command Injection Patterns?

Detecting Command Injection Patterns fits situations like: : pre-commit gate on code that calls out to shell utilities; audit of file-processing / archive-handling / image-conversion code; shell=True with anything other than a fixed literal; with: scan command injection.

How do I install Detecting Command Injection Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-command-injection-patterns -a claude-code`. Or copy the skill folder (skills/.curated/detecting-command-injection-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/detecting-command-injection-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Detecting Command Injection Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-command-injection-patterns -a codex`. Or copy the skill folder (skills/.curated/detecting-command-injection-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/detecting-command-injection-patterns in your project. Codex loads it when a task matches its description.

Can I use Detecting Command Injection Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-command-injection-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/detecting-command-injection-patterns, .gemini/skills/detecting-command-injection-patterns, .github/skills/detecting-command-injection-patterns and .opencode/skills/detecting-command-injection-patterns in your project.

What does Detecting Command Injection Patterns need to run?

Going by SKILL.md and its folder, Detecting Command Injection Patterns needs Python for the scripts in its folder and the command-line tools its instructions call (python3 and git). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Bash(python3:*), Glob, Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Detecting Command Injection Patterns access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Detecting Command Injection Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Detecting Command Injection Patterns use?

Detecting Command Injection Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Detecting Command Injection Patterns use?

About 1.3k tokens (SKILL.md is roughly 5.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Detecting Command Injection Patterns?

Skills that share tags, products or a category with Detecting Command Injection Patterns: Security Review (github/awesome-copilot, 40k stars), Hunt Deserialization (Encod3d-Sec/TORCH, 329 stars), Phy Regex Audit (LeoYeAI/openclaw-master-skills, 2.2k stars) and Supercov (supercorp-ai/supercov, 150 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Detecting Command Injection Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.