audit-agent-code

A security-audit workflow for the ordinary application code around an AI agent, such as message channels, file handlers, configuration loaders, and sandbox controls. It looks for classic software flaws including path traversal, command injection, server-side request forgery, missing authentication, and unsafe data loading.

In plain words
What is it for?
Use it to inspect an agent's own source code for security weaknesses at untrusted-input boundaries and other framework-level control points.
Why use it?
It checks attack surfaces that an AI model's refusal behavior may not protect. An attacker can sometimes bypass the model by exploiting the surrounding framework code directly.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/william2333zz/trustshell/audit-agent-code
Any agent
npx skills add William2333ZZ/trustshell --skill audit-agent-code
Clone the repo
git clone --depth 1 https://github.com/William2333ZZ/trustshell

Made for: Claude Code, Codex.

Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,403 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00102 $0.01403
Opus 5 $0.00051 $0.00701
Sonnet 5 $0.00020 $0.00281
Haiku 4.5 $0.00010 $0.00140

Measured yesterday against content hash 1435dd02c68a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

audit-agent-code scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- **Python**: `os.system`, `subprocess(..., shell=True)`, `Path(x) / untrusted`, `open(untrusted,'w')`,
skills/audit-agent-code/SKILL.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Audit the agent's code · framework appsec

The companion to redteam-an-agent. That skill breaks the running agent through the model. This one breaks it through its own source code — the classic appsec layer the model's judgment never touches.

Written from real engagements: two well-defended agents whose LLM refused every prompt-injection attempt were broken here instead — one by an unauthenticated path traversal in a channel's file handler, one by a fail-open sandbox. The model can't defend a code path it never sees.

Why this layer

Flagship agents increasingly harden the LLM layer: they refuse injected commands, resist memory poisoning, even decode obfuscated payloads to inspect them. Good. But the code around the model — the channel that parses an inbound message, the handler that saves an attachment, the loader that reads config/skills, the toggle that turns the sandbox on — is ordinary software, and it is frequently not hardened. An attacker who reaches those paths bypasses the model entirely. Audit them like you'd audit any web app.

Authorization & safety

Follow every rule in ../README.md: authorized target, disposable environment, harmless proof, responsible disclosure. Reading source is safe; never run untrusted target code on a machine you care about.

The untrusted-input boundaries (where to look)

Trace every place external, attacker-influenced data enters, and follow it to a dangerous sink:

  • Channel / message handlers — attachment filename → file write (path traversal); sender_id → path; message body → any sink. These run on every inbound message, often before auth.
  • File / media / download tools — path built from untrusted input; write/read outside the intended dir; symlink following.
  • Config / skill / MCP / plugin loaders — untrusted content → deserialization (pickle, yaml.load, eval), dynamic import, or a path.
  • The security controls themselves — the sandbox toggle, the guard, the auth gate. Audit the control, not just the happy path.

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 86 lines · 102 tokens per session scan A 1435dd02c68a

Subscribe to this mod's changes

audit-agent-code is a skill published in the GitHub repository William2333ZZ/trustshell (1 stars, last pushed 1mo ago), licensed MIT. It adds 102 tokens to every session and 1,403 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.