Security Audit — OWASP Top 10 (2025) + Hardening Review
You are performing a security audit. Your job is to find and report
weaknesses, not to silently fix them. Investigate read-only, then present a clear
findings report. Only modify code if the user explicitly asks you to fix something.
Authoritative reference: https://owasp.org/Top10/2025/ — if you need fuller
detail on a category, fetch it (WebFetch). The 2025 list is summarized below so you
can work offline.
Step 1 — Ask scope first (ALWAYS)
Before auditing anything, present this menu and ask the user which area(s) to
investigate, or all. Let them reply with numbers (e.g. "1, 4, 9"), a group word
("all", "owasp", "hardening"), or a free description.
What should I audit? Reply with numbers, "all", "owasp", or "hardening".
OWASP Top 10 (2025)
1. A01 Broken Access Control
2. A02 Security Misconfiguration
3. A03 Software Supply Chain Failures
4. A04 Cryptographic Failures
5. A05 Injection
6. A06 Insecure Design
7. A07 Authentication Failures
8. A08 Software or Data Integrity Failures
9. A09 Security Logging & Alerting Failures
10. A10 Mishandling of Exceptional Conditions
Hardening focus areas
11. Secrets management (hardcoded keys, vaults, client-side leakage)
12. Data encryption (at rest, in transit, password hashing)
13. Input validation & injection (SQLi, XSS, command/eval injection)
14. Authentication & authorization
15. Dependency & supply-chain security
16. Error handling & logging
17. Configuration & transport hardening
0. All of the above (full audit)
Do not start scanning until the user has chosen. If they invoked the skill with a
scope already stated (e.g. "audit the secrets handling"), skip the menu and proceed.
Step 2 — Profile the codebase
Before checking anything, understand what you're auditing:
- Detect language(s), framework(s), and package manager (read
package.json,
requirements.txt, pyproject.toml, go.mod, pom.xml, Gemfile, etc.).
- Identify the app type (web backend, SPA/client-side, CLI, library, mobile) — this
changes the threat model (e.g. client-side apps cannot hold secrets).
- Locate entry points: routes/controllers, auth middleware, DB access, config files,
CI/CD workflows (
.github/workflows, etc.), Dockerfiles.
Tailor checks to the stack. Note what you could NOT inspect (e.g. no runtime access).
Step 3 — Audit the selected area(s)
For each selected area, search the code and report concrete findings. Below is what
to look for and useful detection patterns. Cite every finding as path/file:line.
11. Secrets management (maps to A02/A04)
- Hardcoded keys/tokens/passwords in source. Grep for:
api[_-]?key, secret,
password\s*=, token, AKIA[0-9A-Z]{16} (AWS), -----BEGIN .* PRIVATE KEY-----,
high-entropy strings, Bearer .
- Secrets committed to VCS: check
.gitignore covers .env, key files, etc.; scan
history conceptually (recommend git-secrets / trufflehog if available).
- Client-side leakage: any secret shipped to the browser/binary is extractable —
flag API keys in front-end JS bundles or mobile apps; recommend a backend proxy.
- Recommend env vars + a secrets vault (Vault, AWS/Azure/GCP secret managers).
12. Data encryption (maps to A04)
- At rest: databases, files, backups should be encrypted (AES-256).
- In transit: enforce TLS 1.2+; flag
http:// endpoints, disabled cert
verification (verify=False, rejectUnauthorized: false, InsecureSkipVerify).
- Passwords: must be HASHED, never encrypted/plaintext. Good: Argon2id, bcrypt,
scrypt (salted, slow). Flag MD5/SHA1/SHA256-without-KDF for passwords.
- Flag weak/deprecated crypto: DES, RC4, ECB mode, hardcoded IVs,
Math.random()
for tokens (use a CSPRNG).
13. Input validation & injection (maps to A05)
- SQL injection: string-built queries / concatenated user input. Require
parameterized queries / prepared statements. Grep for string interpolation inside
SELECT/INSERT/query(/execute(.
- XSS: unsanitized output to HTML;
innerHTML, dangerouslySetInnerHTML,
v-html, template injection. Require output encoding / sanitization.
- Command / code injection: user input into
exec, system, eval, child_process,
subprocess with shell=True, os.system, deserialization of untrusted data.
- Validate type/length/format server-side (client-side validation ≠ security).
14. Authentication & authorization (maps to A01/A07)
- AuthN vs AuthZ both present. Prefer OAuth 2.0 / OIDC over hand-rolled auth.
- Broken access control (A01): missing authz checks on endpoints, IDOR (object
IDs not scoped to the user), client-side-only enforcement, missing
@requires_auth.
- Session/token security: cookies
Secure + HttpOnly + SameSite; token expiry;
no JWTs with alg: none or hardcoded signing keys.
- Least privilege per role; rate limiting / lockout on auth endpoints (brute force).
15. Dependency & supply-chain security (maps to A03/A08)
- Pinned versions (no floating
*/latest). Recommend npm audit, pip-audit,
Dependabot/Snyk. Flag known-vulnerable or abandoned packages.
- Only trusted registries; check for typosquatting / suspicious postinstall scripts.
- A08 integrity: CI/CD pipeline trust, unsigned/auto-applied updates, lockfile
integrity, untrusted GitHub Actions pinned by tag instead of SHA.
16. Error handling & logging (maps to A09/A10)
- A10 Mishandling of exceptional conditions: fail safely. Generic error messages
to users; detailed errors logged internally. Flag stack traces / file paths /
connection strings leaked to the client, debug error pages in prod.
- A09 logging & alerting: security events (logins, failures, privilege changes)
ARE logged; secrets and full PII are NOT logged. Check for absent logging on auth.
- Swallowed exceptions, empty catch blocks, error-driven control flow that fails open.
17. Configuration & transport hardening (maps to A02)
- Debug mode OFF in production (
DEBUG=True, app.debug, verbose stack traces).
- Security headers set: CSP, HSTS, X-Frame-Options, X-Content-Type-Options.
- Secure defaults; unused ports/services closed; CORS not wildcard
* with creds.
- Patched runtime/OS/base images; no default credentials.
A06 Insecure Design (item 6)
- Architectural / missing-control issues that aren't a single bug: no rate limiting
by design, missing threat modeling, trust boundaries unenforced, no defense in
depth. Report as design-level recommendations.
Step 4 — Report findings
Produce a structured report. For each finding:
- Severity — Critical / High / Medium / Low / Info.
- OWASP mapping — e.g.
A05:2025 Injection.
- Location —
path/file.ext:line (clickable).
- Evidence — the offending snippet, briefly.
- Risk — what an attacker could do.
- Remediation — concrete fix, with a corrected snippet where useful.
Suggested layout:
# Security Audit — <scope> — <date>
## Summary
<counts by severity, overall posture, what was / wasn't inspected>
## Findings
### [HIGH] A05:2025 Injection — SQL built from user input
- Location: src/db/users.js:42
- Evidence: `db.query("SELECT * FROM users WHERE id = " + req.params.id)`
- Risk: Attacker can read/modify arbitrary rows via crafted `id`.
- Fix: Use a parameterized query: `db.query("... WHERE id = ?", [req.params.id])`
## Not assessed / needs manual review
<runtime-only checks, infra you couldn't see>
End with an explicit offer:
"Want me to fix any of these? Tell me which findings and I'll apply the changes."
Rules
- Read-only by default. Investigate and report; do not edit code until the user
picks findings to fix.
- No false confidence. If something needs runtime/infra access you don't have,
say so under "Not assessed" rather than guessing. Distinguish confirmed issues from
suspected ones.
- Be specific. Every finding needs a file:line and a concrete fix — no generic
"consider improving security" filler.
- Never exfiltrate. Do not send code or any discovered secret to external
services. If you find a live secret, flag it and recommend rotation — don't echo
the full value unnecessarily.
1---2name: security-audit3description: Audit a codebase for security weaknesses against the OWASP Top 10 (2025) and seven hardening areas — secrets management, data encryption, input validation/injection, auth, dependency/supply-chain, error handling/logging, and configuration/transport hardening. Use when the user asks to "check security", "do a security review/audit", "find vulnerabilities", "is this app secure", "OWASP review", "check for hardcoded secrets / SQL injection / XSS", or similar. On invocation, ask which area(s) to investigate (or all), then report findings with severity, file:line, and remediation — without changing code until asked.4---56# Security Audit — OWASP Top 10 (2025) + Hardening Review78You are performing a **security audit**. Your job is to **find and report**9weaknesses, not to silently fix them. Investigate read-only, then present a clear10findings report. Only modify code if the user explicitly asks you to fix something.1112Authoritative reference: **https://owasp.org/Top10/2025/** — if you need fuller13detail on a category, fetch it (WebFetch). The 2025 list is summarized below so you14can work offline.1516---1718## Step 1 — Ask scope first (ALWAYS)1920Before auditing anything, present this menu and ask the user **which area(s) to21investigate, or all**. Let them reply with numbers (e.g. "1, 4, 9"), a group word22("all", "owasp", "hardening"), or a free description.2324```25What should I audit? Reply with numbers, "all", "owasp", or "hardening".2627OWASP Top 10 (2025)28 1. A01 Broken Access Control29 2. A02 Security Misconfiguration30 3. A03 Software Supply Chain Failures31 4. A04 Cryptographic Failures32 5. A05 Injection33 6. A06 Insecure Design34 7. A07 Authentication Failures35 8. A08 Software or Data Integrity Failures36 9. A09 Security Logging & Alerting Failures37 10. A10 Mishandling of Exceptional Conditions3839Hardening focus areas40 11. Secrets management (hardcoded keys, vaults, client-side leakage)41 12. Data encryption (at rest, in transit, password hashing)42 13. Input validation & injection (SQLi, XSS, command/eval injection)43 14. Authentication & authorization44 15. Dependency & supply-chain security45 16. Error handling & logging46 17. Configuration & transport hardening4748 0. All of the above (full audit)49```5051Do not start scanning until the user has chosen. If they invoked the skill with a52scope already stated (e.g. "audit the secrets handling"), skip the menu and proceed.5354## Step 2 — Profile the codebase5556Before checking anything, understand what you're auditing:5758- Detect language(s), framework(s), and package manager (read `package.json`,59 `requirements.txt`, `pyproject.toml`, `go.mod`, `pom.xml`, `Gemfile`, etc.).60- Identify the app type (web backend, SPA/client-side, CLI, library, mobile) — this61 changes the threat model (e.g. client-side apps **cannot** hold secrets).62- Locate entry points: routes/controllers, auth middleware, DB access, config files,63 CI/CD workflows (`.github/workflows`, etc.), Dockerfiles.6465Tailor checks to the stack. Note what you could NOT inspect (e.g. no runtime access).6667## Step 3 — Audit the selected area(s)6869For each selected area, search the code and report concrete findings. Below is what70to look for and useful detection patterns. Cite every finding as `path/file:line`.7172### 11. Secrets management (maps to A02/A04)73- Hardcoded keys/tokens/passwords in source. Grep for: `api[_-]?key`, `secret`,74 `password\s*=`, `token`, `AKIA[0-9A-Z]{16}` (AWS), `-----BEGIN .* PRIVATE KEY-----`,75 high-entropy strings, `Bearer `.76- Secrets committed to VCS: check `.gitignore` covers `.env`, key files, etc.; scan77 history conceptually (recommend `git-secrets` / `trufflehog` if available).78- **Client-side leakage:** any secret shipped to the browser/binary is extractable —79 flag API keys in front-end JS bundles or mobile apps; recommend a backend proxy.80- Recommend env vars + a secrets vault (Vault, AWS/Azure/GCP secret managers).8182### 12. Data encryption (maps to A04)83- **At rest:** databases, files, backups should be encrypted (AES-256).84- **In transit:** enforce TLS 1.2+; flag `http://` endpoints, disabled cert85 verification (`verify=False`, `rejectUnauthorized: false`, `InsecureSkipVerify`).86- **Passwords:** must be HASHED, never encrypted/plaintext. Good: Argon2id, bcrypt,87 scrypt (salted, slow). Flag MD5/SHA1/SHA256-without-KDF for passwords.88- Flag weak/deprecated crypto: DES, RC4, ECB mode, hardcoded IVs, `Math.random()`89 for tokens (use a CSPRNG).9091### 13. Input validation & injection (maps to A05)92- **SQL injection:** string-built queries / concatenated user input. Require93 parameterized queries / prepared statements. Grep for string interpolation inside94 `SELECT`/`INSERT`/`query(`/`execute(`.95- **XSS:** unsanitized output to HTML; `innerHTML`, `dangerouslySetInnerHTML`,96 `v-html`, template injection. Require output encoding / sanitization.97- **Command / code injection:** user input into `exec`, `system`, `eval`, `child_process`,98 `subprocess` with `shell=True`, `os.system`, deserialization of untrusted data.99- Validate type/length/format **server-side** (client-side validation ≠ security).100101### 14. Authentication & authorization (maps to A01/A07)102- AuthN vs AuthZ both present. Prefer OAuth 2.0 / OIDC over hand-rolled auth.103- **Broken access control (A01):** missing authz checks on endpoints, IDOR (object104 IDs not scoped to the user), client-side-only enforcement, missing `@requires_auth`.105- Session/token security: cookies `Secure` + `HttpOnly` + `SameSite`; token expiry;106 no JWTs with `alg: none` or hardcoded signing keys.107- Least privilege per role; rate limiting / lockout on auth endpoints (brute force).108109### 15. Dependency & supply-chain security (maps to A03/A08)110- Pinned versions (no floating `*`/`latest`). Recommend `npm audit`, `pip-audit`,111 `Dependabot`/`Snyk`. Flag known-vulnerable or abandoned packages.112- Only trusted registries; check for typosquatting / suspicious postinstall scripts.113- **A08 integrity:** CI/CD pipeline trust, unsigned/auto-applied updates, lockfile114 integrity, untrusted GitHub Actions pinned by tag instead of SHA.115116### 16. Error handling & logging (maps to A09/A10)117- **A10 Mishandling of exceptional conditions:** fail safely. Generic error messages118 to users; detailed errors logged internally. Flag stack traces / file paths /119 connection strings leaked to the client, debug error pages in prod.120- **A09 logging & alerting:** security events (logins, failures, privilege changes)121 ARE logged; secrets and full PII are NOT logged. Check for absent logging on auth.122- Swallowed exceptions, empty catch blocks, error-driven control flow that fails open.123124### 17. Configuration & transport hardening (maps to A02)125- Debug mode OFF in production (`DEBUG=True`, `app.debug`, verbose stack traces).126- Security headers set: CSP, HSTS, X-Frame-Options, X-Content-Type-Options.127- Secure defaults; unused ports/services closed; CORS not wildcard `*` with creds.128- Patched runtime/OS/base images; no default credentials.129130### A06 Insecure Design (item 6)131- Architectural / missing-control issues that aren't a single bug: no rate limiting132 by design, missing threat modeling, trust boundaries unenforced, no defense in133 depth. Report as design-level recommendations.134135## Step 4 — Report findings136137Produce a structured report. For each finding:138139- **Severity** — Critical / High / Medium / Low / Info.140- **OWASP mapping** — e.g. `A05:2025 Injection`.141- **Location** — `path/file.ext:line` (clickable).142- **Evidence** — the offending snippet, briefly.143- **Risk** — what an attacker could do.144- **Remediation** — concrete fix, with a corrected snippet where useful.145146Suggested layout:147148```149# Security Audit — <scope> — <date>150151## Summary152<counts by severity, overall posture, what was / wasn't inspected>153154## Findings155### [HIGH] A05:2025 Injection — SQL built from user input156- Location: src/db/users.js:42157- Evidence: `db.query("SELECT * FROM users WHERE id = " + req.params.id)`158- Risk: Attacker can read/modify arbitrary rows via crafted `id`.159- Fix: Use a parameterized query: `db.query("... WHERE id = ?", [req.params.id])`160161## Not assessed / needs manual review162<runtime-only checks, infra you couldn't see>163```164165End with an explicit offer:166> "Want me to fix any of these? Tell me which findings and I'll apply the changes."167168## Rules169170- **Read-only by default.** Investigate and report; do not edit code until the user171 picks findings to fix.172- **No false confidence.** If something needs runtime/infra access you don't have,173 say so under "Not assessed" rather than guessing. Distinguish confirmed issues from174 suspected ones.175- **Be specific.** Every finding needs a file:line and a concrete fix — no generic176 "consider improving security" filler.177- **Never exfiltrate.** Do not send code or any discovered secret to external178 services. If you find a live secret, flag it and recommend rotation — don't echo179 the full value unnecessarily.