2 Source Analyzer
Identifies sensitive objects, detects wipe calls, validates correctness, and performs data-flow/heap analysis for zeroize-audit. Produces the sensitive object list and source-level findings consumed by compiler analysis and report assembly.
- Type
- Subagent
- Repository
- trailofbits/skills
- GitHub stars
- 7.3k
- License
- CC-BY-SA-4.0
- Repo last updated
- Sep 25, 2026
- Model
- inherit
What 2 Source Analyzer is
2 Source Analyzer is a subagent published in the trailofbits/skills repository on GitHub, which has about 7.3k stars. The repository describes itself as: “Trail of Bits Claude Code skills for security research, vulnerability detection, and audit workflows”
A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.
Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to 2 Source Analyzer and get back a compact result.
It is set up to use these tools: Read, Grep, Glob, Write, Bash. Limiting tools is a good sign: the subagent can only do what those tools allow.
How to install 2 Source Analyzer
Claude Code
- Download 2-source-analyzer.md from the repository.
- Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
- Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Claude Cowork
- Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
- Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from plugins/zeroize-audit/agents/2-source-analyzer.md, shared under the repository's CC-BY-SA-4.0 license. Read the full file on GitHub.
Identify sensitive objects, detect wipes, validate correctness, and perform data-flow and heap analysis. Produces source-level findings and the sensitive object list that drives all downstream analysis.
Input
You receive these values from the orchestrator:
Process
Step 0 — Load Configuration and Inputs
Read config_path to load the merged config (sensitive patterns, approved wipes, annotations). Read input_file to load tu_list (JSON array of {file, tu_hash}).
Step 1 — Load MCP Evidence (if available)
If mcp_available=true, read:
- {workdir}/mcp-evidence/symbols.json — resolved types, array sizes, struct layouts
- {workdir}/mcp-evidence/references.json — cross-file reference graph
MCP-resolved type data takes precedence over source-level estimates for wipe-size validation and copy detection.
Step 2 — Identify Sensitive Objects
Scan all TUs (up to max_tus) for objects matching heuristics from the merged config:
Name patterns (low confidence): Case-insensitive substring match: key, secret, seed, priv, sk, shared_secret, nonce, token, pwd, pass
Type hints (medium confidence): Byte buffers, fixed-size arrays, structs whose names or fields match name patterns.
Explicit annotations (high confidence): attribute((annotate("sensitive"))), SENSITIVE macro, Rust #[secret], Secret — configurable via merged config.
Cross-reference MCP-resolved type data from Step 1 where available.
Record each object with: name, type, location (file:line), confidence_level, matched_heuristic, and assign an ID SO-NNNN (sequential, zero-padded to 4 digits).
Step 3 — Detect Wipe Calls
For each sensitive object, check for approved wipe calls within scope or reachable cleanup paths. Approved wipes come from the merged config; defaults include explicit_bzero, memset_s, SecureZeroMemory, OPENSSL_cleanse, sodium_memzero, zeroize::Zeroize, Zeroizing , ZeroizeOnDrop, and volatile wipe loops.
Use MCP call-hierarchy data (if available) to resolve wipe wrappers across files.
Step 4 — Validate Correctness
For each sensitive object with a detected wipe, validate:
- Size correct: Wipe length must match sizeof(object), not sizeof(pointer) and not a partial length. MCP-resolved typedefs and array sizes take precedence. Emit PARTIAL_WIPE (ID: F-SRC-NNNN) if incorrect.
- All exits covered (heuristic): Verify the wipe is reachable on normal exit, early return, and visible error paths. Emit NOT_ON_ALL_PATHS if any path appears uncovered. Note: CFG analysis (agent 3-tu-compiler-analyzer) produces definitive results and may supersede this finding.
- Ordering correct: Wipe must occur before free() or scope end. Emit PARTIAL_WIPE with ordering note if violated.
Step 5 — Data-Flow and Heap Analysis
Use MCP cross-file references to extend tracking beyond the current TU where available.
Data-flow (produces SECRET_COPY):
- Detect memcpy()/memmove() copying sensitive buffers
- Track struct assignments and array copies
- Flag function arguments passed by value (copies on stack)
- Flag secrets returned by value
- Emit SECRET_COPY when any copy exists and no approved wipe tracks the destination
Optionally use {baseDir}/tools/track_dataflow.sh to assist with cross-function tracking.
Heap (produces INSECURE_HEAP_ALLOC):
- Detect malloc/calloc/realloc allocating sensitive objects
- Check for mlock()/madvise(MADV_DONTDUMP) — note absence as a warning
- Emit INSECURE_HEAP_ALLOC when standard allocators are used
Optionally use {baseDir}/tools/analyze_heap.sh to assist with heap analysis.
Step 6 — Build TU Map
For each TU containing at least one sensitive object, record the mapping from source file path to TU-{hash} (hash provided by orchestrator in tu_list). This map tells agent 3-tu-compiler-analyzer which TUs need compiler-level analysis.
Output
Write all output files to {workdir}/source-analysis/:
Finding ID Convention
- Sensitive objects: SO-NNNN (e.g., SO-0001, SO-0002)
- Source findings: F-SRC-NNNN (e.g., F-SRC-0001, F-SRC-0002)
Sequential numbering within this agent run. Zero-padded to 4 digits.
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is 2 Source Analyzer?
2 Source Analyzer is a subagent for Claude Code and Claude Cowork from the trailofbits/skills repository on GitHub. Identifies sensitive objects, detects wipe calls, validates correctness, and performs data-flow/heap analysis for zeroize-audit. Produces the sensitive object list and source-level findings consumed by compiler analysis and report assembly.
How do I install 2 Source Analyzer in Claude Code?
Download 2-source-analyzer.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Can I use 2 Source Analyzer in Claude Cowork?
Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
Is 2 Source Analyzer safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Second Opinion Gets independent code reviews from Codex or Antigravity for uncommitted changes, branch diffs, and commits. Plugin · trailofbits/skills
- Semgrep Rule Variant Creator Creates language variants of existing Semgrep rules with proper applicability analysis and test-driven validation Plugin · trailofbits/skills
- Sharp Edges Identify error-prone APIs, dangerous configurations, and footgun designs that enable security mistakes Plugin · trailofbits/skills
- Semgrep Scanner Executes Semgrep CLI scans for a specific language category and produces SARIF output. Spawned by the semgrep skill as a parallel worker —… Subagent · trailofbits/skills
- 2b Rust Source Analyzer Performs source-level zeroization analysis for Rust crates in zeroize-audit. Generates rustdoc JSON for trait-aware analysis and runs token-based dangerous API scanning. Produces sensitive objects and source findings consumed by rust-compiler-analyzer and report assembly. Subagent · trailofbits/skills
- 1 Mcp Resolver Resolves symbol definitions, types, and cross-file references using Serena MCP for zeroize-audit. Runs before source analysis so enriched type data is available for wipe validation. Subagent · trailofbits/skills
- 3 Tu Compiler Analyzer Performs per-TU compiler-level analysis (IR diff, assembly, semantic IR, CFG) for zeroize-audit. One instance runs per translation unit, enabling parallel execution across TUs. Subagent · trailofbits/skills
- 0 Preflight Performs preflight validation, config merging, TU enumeration, and work directory setup for zeroize-audit. Produces merged-config.yaml, preflight.json, and orchestrator-state.json. Subagent · trailofbits/skills