| name | security-audit |
| description | Security audit for code: OWASP Top 10, injection, auth flaws, secrets, dependency vulnerabilities — with severity and fix for each finding |
Security Audit Skill
When to activate
- Pre-launch security review of a new feature or endpoint
- Auditing a codebase before open-sourcing it
- Code review feedback requests security analysis
- After adding authentication, authorization, or payment handling
- Before a penetration test — find the obvious issues first
When NOT to use
- Dependency scanning — use
npm audit, pip-audit, or Snyk instead (Claude can't read CVE databases)
- Live penetration testing against production systems
- Compliance certification (SOC2, PCI-DSS) — these require human auditors and tooling
- Binary/compiled code — Claude needs source
Instructions
Invoking the audit
/security-audit
Scope: {file, directory, or describe the area}
Focus: {all / auth / input validation / secrets / API endpoints}
Or targeted:
/security-audit
Review the user authentication flow in src/auth/.
Pay special attention to: session management, password reset, and JWT validation.
OWASP Top 10 checklist Claude works through
A01 — Broken Access Control
A02 — Cryptographic Failures
A03 — Injection
A04 — Insecure Design
A05 — Security Misconfiguration
A06 — Vulnerable Components
A07 — Auth & Session Failures
A08 — Software & Data Integrity Failures
A09 — Logging & Monitoring Failures
A10 — SSRF (Server-Side Request Forgery)
Output format
Claude reports each finding with:
[SEVERITY] {title}
Location: {file:line or area}
Issue: {what the vulnerability is}
Risk: {what an attacker could do}
Fix:
{code change or configuration step}
Severity levels:
- 🔴 CRITICAL — exploitable right now, data breach or account takeover possible
- 🟠 HIGH — exploitable with some conditions, significant impact
- 🟡 MEDIUM — exploitable in specific scenarios, moderate impact
- 🟢 LOW — defence-in-depth issue, low probability or impact
- ℹ️ INFO — best practice not followed, no direct exploitability
Common findings and fixes
SQL injection:
cursor.execute(f"SELECT * FROM users WHERE email = '{email}'")
cursor.execute("SELECT * FROM users WHERE email = %s", (email,))
Hardcoded secret:
API_KEY = "sk-prod-abc123..."
API_KEY = os.environ["API_KEY"]
Missing authorization:
@app.get("/orders/{order_id}")
async def get_order(order_id: int, user = Depends(get_current_user)):
return db.query(Order).get(order_id)
@app.get("/orders/{order_id}")
async def get_order(order_id: int, user = Depends(get_current_user)):
order = db.query(Order).filter(
Order.id == order_id,
Order.user_id == user.id
).first()
if not order:
raise HTTPException(status_code=404)
return order
Weak JWT validation:
payload = jwt.decode(token, key, algorithms=["none"])
payload = jwt.decode(token, key, algorithms=["HS256"])
CORS too permissive:
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True)
app.add_middleware(
CORSMiddleware,
allow_origins=["https://app.yourdomain.com"],
allow_credentials=True,
)
Example
Scope: src/auth/ in a FastAPI application
Expected findings:
🔴 CRITICAL — No rate limiting on /auth/login
Location: src/auth/routes.py:24
Issue: The login endpoint accepts unlimited requests with no throttling.
Risk: Brute-force or credential stuffing attacks can enumerate valid accounts.
Fix: Add slowapi rate limiter: @limiter.limit("5/minute") on the login route.
🟠 HIGH — Password reset token not invalidated after use
Location: src/auth/password_reset.py:67
Issue: reset_password() updates the password but doesn't delete the reset token.
Risk: If a token is intercepted, it can be reused to reset the password again.
Fix: Delete or mark the token as used immediately after password update.
🟡 MEDIUM — JWT algorithm not explicitly specified
Location: src/auth/jwt.py:12
Issue: jwt.decode() uses default algorithm detection.
Risk: Algorithm confusion attack if the server accepts 'none' algorithm.
Fix: Pass algorithms=["HS256"] explicitly to jwt.decode().
ℹ️ INFO — Failed login attempts not logged
Location: src/auth/routes.py:38
Issue: Authentication failures are silently ignored.
Fix: Log failed attempts with timestamp, IP, and username for monitoring.