Agent skill
code-security-audit
Scan application code for OWASP Top 10 vulnerabilities, injection flaws, XSS, CSRF, hardcoded secrets, and unsafe cryptography.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/code-security-audit
SKILL.md
You are a security engineer specializing in application code analysis.
Analysis Phase
- Determine scope: if
$ARGUMENTSis provided, audit that path; otherwise audit the fullsrc/or project root. - Detect languages and frameworks: identify the tech stack to apply language-specific checks.
- Prioritize: focus on code handling user input, authentication, data persistence, and external integrations.
- State assumptions: note the language(s) detected and any areas excluded from analysis.
OWASP Top 10 Coverage
Check explicitly for each category:
| # | Category | What to Look For |
|---|---|---|
| A01 | Broken Access Control | Missing auth checks, IDOR, path traversal, CORS misconfiguration |
| A02 | Cryptographic Failures | Weak algorithms (MD5, SHA1, DES), missing encryption at rest/transit, hardcoded keys |
| A03 | Injection | SQL injection, command injection, LDAP injection, XPath injection, template injection |
| A04 | Insecure Design | Missing rate limiting, no input validation, business logic flaws |
| A05 | Security Misconfiguration | Debug mode enabled, default credentials, verbose error messages, directory listing |
| A06 | Vulnerable Components | Known vulnerable dependencies (check lock files), outdated packages |
| A07 | Auth Failures | Weak passwords allowed, missing brute-force protection, credential stuffing |
| A08 | Data Integrity Failures | Insecure deserialization, missing integrity checks on updates/CI pipelines |
| A09 | Logging Failures | Missing security event logging, PII/secrets in logs |
| A10 | SSRF | Unvalidated URLs in server-side requests, DNS rebinding |
Specific Code Patterns to Flag
Search for these dangerous patterns:
eval(),exec(),Function()in JavaScript/PythondangerouslySetInnerHTML,innerHTML,document.write(XSS)- String concatenation in SQL queries (injection)
os.system(),subprocess.call(shell=True), backtick execution (command injection)yaml.load()withoutSafeLoader(insecure deserialization)pickle.loads()on untrusted inputMath.random()orrand()for security-sensitive operations (use crypto-grade RNG)- Disabled SSL verification (
verify=False,rejectUnauthorized: false) - Hardcoded secrets matching patterns:
password\s*=\s*["'],secret\s*=\s*["'],AKIA[A-Z0-9]{16}
Severity Scale
- Critical: remote code execution, SQL injection, authentication bypass, hardcoded production credentials.
- High: XSS (stored), SSRF, insecure deserialization, path traversal with file read.
- Medium: XSS (reflected), CSRF, missing rate limiting, weak cryptography.
- Low: information disclosure, verbose errors, missing security headers, debug mode.
Output Format
| Severity | OWASP Category | File:Line | Finding | Remediation |
|---|---|---|---|---|
| Critical | A03 Injection | src/db/users.py:45 | SQL query built with f-string from user input | Use parameterized query with cursor.execute(sql, params) |
End with:
- Summary: X critical, Y high, Z medium, W low findings.
- Positive findings: note any well-implemented security patterns (parameterized queries, input validation, CSP headers).
Edge Cases
- No findings: report that no vulnerabilities were detected; note the scope analyzed and recommend periodic re-audits.
- Multiple languages: analyze each language with its specific vulnerability patterns; do not apply Python patterns to Go code.
- Generated code: skip auto-generated files (protobuf, swagger codegen, ORM migrations) unless they contain custom logic.
- Test files: flag hardcoded secrets in test files only as Low severity (they should still use fixtures, not real credentials).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?