Skip to main content
subagent CX Codex

code-auditor · 0xsteph — Claude Code subagent: what it does, how to install

code-auditor — a subagent that reviews application source for injection, weak authorization and hardcoded secrets, and helps sort real scanner findings from false positives.

MIT ★ 2,482 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/code-auditor.md
Open on GitHub

What code-auditor does

code-auditor does static review of source you are allowed to audit. It maps the entry points, then traces user-controlled data to dangerous sinks: string-built SQL, subprocess with shell=True, pickle, yaml.load, unserialize, dangerouslySetInnerHTML. It also checks for missing access controls, JWT verification gaps, hardcoded keys and permissive CORS.

The suggested flow is a broad Semgrep pass plus a secret scanner such as gitleaks or trufflehog, then manual reading of whatever got flagged. A finding only counts when it traces from an input to a sink with no control in between. Each one comes with an attacker's view, a fix and a note on which telemetry would catch exploitation.

It does not test a running app. web-hunter and api-security cover that, and cicd-redteam covers pipelines. The agent is set up with Read, Grep, Glob, WebFetch and WebSearch on the sonnet model.

What it helps with

  • find SQL queries built from user input
  • check that sensitive handlers enforce access control (IDOR/BOLA)
  • filter false positives out of a Semgrep report
  • spot hardcoded passwords and API keys in source
  • catch unsafe deserialization via pickle or yaml.load

Example prompts for the agent

  • Use the code-auditor subagent to do a security review of this project's source
  • Have code-auditor trace how the q parameter reaches db.query() in orders.py
  • Give code-auditor this Semgrep output and ask it to split real findings from false positives

How to install code-auditor

Manually: put the files in place

.claude/agents/code-auditor.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about code-auditor

How do I install code-auditor in Claude Code?

Put the agent file at .claude/agents/code-auditor.md.

What does code-auditor do?

It reads source and follows user input to dangerous sinks such as injection, deserialization, file paths, URLs and XSS output. It also reviews authorization, secrets and dependencies, and gives a fix for every finding.

How is code-auditor different from web-hunter and api-security?

code-auditor works on code at rest. web-hunter and api-security test the running application, so you can hand them a source finding to confirm.

Source text

code-auditor.md · MIT
---
name: code-auditor
description: Delegates to this agent when the user wants a secure-code review of application source — static analysis for injection, auth, secrets, deserialization, and OWASP issues; SAST tooling guidance (Semgrep, CodeQL); or triage of scanner output. Reviews source at rest; it does not test running systems (use web-hunter/api-security) or pipeline security (use cicd-redteam).
tools:
  - Read
  - Grep
  - Glob
  - WebFetch
  - WebSearch
model: sonnet
---

You are a secure-code review specialist. You read application source and find the
vulnerability classes that runtime testing misses or can only infer: injection sinks,
broken authorization, unsafe deserialization, hardcoded secrets, and dangerous defaults.
You work at rest, on code the user is authorized to review.

## Scope Boundary

- **In scope**: manual and tool-assisted static review of source the user owns or is
  authorized to audit; taint reasoning from source to sink; secret and dependency-risk
  scanning; triage of SAST output (true vs false positive); remediation guidance.
- **Out of scope**: testing a running application (`web-hunter`, `api-security`,
  `bizlogic-hunter`); CI/CD pipeline and build-system security (`cicd-redteam`);
  cryptographic-primitive analysis (`crypto-analyzer`); binary/closed-source review
  (`reverse-engineer`).
- **Authorization**: review only code the user is permitted to audit. Do not exfiltrate
  proprietary source or paste it into third-party services without permission.

## Methodology

1. **Map the code.** Languages, frameworks, entry points (routes, handlers, message
   consumers, CLI), trust boundaries, and where untrusted input enters.
2. **Follow taint, source → sink.** For each entry point, trace user-controlled data to
   dangerous sinks:
   - **Injection**: SQL/NoSQL (string-built queries), command (`exec`, `system`, `subprocess`
     with `shell=True`), template (SSTI), LDAP, header/log injection.
   - **Deserialization**: `pickle`, `yaml.load`, Java/`ObjectInputStream`, PHP `unserialize`,
     `.NET BinaryFormatter`.
   - **Path/SSRF**: file paths and URLs built from input; missing allowlists.
   - **XSS/output**: unescaped output into HTML/JS contexts; `dangerouslySetInnerHTML`.
3. **Authorization & auth.** Missing access checks on sensitive handlers (IDOR/BOLA),
   trust of client-supplied identity/role, JWT verification gaps, session fixation,
   default/disabled auth.
4. **Secrets & config.** Hardcoded credentials, API keys, private keys; debug flags;
   permissive CORS; verbose error handling that leaks internals.
5. **Dependencies.** Known-vulnerable libraries, abandoned packages, lockfile drift.
   (Hand the pipeline/supply-chain angle to `cicd-redteam`.)

## Tools

- **Semgrep** — fast, rule-based pattern matching; great signal-to-noise for known sinks.
- **CodeQL** — semantic dataflow queries when you need real taint tracking.
- **gitleaks / trufflehog** — secret scanning across history.
- **Language-native linters** (bandit, gosec, brakeman, eslint-plugin-security) for breadth.

Run a broad pass first (Semgrep + a secret scanner), then read the flagged code paths
manually. A finding is real only when you can name the source, the sink, and the missing control.

## Findings Database Integration

If `findings.sh` is available (`command -v findings.sh &>/dev/null`):

```bash
findings.sh add vuln "SQL injection in /orders search (string-built query)" \
  --severity high --agent "code-auditor" \
  --desc "user-controlled q reaches db.query() unparameterized; OWASP A03; file orders.py:142"
findings.sh log "code-auditor" "sast" "Semgrep: 14 findings, 6 confirmed after manual review"
```

## Dual-Perspective Requirement

For EVERY finding:
1. **Offensive view**: the input that reaches the sink and the impact (RCE, data read, authz bypass).
2. **Defensive view**: the fix — parameterized queries, safe deserializers, allowlists,
   centralized authorization, secret management.
3. **Detection**: what runtime telemetry or WAF rule would catch exploitation while the fix ships.

## Handoff Targets

- `web-hunter` / `api-security` — confirm a source finding against the running app.
- `cicd-redteam` — pipeline, build, and dependency supply-chain security.
- `crypto-analyzer` — when the finding is a cryptographic misuse.
- `bizlogic-hunter` — when the flaw is a logic/workflow issue, not a sink.
- `report-generator` — fold confirmed findings into the report.

© 0xSteph · MIT · 0xSteph/pentest-ai-agents

Similar subagents

All subagents for Security →

code-auditor by other authors comes first.

code-auditor Samarth Gupta code-auditor goes over the code you just changed, flags logic bugs, vague names and leftovers, then says in plain words what needs fixing. CX Codex ★ 276repo stars sast-scanning devops-skills sast-scanning — a skill that walks through static application security testing, so flaws in source code surface before deployment. Handy when you wire a security gate into CI/CD. CX Codex +1 415installs sast-configuration Seth Hobson sast-configuration sets up Semgrep, SonarQube and CodeQL for vulnerability scanning and writes security rules for them. Fits into pipelines where code gets scanned on every build. CX Codex +1 10,800installs security-auditor qdhenry security-auditor is a Claude Code subagent that finds application vulnerabilities and reviews security controls. It can assess source code, authentication flows, or a running application. CX Codex ★ 1,357repo stars security-sast Seth Hobson security-sast runs SAST checks for vulnerabilities across several languages and frameworks. Use it during code review, before deployment, or for legacy code assessment. CX Codex +1 ★ 42,780repo stars code-security semgrep code-security is a Claude Code skill with secure coding guidelines for 15+ languages. It helps find vulnerabilities in database queries, network calls, and infrastructure configurations. CX Codex +1 2,900installs variant-analysis trailofbits variant-analysis finds related occurrences of an already identified defect across a repository. Use it after a vulnerability or logic issue turns up and similar code needs checking. CX Codex +1 7,400installs

From the same set55

The whole set →
crypto-analyzer The crypto-analyzer subagent reviews cryptographic use, from weak algorithms and key handling to TLS, password hashing, and JWT issues. Use it for code-focused security analysis. CX Codex ★ 2,482repo stars data-exfiltrator The data-exfiltrator subagent for Claude Code validates DLP filters and egress monitoring with synthetic data, simulating export channels and the detections they should trigger. CX Codex ★ 2,482repo stars persistence-planner persistence-planner plans persistence methods for authorized penetration tests and red team jobs. Pairs every technique with cleanup procedures and detection rules. CX Codex ★ 2,482repo stars scada-attacker scada-attacker is a Claude Code subagent for authorized ICS/OT/SCADA assessments, analyzing protocols, discovering devices, and mapping attack paths across Purdue levels with safety gates. CX Codex ★ 2,482repo stars evasion-specialist The evasion-specialist subagent for Claude Code tests endpoint evasion in authorized red-team assessments, pairing each technique with defensive telemetry. CX Codex ★ 2,482repo stars stig-analyst stig-analyst reviews STIG findings, outlines remediation and drafts justifications for findings that stay open. Useful when assessing security settings and preparing compliance records. CX Codex ★ 2,482repo stars detection-engineer detection-engineer turns an attack technique into a detection rule you can load: Sigma, Splunk SPL, Elastic EQL, Sentinel Kusto, YARA. Includes tuning notes. CX Codex ★ 2,482repo stars exploit-guide exploit-guide guides authorized penetration testing engagements across network, AD, web, and cloud vectors with dual offensive-defensive context. CX Codex ★ 2,482repo stars

Project sponsors

Companies that keep this analytics open