Security Audit Methodology
Audit Phases
Every audit follows this sequence. Don't skip phases — each informs the next.
1. Reconnaissance
Map the attack surface before testing anything.
- Inventory endpoints: every route, API path, WebSocket, webhook
- Identify trust boundaries: where does user input enter? Where does data cross services?
- Map authentication flows: login, registration, password reset, token refresh, MFA
- Catalog data stores: what's stored where, what's sensitive, what's encrypted
- Review dependencies: check
package-lock.json, Gemfile.lock, requirements.txt against known CVEs
Output: attack surface map — a list of entry points ranked by exposure.
2. Threat Modeling
For each trust boundary, ask: "What could an attacker do here?"
STRIDE per boundary:
| Threat |
Question |
| Spoofing |
Can someone pretend to be another user/service? |
| Tampering |
Can data be modified in transit or at rest? |
| Repudiation |
Can actions be performed without audit trail? |
| Information Disclosure |
Can sensitive data leak through errors, logs, or side channels? |
| Denial of Service |
Can this endpoint be abused to exhaust resources? |
| Elevation of Privilege |
Can a normal user reach admin functionality? |
Prioritize by: exploitability (how easy) x impact (how bad).
3. Testing
Test each threat systematically. Order matters — start with auth, then access control, then input handling.
Auth testing sequence:
- Can I access protected routes without a token?
- Can I use an expired/revoked token?
- Can I escalate from user to admin?
- Can I enumerate valid usernames?
- Is there rate limiting on login?
Input handling sequence:
- Test every user input for injection (SQL, command, template, LDAP)
- Test file uploads for type bypass, path traversal, oversized files
- Test redirects for open redirect / SSRF
- Test serialization endpoints for insecure deserialization
Data exposure sequence:
- Check error messages for stack traces, internal paths, DB details
- Check logs for PII, tokens, passwords
- Check API responses for over-fetching (fields the client doesn't need)
- Check headers for version disclosure
4. Evidence Collection
For every finding, capture:
- Reproduction steps: exact request/response (curl, screenshot, or code)
- Impact statement: what an attacker gains (not just "XSS exists" but "attacker can steal session tokens via reflected XSS on /search")
- Affected scope: how many endpoints/users/data are at risk
5. Risk Rating
Use a consistent severity scale:
| Severity |
Criteria |
| Critical |
Remote code execution, auth bypass, mass data exposure |
| High |
Privilege escalation, stored XSS, SQL injection with limited scope |
| Medium |
CSRF on sensitive actions, information disclosure, missing rate limiting |
| Low |
Clickjacking, verbose errors, missing security headers |
| Info |
Best practice deviations, no direct exploit path |
6. Reporting
Structure findings for action, not just documentation:
## [SEVERITY] Finding Title
**Location**: endpoint/file:line
**Category**: OWASP category
**Evidence**: reproduction steps
**Impact**: what an attacker gains
**Remediation**: specific fix (not just "sanitize input" — show how)
**Verification**: how to confirm the fix works
App-Type Quick Reference
Web Application
Focus areas: auth flows, session management, CSP, CORS, cookie flags, XSS, CSRF
REST API
Focus areas: BOLA (broken object-level auth), mass assignment, rate limiting, input validation on all fields, JWT handling
CLI Tool
Focus areas: command injection via arguments, environment variable trust, file path traversal, privilege of executed commands
Library/Package
Focus areas: dependency chain, input validation at public API boundary, no secrets in source, safe defaults
Common Audit Anti-Patterns
What auditors miss:
- Testing only the happy path: auth bypass often lives in edge cases (password reset, OAuth callback, token refresh)
- Ignoring business logic: technical vulnerabilities get attention, but "can a user buy something for $0?" is often worse
- Skipping second-order effects: input stored now, rendered later (stored XSS), or data crossing service boundaries unsanitized
- Over-relying on automated scanners: scanners find low-hanging fruit. Manual testing finds the real problems.
- Not testing as different roles: test every endpoint as unauthenticated, regular user, and admin
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: hakal-team-skills-security-audit-methodology3description: Security Audit Methodology4---56# Security Audit Methodology78## Audit Phases910Every audit follows this sequence. Don't skip phases — each informs the next.1112### 1. Reconnaissance1314Map the attack surface before testing anything.1516- **Inventory endpoints**: every route, API path, WebSocket, webhook17- **Identify trust boundaries**: where does user input enter? Where does data cross services?18- **Map authentication flows**: login, registration, password reset, token refresh, MFA19- **Catalog data stores**: what's stored where, what's sensitive, what's encrypted20- **Review dependencies**: check `package-lock.json`, `Gemfile.lock`, `requirements.txt` against known CVEs2122Output: attack surface map — a list of entry points ranked by exposure.2324### 2. Threat Modeling2526For each trust boundary, ask: "What could an attacker do here?"2728**STRIDE per boundary:**2930| Threat | Question |31|--------|----------|32| **S**poofing | Can someone pretend to be another user/service? |33| **T**ampering | Can data be modified in transit or at rest? |34| **R**epudiation | Can actions be performed without audit trail? |35| **I**nformation Disclosure | Can sensitive data leak through errors, logs, or side channels? |36| **D**enial of Service | Can this endpoint be abused to exhaust resources? |37| **E**levation of Privilege | Can a normal user reach admin functionality? |3839Prioritize by: exploitability (how easy) x impact (how bad).4041### 3. Testing4243Test each threat systematically. Order matters — start with auth, then access control, then input handling.4445**Auth testing sequence:**461. Can I access protected routes without a token?472. Can I use an expired/revoked token?483. Can I escalate from user to admin?494. Can I enumerate valid usernames?505. Is there rate limiting on login?5152**Input handling sequence:**531. Test every user input for injection (SQL, command, template, LDAP)542. Test file uploads for type bypass, path traversal, oversized files553. Test redirects for open redirect / SSRF564. Test serialization endpoints for insecure deserialization5758**Data exposure sequence:**591. Check error messages for stack traces, internal paths, DB details602. Check logs for PII, tokens, passwords613. Check API responses for over-fetching (fields the client doesn't need)624. Check headers for version disclosure6364### 4. Evidence Collection6566For every finding, capture:67- **Reproduction steps**: exact request/response (curl, screenshot, or code)68- **Impact statement**: what an attacker gains (not just "XSS exists" but "attacker can steal session tokens via reflected XSS on /search")69- **Affected scope**: how many endpoints/users/data are at risk7071### 5. Risk Rating7273Use a consistent severity scale:7475| Severity | Criteria |76|----------|----------|77| **Critical** | Remote code execution, auth bypass, mass data exposure |78| **High** | Privilege escalation, stored XSS, SQL injection with limited scope |79| **Medium** | CSRF on sensitive actions, information disclosure, missing rate limiting |80| **Low** | Clickjacking, verbose errors, missing security headers |81| **Info** | Best practice deviations, no direct exploit path |8283### 6. Reporting8485Structure findings for action, not just documentation:8687```88## [SEVERITY] Finding Title8990**Location**: endpoint/file:line91**Category**: OWASP category92**Evidence**: reproduction steps93**Impact**: what an attacker gains94**Remediation**: specific fix (not just "sanitize input" — show how)95**Verification**: how to confirm the fix works96```9798## App-Type Quick Reference99100### Web Application101Focus areas: auth flows, session management, CSP, CORS, cookie flags, XSS, CSRF102103### REST API104Focus areas: BOLA (broken object-level auth), mass assignment, rate limiting, input validation on all fields, JWT handling105106### CLI Tool107Focus areas: command injection via arguments, environment variable trust, file path traversal, privilege of executed commands108109### Library/Package110Focus areas: dependency chain, input validation at public API boundary, no secrets in source, safe defaults111112## Common Audit Anti-Patterns113114What auditors miss:115116- **Testing only the happy path**: auth bypass often lives in edge cases (password reset, OAuth callback, token refresh)117- **Ignoring business logic**: technical vulnerabilities get attention, but "can a user buy something for $0?" is often worse118- **Skipping second-order effects**: input stored now, rendered later (stored XSS), or data crossing service boundaries unsanitized119- **Over-relying on automated scanners**: scanners find low-hanging fruit. Manual testing finds the real problems.120- **Not testing as different roles**: test every endpoint as unauthenticated, regular user, and admin121122---123> Converted and distributed by [TomeVault](https://tomevault.io/claim/hakal) — claim your Tome and manage your conversions.124<!-- tomevault:4.0:skill_md:2026-04-13 -->