setup/Skills/security-audit/SKILL.md
Comprehensive security code audit using multi-phase analysis (Setup → Architecture → STRIDE → Code Review → Dependencies/Config → Report). Parallelized subagent orchestration with integrated scripts. Use when asked to perform security review, vulnerability assessment, code audit, pentest code review, find security bugs, or analyze code for vulnerabilities. Optimized for bug bounty hunting and AppSec with concrete evidence and exploitability validation.
npx skillsauth add mswell/dotfiles security-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Multi-phase security analysis with parallelized subagent orchestration. Produces actionable findings with concrete evidence (Source-to-Sink), eliminating generic warnings and false positives.
Rule #1: NO HALLUCINATION. Every finding MUST have exact file paths, line numbers, code snippets, and a reproducible exploit path.
Rule #2: Taint Analysis is MANDATORY. Prove user-controlled input (Source) reaches a dangerous function (Sink) without sanitization. Theoretical issues without attack vectors MUST NOT be reported.
Rule #3: BRAIN DUMP MANDATE. Before listing vulnerabilities, document reasoning, dead ends, and false positive eliminations.
Rule #4: Use Claude Code tools. Prefer Grep tool over rg/grep via Bash. Use Glob for file discovery. Reserve Bash for script execution and tool-specific commands (ast-grep, openssl, curl).
Rule #5: QUALITY GATE. Every finding MUST pass: (a) exact file:line reference, (b) proven taint flow, (c) realistic exploit scenario, (d) no generic/theoretical issues, (e) actionable remediation with code.
Subagents MUST use Claude Code's dedicated tools:
rg/grep via Bash)find/ls via Bash)cat/head/tail via Bash)ast-grep, python3 scripts, npm audit, pip audit, openssl, curlAvailable scripts (invoke via Bash with python3):
scripts/detect_project.py <path> — detects tech stack, frameworks, databases, entry pointsscripts/scan_secrets.py <path> — pattern + entropy-based secret scanningscripts/analyze_dependencies.py <path> — checks dependencies against known vulnerabilitiesscripts/generate_report.py — generates report in Markdown/JSON/SARIF (requires findings input)Reference files (provide to subagents):
references/vulnerability-patterns.md — tech-stack-specific sink/source patterns (JS, Python, Go, PHP, Ruby, Java, Rust)references/stride-methodology.md — STRIDE categories with concrete search patternsreferences/secrets-patterns.md — regex patterns for 24+ secret types with entropy thresholdsreferences/api-security-checklist.md — OWASP API Top 10 2023 checklistreferences/business-logic-checklist.md — business logic vulnerability patternsreferences/cwe-mapping.md — CWE mapping by severity with CVSS scoring guidereferences/report-templates.md — canonical report templates (Markdown, JSON, SARIF, Bug Bounty)Goal: Prepare workspace, detect project structure, run initial scans. NOT delegated to subagents.
mkdir -p .security-audit
python3 scripts/detect_project.py <codebase_path> > .security-audit/project_info.json
Review output: languages, frameworks, databases, entry points, config files.
python3 scripts/scan_secrets.py <codebase_path> > .security-audit/secrets_scan.json
Flag any high-confidence findings immediately.
python3 scripts/analyze_dependencies.py <codebase_path> > .security-audit/deps_scan.json
| Primary Tech Stack | Subagent |
|---|---|
| JavaScript/TypeScript/Node.js | js-security-expert |
| Python (Django, Flask, FastAPI) | webapp-security |
| Go | pentest |
| PHP (Laravel, Symfony, WordPress) | webapp-security |
| Ruby (Rails, Sinatra) | webapp-security |
| Java/Kotlin (Spring, Android) | webapp-security |
| REST API focused | api-security |
| GraphQL API focused | api-security |
| Mixed/unclear | pentest |
If the project has multiple significant stacks (e.g., Python backend + JS frontend), launch both tech-specific agents in Wave 1.
Parallelized 2-wave architecture for maximum speed.
Wave 1 (PARALLEL — launch all in a single message):
├── security agent → Phases 1 + 2 (Architecture + STRIDE) → .security-audit/architecture.md
├── [tech-specific agent] → Phase 3 (Deep Code Review + Taint Analysis)
└── security-automation agent → Phase 4 (Dependencies + Secrets + Configuration)
Wave 2 (SEQUENTIAL — after Wave 1 completes):
└── report-writer agent → Phase 5: Compile .security-audit/scan_report.md
Steps:
Agent calls in parallel. Provide each with:
references/stride-methodology.mdreferences/vulnerability-patterns.md, references/secrets-patterns.mdreferences/api-security-checklist.md, references/business-logic-checklist.mdreport-writer with all Wave 1 findings + references/cwe-mapping.md + references/report-templates.md..security-audit/scan_report.md path.Phase 0: Setup & Detection → detect_project.py, scan_secrets.py, analyze_dependencies.py
Phase 1: Architecture Assessment → tech stack, entry points, auth, data flows
Phase 2: STRIDE Threat Modeling → concrete threat hypotheses with search patterns
Phase 3: Deep Code Review → tech-specific vulnerability hunting + taint analysis
Phase 4: Deps, Secrets & Config → dependency vulns, secrets deep scan, config security
Phase 5: Report Generation → compile findings into scan_report.md
Goal: Map the application's tech stack, attack surface, and trust boundaries.
Process:
package.json, requirements.txt, go.mod, pom.xml, Gemfile, composer.json, Cargo.toml)Output: Write .security-audit/architecture.md with:
Goal: Generate concrete, testable threat hypotheses from Phase 1 architecture.
Reference: references/stride-methodology.md for full patterns per category.
For each STRIDE category, identify specific threats AND provide search patterns:
jwt.sign, jwt.verify, hardcoded secretsfacebook.com matches evilfacebook.com), domain-only checks without message structure validationstartsWith(registeredCallback) bypassed with ../ sequencesMath.random() used as cross-window authentication secret — predictable via PRNG state reconstruction../ traversal to hit unintended API endpoints. Bypasses SameSite cookies (same-origin request). Search: fetch('/api/' + variable, fetch(`/api/${param}`)param[0=value overriding param=value server-side; test duplicate/bracket-suffix parameters on OAuth and state-changing endpointsapplication/json;,text/html parsed differently by server libs vs browsers{result=NAME:$.field} syntax enables cross-request data exfiltration"No such class: INTERNAL_TYPE"postMessage(data, '*') with sensitive tokens/codes in the payloadactor_id/user_id not validated against authenticated session — caller can spoof identityurl= parameter makes authenticated requests on user's behalfOutput: Append threat hypotheses to .security-audit/architecture.md, ranked by risk.
Goal: Hunt for concrete vulnerability evidence using tech-specific patterns.
Reference: references/vulnerability-patterns.md for language-specific sink/source patterns.
Reference: references/secrets-patterns.md for secret detection regex.
Process:
Search for dangerous functions in the detected tech stack. Use Grep tool with patterns from references/vulnerability-patterns.md:
innerHTML, document.write, form.action, script.src set from event.data in message handlers)fetch('/api/' + userInput), template literal URL paths — Client-Side Path Traversal).js file content with user-derived values — supply-chain stored XSS)res.setHeader('Content-Type', userInput) after validation — parser differential XSS)Find where user input enters (from Phase 1 entry points):
For each sink found:
Only report if the flow is unbroken and exploitable. False positive elimination is critical.
Cross-reference Phase 0 scan_secrets.py results with manual inspection:
Goal: Check dependency vulnerabilities, deep secrets scan, and security configuration.
deps_scan.json resultsnpm audit, pip audit, bundle auditSecurity headers: Search for header configuration
Strict-Transport-Security (HSTS)Content-Security-Policy (CSP)X-Content-Type-Options: nosniffX-Frame-Options or CSP frame-ancestorsReferrer-PolicyCORS:
Access-Control-Allow-Origin — wildcard * with credentials?PostMessage security (high-value target per writeups):
addEventListener("message" — verify event.origin checked against hardcoded allowlistevent.origin used to construct URLs, load scripts, or build API requests = critical if not validatedpostMessage(data, '*') with tokens/codes in payload = always a buginnerHTML/document.write inside message handlers = DOM XSS even with origin checkOAuth/redirect security:
redirect_uri validation: must check full URL (scheme + host + path), not just hostnamestartsWith checks on redirect URIs vulnerable to path traversal (../)res.redirect(req.cookies.redirect_url) = open redirectresponse_type=token with redirect chains preserving fragment through HTTP redirectsInfrastructure configs (if present):
Dockerfile — running as root? multi-stage build? secrets in build args?docker-compose.yml — exposed ports? hardcoded passwords?.github/workflows/*.yml — secrets in env? untrusted input in run:? (action injection)terraform/, k8s/ — overly permissive IAM, public buckets, exposed services?Environment files:
.env* files committed? Check .gitignoreError handling:
references/business-logic-checklist.md)Output: Write .security-audit/scan_report.md
Reference: references/report-templates.md for format options (Markdown is default).
Reference: references/cwe-mapping.md for accurate CWE classification and CVSS scoring.
# Brain Dump
## Project Overview
- **Tech Stack:** [languages, frameworks, databases]
- **Architecture:** [monolith / microservices / serverless]
- **Entry Points:** [count of routes/endpoints mapped]
- **Auth Mechanism:** [JWT / sessions / OAuth / API keys / none]
## Attack Surface Summary
- **Unprotected endpoints:** [count and list]
- **Dangerous sinks found:** [count by category]
- **External integrations:** [databases, cloud services, third-party APIs]
- **Dependency vulnerabilities:** [count by severity from Phase 4]
## STRIDE Threat Coverage
- **Spoofing:** [hypotheses tested, results]
- **Tampering:** [hypotheses tested, results]
- **Repudiation:** [hypotheses tested, results]
- **Information Disclosure:** [hypotheses tested, results]
- **Denial of Service:** [hypotheses tested, results]
- **Elevation of Privilege:** [hypotheses tested, results]
## Analysis Log
- [Key decisions and reasoning during analysis]
- [Code paths investigated, patterns discovered]
## Dead Ends & False Positive Elimination
- [Sinks found but properly sanitized — with explanation]
- [Patterns searched but not present]
- [Findings investigated and discarded — specific reason]
---
# Security Audit Report: [Project Name]
Date: [timestamp]
## Executive Summary
- **Tech Stack:** [Languages/Frameworks]
- **Total Vulnerabilities:** X (Critical: X | High: X | Medium: X | Low: X)
- **Key Risks:** [1-2 sentences on most critical issues]
---
## [VULN-001] Title
**Severity:** Critical | High | Medium | Low
**CWE:** CWE-XXX — [Title]
**CVSS 3.1:** X.X (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N)
**Description & Impact:**
[What the vulnerability is and what an attacker achieves]
**Evidence & Taint Analysis:**
**Source:** `path/to/file.ext:line` — [where user input enters]
```[language]
// Source code snippet
Sink: path/to/file.ext:line — [where input reaches dangerous function]
// Sink code snippet
Flow: Source → [propagators] → Sink
Proof of Concept:
// Step-by-step exploit
Remediation:
// Specific secure code example
## Directory Exclusions
When searching, exclude: `.git/`, `node_modules/`, `venv/`, `.venv/`, `__pycache__/`, `target/`, `vendor/`, `dist/`, `build/`, `coverage/`, `.next/`, `.cache/`
development
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
tools
Turn the current conversation context into a PRD and publish it to the project issue tracker. Use when user wants to create a PRD from the current context.
tools
Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into issues.
development
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.