OWASP Audit — Source Code Security Review
Perform a systematic security audit of application source code against the OWASP Top 10 (2021).
Scope the Audit
- Identify the project's language, framework, and architecture
- Map entry points (routes, API handlers, form processors)
- Identify data flows (user input → processing → storage → output)
- Locate authentication and authorization boundaries
Audit Checklist
Work through each category systematically. For each, grep for known vulnerability patterns, then read flagged files for deeper analysis.
A01: Broken Access Control
- Missing authorization checks on endpoints or routes
- IDOR — user-controlled IDs without ownership verification
- Missing CSRF protections on state-changing requests
- Role checks only on the frontend, not enforced server-side
- Grep for: direct object references, missing auth middleware, user ID from request params
A02: Cryptographic Failures
- Hardcoded secrets, API keys, or passwords in source
- Weak hashing (MD5, SHA1 for passwords instead of bcrypt/argon2/scrypt)
- Sensitive data in logs, URLs, or localStorage
- Missing encryption at rest or in transit
- Grep for:
password, secret, api_key, private_key, MD5, SHA1, base64
A03: Injection
- SQL injection: raw queries with string concatenation, missing parameterized queries
- NoSQL injection: unsanitized user input in MongoDB/Convex queries
- Command injection:
exec(), spawn(), system() with user input
- XSS: unescaped user input in HTML,
dangerouslySetInnerHTML, v-html
- Template injection: user input in template literals
- Grep for:
exec(, eval(, innerHTML, dangerouslySetInnerHTML, $where, raw SQL strings
A04: Insecure Design
- Authentication flows with logic flaws
- Missing rate limiting on sensitive endpoints (login, password reset, API)
- Business logic constraints only enforced client-side
A05: Security Misconfiguration
- Debug mode enabled in production configs
- Overly permissive CORS policies (
Access-Control-Allow-Origin: *)
- Missing HTTP security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
- Default credentials or configurations shipped
- Verbose error messages exposing stack traces or internals
A06: Vulnerable Components
- Run
npm audit (Node), pip audit (Python), or equivalent
- Check lock files for known vulnerable dependency versions
- Flag dependencies with critical CVEs
A07: Authentication Failures
- Weak password policies
- Session management issues (missing secure/httpOnly flags, no expiry, no rotation)
- Missing rate limiting on login (credential stuffing risk)
- Broken password reset flows
A08: Data Integrity Failures
- Unsafe deserialization of user input
- Missing integrity checks on CI/CD pipelines
- No lockfile integrity verification (SRI hashes)
A09: Logging & Monitoring Failures
- Auth events not logged (login, failure, privilege changes)
- Sensitive data written to logs (passwords, tokens, PII)
- No alerting on suspicious patterns
A10: SSRF
- User-controlled URLs passed to server-side HTTP requests
- Missing URL validation and allowlisting
- Grep for:
fetch(, axios(, http.get(, urllib, requests.get( with user input
Report Format
For each finding, document:
#### [SEVERITY] A0X: [Title]
**File:** `path/to/file.ts:42`
**CWE:** CWE-XXX
**Description:** [What the vulnerability is and why it matters]
**Vulnerable Code:**
[code snippet]
**Remediation:**
[Fixed code snippet with explanation]
Produce an executive summary:
# Security Audit Report
## Project: [name]
## Stack: [technologies]
## Date: [date]
### Summary
- Total findings: X
- Critical: X | High: X | Medium: X | Low: X | Info: X
### Findings
[Individual findings as above]
### Prioritized Remediation Plan
1. [Critical fixes — immediate]
2. [High fixes — this week]
3. [Medium/Low — scheduled]
Boundaries
- Only audit code the user provides or points you to
- Provide fixes, not exploits — always include remediation
- Flag low-confidence findings as "Potential" rather than confirmed
- If the codebase is too large for a full audit, prioritize: auth, input handling, data access layers
- Refuse requests to insert backdoors or weaken security controls
References
- OWASP Top 10 (2021)
- OWASP Code Review Guide
- CWE Top 25
1---2name: owasp-audit3description: Audit application source code against the OWASP Top 10 vulnerability categories. Use when the user mentions 'OWASP,' 'security audit,' 'code security review,' 'vulnerability audit,' 'find vulnerabilities,' 'secure code review,' 'security review,' or wants to check their codebase for common security weaknesses.4---56# OWASP Audit — Source Code Security Review78Perform a systematic security audit of application source code against the OWASP Top 10 (2021).910## Scope the Audit11121. Identify the project's language, framework, and architecture132. Map entry points (routes, API handlers, form processors)143. Identify data flows (user input → processing → storage → output)154. Locate authentication and authorization boundaries1617## Audit Checklist1819Work through each category systematically. For each, grep for known vulnerability patterns, then read flagged files for deeper analysis.2021### A01: Broken Access Control22- Missing authorization checks on endpoints or routes23- IDOR — user-controlled IDs without ownership verification24- Missing CSRF protections on state-changing requests25- Role checks only on the frontend, not enforced server-side26- Grep for: direct object references, missing auth middleware, user ID from request params2728### A02: Cryptographic Failures29- Hardcoded secrets, API keys, or passwords in source30- Weak hashing (MD5, SHA1 for passwords instead of bcrypt/argon2/scrypt)31- Sensitive data in logs, URLs, or localStorage32- Missing encryption at rest or in transit33- Grep for: `password`, `secret`, `api_key`, `private_key`, `MD5`, `SHA1`, `base64`3435### A03: Injection36- **SQL injection:** raw queries with string concatenation, missing parameterized queries37- **NoSQL injection:** unsanitized user input in MongoDB/Convex queries38- **Command injection:** `exec()`, `spawn()`, `system()` with user input39- **XSS:** unescaped user input in HTML, `dangerouslySetInnerHTML`, `v-html`40- **Template injection:** user input in template literals41- Grep for: `exec(`, `eval(`, `innerHTML`, `dangerouslySetInnerHTML`, `$where`, raw SQL strings4243### A04: Insecure Design44- Authentication flows with logic flaws45- Missing rate limiting on sensitive endpoints (login, password reset, API)46- Business logic constraints only enforced client-side4748### A05: Security Misconfiguration49- Debug mode enabled in production configs50- Overly permissive CORS policies (`Access-Control-Allow-Origin: *`)51- Missing HTTP security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)52- Default credentials or configurations shipped53- Verbose error messages exposing stack traces or internals5455### A06: Vulnerable Components56- Run `npm audit` (Node), `pip audit` (Python), or equivalent57- Check lock files for known vulnerable dependency versions58- Flag dependencies with critical CVEs5960### A07: Authentication Failures61- Weak password policies62- Session management issues (missing secure/httpOnly flags, no expiry, no rotation)63- Missing rate limiting on login (credential stuffing risk)64- Broken password reset flows6566### A08: Data Integrity Failures67- Unsafe deserialization of user input68- Missing integrity checks on CI/CD pipelines69- No lockfile integrity verification (SRI hashes)7071### A09: Logging & Monitoring Failures72- Auth events not logged (login, failure, privilege changes)73- Sensitive data written to logs (passwords, tokens, PII)74- No alerting on suspicious patterns7576### A10: SSRF77- User-controlled URLs passed to server-side HTTP requests78- Missing URL validation and allowlisting79- Grep for: `fetch(`, `axios(`, `http.get(`, `urllib`, `requests.get(` with user input8081## Report Format8283For each finding, document:8485```markdown86#### [SEVERITY] A0X: [Title]87**File:** `path/to/file.ts:42`88**CWE:** CWE-XXX8990**Description:** [What the vulnerability is and why it matters]9192**Vulnerable Code:**93[code snippet]9495**Remediation:**96[Fixed code snippet with explanation]97```9899Produce an executive summary:100101```markdown102# Security Audit Report103## Project: [name]104## Stack: [technologies]105## Date: [date]106107### Summary108- Total findings: X109- Critical: X | High: X | Medium: X | Low: X | Info: X110111### Findings112[Individual findings as above]113114### Prioritized Remediation Plan1151. [Critical fixes — immediate]1162. [High fixes — this week]1173. [Medium/Low — scheduled]118```119120## Boundaries121122- Only audit code the user provides or points you to123- Provide fixes, not exploits — always include remediation124- Flag low-confidence findings as "Potential" rather than confirmed125- If the codebase is too large for a full audit, prioritize: auth, input handling, data access layers126- Refuse requests to insert backdoors or weaken security controls127128## References129130- OWASP Top 10 (2021)131- OWASP Code Review Guide132- CWE Top 25