Find exploitable vulnerabilities in codebases
Turns a coding agent into an evidence-first security auditor - six-phase methodology, severity rubric, and authorized-use-only scope.
Why it matters
Perform comprehensive security audits of applications, APIs, and services to discover real-world exploitable vulnerabilities with concrete attack scenarios and measurable impact.
Outcomes
What it gets done
Map application architecture, trust boundaries, and input surfaces through reconnaissance
Hunt for authorization bypasses, injection paths, and business logic flaws across the codebase
Validate findings dynamically by building and executing proof-of-concept exploits
Generate structured reports with severity ratings based on likelihood and impact
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-cloudflare-security-audit | bash Overview
Security Audit
Runs a six-phase, evidence-first security audit (recon, hunt, validate, report, structured output, independent verification) with a likelihood-times-impact severity rubric, restricted to authorized codebases. Use when asked to security-audit, pen-test, or find vulnerabilities in a codebase the user owns or is explicitly authorized to assess.
What it does
This skill turns an AI coding agent into a security auditor whose job is to find exploitable vulnerabilities with real impact, restricted to code and systems the user owns or is explicitly authorized to assess, keeping testing non-destructive and inside the approved scope. It's platform-agnostic, mapping its own vocabulary (Task tool, research agent, general agent, subagent_type) onto whatever delegation mechanism the current coding agent platform provides.
Before starting, it establishes a target (the codebase to audit), a target identity (a stable ID hashed from the canonical repository path plus its normalized origin URL, so same-named repos never share history), and an output directory (defaulting to ~/security-audit-skill/<target-id>/run-<N>). All audit artifacts are written there: architecture.md (Phase 1 output feeding Phase 2), REPORT.md (human-readable Phase 4 report), FINDINGS-DETAIL.md (detailed data flows for MEDIUM+ findings), findings.json (machine-readable Phase 5 output), and target.json (the canonical path/origin/ID binding the run). Subagents in Phases 1, 2, 3, and 6 never write files themselves - they return results via the Task tool, and the top-level agent is responsible for all file writes.
Because a single run finds roughly half the total vulnerabilities across multiple runs, it explicitly reasons about prior runs: if a prior run exists for the exact target ID (verified by matching target.json byte-for-byte, never matched on directory basename alone), it reads matching findings.json files before Phase 2 to skip re-discovering known findings, target coverage gaps (e.g. weighting toward business logic if prior runs focused on injection and auth), and resolve any conflicting verdicts; if no prior runs exist, it notes in the report that coverage improves with additional runs.
Five core principles govern every finding. Only report what you can exploit - a finding needs a concrete attacker/action/outcome, not a theoretical "could." Confirm dynamically when possible - for locally buildable targets, build and run them, reproduce crashes, diff parsers on the same bytes, or extract suspect code into a minimal standalone harness to fuzz in isolation; anything needing infrastructure the auditor doesn't have (a proxy chain, a live cache, production auth) gets marked "requires deployment testing" rather than reported as confirmed. Determine the baseline dynamically - calibrate against comparable applications (a CMS against other CMSes, an API gateway against other API gateways) without hardcoding a specific comparable, and treat a pattern that's been exploited in a comparable as a stronger finding, not a weaker one. Defense-in-depth gaps are not vulnerabilities - if one layer already prevents the attack, a missing second layer is a hardening note, not a finding. Severity requires impact - computed from likelihood plus impact across five levels (CRITICAL: unauthenticated RCE, full DB dump, admin takeover without credentials; HIGH: authenticated RCE, exfiltrating SQLi, stored XSS firing for all users, auth bypass, or a completely defeated RBAC boundary with real consequences; MEDIUM: targeted XSS, meaningful-state CSRF, secret/credential disclosure, or a business-logic bypass with limited consequences; LOW: non-secret information disclosure, DoS requiring sustained effort; INFORMATIONAL: a confirmed but minimal-impact building-block observation), with the key HIGH-vs-MEDIUM test being whether the finding defeats an explicit security boundary. These principles are enforced by validation rules in a companion HUNTING.md reference, re-applied adversarially in Phase 3.
The workflow runs six phases in order, each backed by a reference file: Recon (map architecture, trust boundaries, and input surfaces via RECONNAISSANCE.md), Hunt (orchestration and validation rules from HUNTING.md, routing native/AI-LLM/HTTP-protocol-auth/client-side targets to specialized companion files for memory-safety-and-binary, AI-and-LLM, web-protocol-and-auth, and client-side attack classes), Validate (Phase 3 in VALIDATION-AND-REPORTING.md consolidates duplicates and tries to disprove every finding), Report (Phase 4 writes REPORT.md and FINDINGS-DETAIL.md), Structured output (Phase 5 writes and schema-validates findings.json), and Independent verification (Phase 6 verifies every factual claim and reconciles all outputs).
Ten documented anti-patterns to avoid: listing every OWASP deviation as a finding, rating defense-in-depth gaps as HIGH/CRITICAL, ignoring the deployment model (e.g. CDN-layer rate limiting is valid architecture), treating designed/trusted behavior as a bug, padding the report with LOW findings for the appearance of thoroughness, reporting unproven "potential" findings, ignoring what the codebase does well, constructing exploits from unverified parser/runtime assumptions, skipping business logic and creative attacks in favor of only scanner-class vulnerabilities, and giving up on a hypothesis too easily (e.g. assuming parameterized queries rule out SQL injection without checking every sql.raw() use, dynamic identifier, or query-builder bypass).
When to use - and when NOT to
Use when asked to perform a security audit, find security bugs, do a security review, audit for vulnerabilities, or pen-test a codebase - for web apps, APIs, services, CLI tools, libraries, daemons, and more. Use only on code and systems the user owns or is explicitly authorized to assess, and keep testing non-destructive and inside the approved scope.
Inputs and outputs
Input is a target codebase (from the request or current working directory) plus an optional output directory. Output is a structured audit run directory containing architecture.md, REPORT.md, FINDINGS-DETAIL.md, findings.json (schema-validated), and target.json, produced by a coding agent capable of tool use and parallel sub-agents, with a trusted JSON Schema validator available for Phase 5.
User: Audit this repository for authorization bypasses and injection paths. Keep testing local and non-destructive.
Agent: I will confirm the repository scope, map trust boundaries, validate each candidate, and report only reproducible findings.
Integrations
A coding agent's own Task-tool delegation/sub-agent mechanism (research and general agent roles), plus six companion reference files (RECONNAISSANCE.md, HUNTING.md, ATTACK-CLASSES.md, VALIDATION-AND-REPORTING.md, and the domain-specific MEMORY-SAFETY-AND-BINARY.md/AI-AND-LLM.md/WEB-PROTOCOL-AND-AUTH.md/CLIENT-SIDE.md) and a JSON Schema validator for findings.json.
Who it's for
Security engineers and coding agents running authorized security audits or penetration tests on codebases they own or have explicit permission to assess, who need a structured, evidence-first methodology rather than an OWASP-checklist scan.
Source README
Security Audit
Example
User: Audit this repository for authorization bypasses and injection paths. Keep testing local and non-destructive.
Agent: I will confirm the repository scope, map trust boundaries, validate each candidate, and report only reproducible findings.
You are a security auditor. Your job is to find exploitable vulnerabilities with real impact.
When to Use
Use this skill when asked to perform a security audit, find security bugs, do a security review, audit for vulnerabilities, or pen-test a codebase. Activate it for web apps, APIs, services, CLI tools, libraries, daemons, and more.
Platform terminology
This skill is agent-neutral. In the methodology:
- Task tool means the coding agent's delegation or sub-agent mechanism.
researchagent means a delegated agent optimized for focused codebase exploration and factual verification.generalagent means a delegated agent that can investigate broadly and spawn focused research agents.subagent_typemeans the equivalent delegated-agent role supported by the current platform.
Use the platform's equivalent capabilities while preserving the specified roles, parallelism, prompts, and independence boundaries.
Setup
Before starting, establish two paths and one target identity:
- Target: the codebase to audit (from the user's request or the current working directory)
- Target identity: the canonical physical repository path plus its normalized
originowner/repository URL. Hash both values to create a stable target ID; do not key history by repository basename alone. - Output directory: where all audit artifacts go. Ask the user if not specified, or default to
~/security-audit-skill/<target-id>/run-<N>where<N>is the next unused integer. Create it if it doesn't exist. This ensures same-named repositories cannot share audit history.
All files written during the audit go in the output directory:
architecture.md- Phase 1 output, fed into Phase 2 agent promptsREPORT.md- human-readable report (Phase 4)FINDINGS-DETAIL.md- detailed data flows for MEDIUM+ findings (Phase 4)findings.json- machine-readable structured output (Phase 5)target.json- canonical path, normalized origin, and target ID used to bind this run
Subagents (Phases 1, 2, 3, 6) do NOT write files - they return results to you via the Task tool. You are responsible for writing all files to the output directory.
Coverage and prior runs
Each audit run explores different code paths depending on which agents find what and where they dig. No single run finds everything. Testing shows the best single run finds roughly half the total vulnerabilities across multiple runs.
If prior runs exist for the exact target ID, first require their target.json canonical path and normalized origin to match the current target byte-for-byte. Treat missing or mismatched manifests as unrelated and never read or summarize their findings. Do not search or reuse prior runs from a basename-only directory. After that identity check, read matching findings.json files before starting Phase 2. Use them to:
- Skip known findings - don't waste agents re-discovering the same status bypass. Mention prior findings in the report but focus hunting effort on new ground.
- Target gaps - if prior runs focused heavily on injection and auth, weight this run toward business logic, creative attacks, and the wildcard agent. If prior runs missed public endpoints, focus there.
- Resolve disagreements - if prior runs gave conflicting verdicts on the same finding, validate it definitively.
Include a brief summary of prior runs in the architecture summary so Phase 2 agents know what's already been found.
If no prior runs exist, note in the report that coverage improves with additional runs and recommend the user run the audit again to catch findings this run may have missed.
Core Principles
Only report what you can exploit
Every finding must have a concrete attack scenario: who is the attacker, what do they do, and what do they get? "An attacker could theoretically..." is not a finding. "Send this request, get this result" is.
Confirm dynamically when you can
This is a source-first audit, but a claim you can execute beats one you can only argue. Where the target is locally buildable - a parser, a library, a CLI, a native component - build and run it: reproduce the crash, run the payload, diff the two parsers on the same bytes. Better still, extract the suspect code into a minimal standalone harness and test the hypothesis in isolation - fuzz the one function, feed it the crafted input, watch what it does. Where confirmation needs infrastructure you don't have - a proxy chain, a live cache, production auth - you cannot confirm from source alone: mark it "requires deployment testing" and do not report it as confirmed. Dynamic evidence is what resolves the memory-safety and request-framing classes that static reading leaves ambiguous.
Determine the baseline dynamically
In Phase 1, identify what this application is and what comparable applications exist. Use those comparables to calibrate -- not to dismiss findings, but to focus effort. If the comparable has the same pattern and it's been exploited there, that's a STRONGER finding, not a weaker one. If the comparable has the same pattern and nobody's ever exploited it in 20 years, you should understand why before reporting it.
Do NOT hardcode a specific comparable. A CMS gets compared to other CMSes. An API gateway gets compared to other API gateways. A novel application may have no meaningful comparable.
Defense-in-depth gaps are not vulnerabilities
If Layer A prevents the attack, the absence of Layer B is a hardening note, not a finding. Report it separately if you want, but do not inflate its severity.
Severity requires impact
Severity is the combination of likelihood (how easy to exploit, what access is needed) and impact (what damage is achieved). Use both axes:
- CRITICAL: Unauthenticated RCE, full database dump, admin account takeover without credentials
- HIGH: Authenticated RCE, SQL injection with data exfiltration, stored XSS that fires for all users, auth bypass. Also: any finding where the RBAC/permission model is completely defeated for an action - e.g., a user can perform an action that the system explicitly gates behind a higher role, and the action has real consequences (publishing content, deleting resources, modifying other users' data).
- MEDIUM: Targeted XSS requiring specific conditions, CSRF with meaningful state change, information disclosure of secrets/credentials. Also: business logic bypasses with real but limited consequences - e.g., the action is possible but requires authentication, or the impact is confined to the attacker's own data, or the bypass requires uncommon conditions.
- LOW: Information disclosure of non-secret data, DoS requiring sustained effort
- INFORMATIONAL: A confirmed but minimal-impact observation with no standalone exploit - useful mainly as a building block for another finding. Pure defense-in-depth gaps belong in hardening notes, not here.
The key distinction between HIGH and MEDIUM for business logic findings: does the finding defeat an explicit security boundary? Defeating one - acting past a role the system explicitly enforces - is HIGH; a data inconsistency, a finding that requires privileged access to exploit, or one with limited blast radius is MEDIUM.
If you cannot describe the concrete damage an attacker achieves, the severity is probably lower than you think.
These principles are enforced operationally by the validation rules in HUNTING.md - the canonical bar every hunter applies before reporting a finding, and that Phase 3 re-applies adversarially. The domain companion files add domain-specific checks on top of that bar; they do not replace it.
Workflow overview
Follow all six phases in order:
- Recon - Run Phase 1 from RECONNAISSANCE.md to map the application's architecture, trust boundaries, and input surfaces.
- Hunt - Use HUNTING.md for Phase 2 orchestration, methodology, and validation rules; select scopes from ATTACK-CLASSES.md, which routes native, AI/LLM, HTTP-protocol/auth, and client-side targets to specialized companion files (MEMORY-SAFETY-AND-BINARY.md, AI-AND-LLM.md, WEB-PROTOCOL-AND-AUTH.md, CLIENT-SIDE.md).
- Validate - Use Phase 3 in VALIDATION-AND-REPORTING.md to consolidate duplicates and independently try to disprove every finding.
- Report - Use Phase 4 in VALIDATION-AND-REPORTING.md to write
REPORT.mdandFINDINGS-DETAIL.md. - Structured output - Use Phase 5 in VALIDATION-AND-REPORTING.md and
resources/report-schema.jsonto writefindings.json, then validate it with a trusted JSON Schema validator already available in the user's environment. - Independent verification - Use Phase 6 in VALIDATION-AND-REPORTING.md to verify every factual claim and reconcile all outputs.
Limitations
- Requires a coding agent with a model that supports tool use and parallel sub-agents
- A trusted JSON Schema validator is required for structural validation in Phase 5
- Multiple runs are needed for full coverage - a single run typically finds roughly half of the total vulnerabilities
- The skill does not replace manual penetration testing or automated SAST/DAST tools
Anti-Patterns to Avoid
These are the mistakes that make security audits useless:
- Listing everything that deviates from OWASP as a finding. OWASP is a checklist, not a bug list. Every real application makes tradeoffs.
- Rating defense-in-depth gaps as HIGH/CRITICAL. "Missing validateIdentifier where the query builder already quotes identifiers" is not HIGH severity.
- Ignoring the deployment model. Rate limiting at the CDN layer is a valid architecture. Not every app needs application-level rate limiting.
- Treating designed behavior as a bug. Understand the trust model before auditing. If the design says admins are fully trusted, admin-does-admin-things is not a finding.
- Padding the report with LOW findings to look thorough. Ten LOWs don't make a useful report. Three MEDIUMs do.
- "Potential" findings without proof. Either you can exploit it or you can't. If you need the word "potentially" or "theoretically", you haven't done enough research.
- Ignoring what the codebase does well. If auth is solid, say so. It builds trust in the findings you DO report and helps the team prioritize.
- Constructing exploits from incorrect parser/runtime assumptions. The most convincing false positives come from reasoning "the parser/runtime will interpret this as..." without verifying. If your exploit depends on parser or runtime behavior, cite the spec or test it. Don't assume.
- Skipping business logic and creative attacks. The standard vulnerability classes (SQLi, XSS, SSRF) are what every scanner checks. The value of a manual audit is finding the things scanners can't: logic errors, state machine violations, chained attacks, implicit trust assumptions.
- Giving up too easily. "The codebase uses parameterized queries so there's no SQL injection" is a lazy conclusion. Check EVERY use of sql.raw(). Check dynamic identifiers. Check search/FTS. Check if there's a code path that bypasses the query builder. Push.
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.