Review agent · Web & injection

Command & code injection

Checks whether user input reaches a shell, eval or template-evaluation sink.

tools/convert.py1name = form["filename"]2subprocess.run(3 f"convert {name} out.png",4 shell=True)CMDiwhat this review answersRequest data in a shell command?eval, exec or template injection?Arguments passed as a list?$ verdict REAL ISSUE$ fix argument list, no shell=True▍

Illustrative example of how this agent reviews a finding.

Why this agent matters

Command and code injection is usually game over: the attacker runs code as your application. The 2017 Equifax breach began with an injection flaw in Apache Struts.

Calls to subprocess or eval are common and often harmless — a fixed command, an argument list with no shell. This agent checks whether input is user-controlled and whether arguments are passed safely, so real sinks stand out.

What it checks

  • os.system, subprocess with shell=True, popen and backticks
  • eval / exec and dynamic code evaluation
  • Server-side template injection
  • Arguments built from request data

When it marks a finding as a likely false positive

  • The command is fixed, or arguments are passed as a list without a shell
  • Input is validated against an allow-list before use

The fix it suggests

  • Argument vectors without shell=True
  • Removing eval / exec
  • Allow-list validation of any input that must reach a command

Scope and limits

This agent judges findings the scanners report (Semgrep for code, secrets and IaC/config, OWASP ZAP for passive website scans, our rules for imported API collections); it doesn't hunt for new bugs on its own. A finding reaches it when its scanner, CWE or rule/path keywords match this vulnerability class. It sees only the minimal code or evidence around the finding, with secrets redacted, and Claude, via Amazon Bedrock, returns a verdict with a confidence score, a plain-English explanation and a suggested fix.

Common questions

Is every subprocess call flagged as dangerous?

No. A fixed command or an argument list with no shell is marked a likely false positive. The agent focuses on user-controlled input reaching a shell or evaluator.

How do I run a shell command safely with user input in Python?

Pass the command as an argument list without shell=True, so the input is never parsed by a shell, and validate any user-supplied value against an allow-list. Avoid eval and exec for anything driven by input.

Does it cover server-side template injection?

Yes. Template injection (CWE-1336) and dynamic code evaluation (CWE-94, CWE-95) are routed to this agent alongside OS command injection (CWE-78, CWE-77).

Related agents

See all 21 review agents → · Agent setup reviewer · How the pipeline works

Run the Command & code injection agent on your repository

100 free credits, no credit card. Every finding comes with a verdict and a fix.

Get started free