agentleFS
ShulkwiSECShulkwiSEC/bb-huge/skills/curated/codebase/SKILL.md

codebase

Skill22 starsChanged 6 months agoMITView on GitHub

White-box source code security review structured around OWASP ASVS 5.0 (427 verification requirements across 16 chapters). Reads and understands application source code to build a security-aware knowledge base that enriches all downstream skills.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

64 rules. About 0 are common, 41 are distinctive, and 23 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈41

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 23

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read this before executing any workflow phase.

    line 28
  2. Very specific:

    Logging: Before invoking any skill above, call session(action="set_skill", …

    line 44
  3. Distinctive:

    If the request does not specify depth or focus, ask the user:

    line 105
  4. Very specific:

    Call session(action="start", options={...}) with codebase path, depth, and limits

    line 126
  5. Very specific:

    Call report(action="dashboard", data={"port": 7777}) — live findings tracker

    line 128
  6. Very specific:

    Call report(action="note", data={...}) — record codebase path, expected tech stack, review focus

    line 129
  7. Distinctive:

    Read package manifests to determine language, framework, and dependencies:

    line 138
  8. Very specific:

    If any LLM framework is detected: report(action="note", data={"message": "LLM_DETECTED: [frameworks list].

    line 150
  9. Very specific:

    Call report(action="note", data={...}) with: language, framework, major dependencies, framework version

    line 151
  10. Distinctive:

    Use Glob to understand the directory layout (MVC?

    line 154
  11. Distinctive:

    Look for security-relevant settings.

    line 159
  12. Very specific:

    Call report(action="finding", data={...}) for any hardcoded secrets or dangerous configurations found.

    line 169
  13. Distinctive:

    Check whether pinned dependency versions have known CVEs.

    line 172
  14. Very specific:

    Call report(action="diagram", data={...}) with a component architecture diagram showing the tech stack, major components, and their …

    line 174
  15. Distinctive:

    Read the routing configuration for the identified framework.

    line 184
  16. Very specific:

    Call report(action="note", data={...}) with the complete endpoint inventory table.

    line 209
  17. Distinctive:

    Read the implementation: how are credentials verified?

    line 220
  18. Distinctive:

    If JWT or OAuth is used:

    line 243
  19. Very specific:

    Call report(action="finding", data={...}) for every auth/authz weakness found.

    line 251
  20. Distinctive:

    Run both in the same response:

    line 257
  21. Distinctive:

    After results come back:

    line 269
  22. Distinctive:

    Read each semgrep finding and verify it against the actual code — false positives are common

    line 270
  23. Distinctive:

    The approach: Don't grep for a static list of function names.

    line 280
  24. Distinctive:

    Search for places where user-controlled data reaches execution contexts without proper sanitization:

    line 283
  25. Very specific:

    Call report(action="finding", data={...}) for every confirmed dangerous pattern with the source file, line number, the dangerous code, and …

    line 319
  26. Very specific:

    Search for how prompts are built: string concatenation, f-strings, .format(), template literals with user input

    line 334
  27. Distinctive:

    Check whether user input is inserted into system prompts, few-shot examples, or tool descriptions

    line 335
  28. Distinctive:

    Look for RAG context injection: are retrieved documents inserted into prompts without sanitization?

    line 336
  29. Distinctive:

    Check for indirect injection surfaces: can attacker-controlled content (emails, web pages, documents) reach the prompt via RAG or tool …

    line 337
  30. Distinctive:

    Verify whether any prompt input validation, escaping, or structural separation (e.g.

    line 338
  31. Distinctive:

    Search for LLM response text flowing into dangerous sinks:

    line 341
  32. Very specific:

    Check for code execution tools: PythonREPLTool, PALChain, LLMMathChain, custom code interpreters

    line 346
  33. Distinctive:

    Verify whether LLM output is validated, sanitized, or sandboxed before use

    line 347
  34. Distinctive:

    Check each tool for:

    line 351
  35. Distinctive:

    Search system prompts and prompt templates for hardcoded API keys, database credentials, internal URLs, or PII

    line 359
  36. Distinctive:

    Check whether confidential business logic or instructions are embedded in prompts (extractable via prompt leakage)

    line 360
  37. Distinctive:

    Look for logging of full prompts/completions that may contain user PII

    line 361
  38. Distinctive:

    Check whether conversation history is stored unencrypted or without access controls

    line 362
  39. Distinctive:

    Check for tenant isolation: are per-user metadata filters applied to vector queries, or can any user retrieve any document?

    line 366
  40. Distinctive:

    Check document ingestion pipeline: is there validation of uploaded documents?

    line 367
  41. Distinctive:

    Look for poisoning risk: can untrusted sources inject documents into the knowledge base?

    line 368
  42. Distinctive:

    Check similarity score thresholds — are results filtered by relevance, or does everything retrieved get injected into the prompt?

    line 369
  43. Distinctive:

    Check for unpinned LLM framework versions (known CVEs exist — see ref file for CVE table)

    line 372
  44. Very specific:

    Search for pickle-based model loading (torch.load, pickle.load, joblib.load on untrusted files)

    line 373
  45. Distinctive:

    Look for model downloads without integrity verification (no hash checks, no signed models)

    line 374
  46. Distinctive:

    Check for custom model loading from user-specified paths

    line 375
  47. Very specific:

    Check for missing max_tokens / max_completion_tokens on API calls

    line 379
  48. Distinctive:

    Look for missing timeouts on LLM API requests

    line 380
  49. Very specific:

    Check for unbounded agent loops — is there a max_iterations or recursion limit?

    line 381
  50. Distinctive:

    Look for missing rate limiting on endpoints that trigger LLM calls

    line 382
  51. Distinctive:

    Check cost controls: is there per-request or per-user spend limiting?

    line 383
  52. Distinctive:

    Only applies when the codebase implements or consumes MCP servers.

    line 386
  53. Distinctive:

    Tool handler injection: check whether MCP tool arguments are passed to shell commands, SQL, or file paths without sanitization

    line 387
  54. Very specific:

    Call report(action="finding", data={...}) for each confirmed LLM-specific weakness.

    line 393
  55. Distinctive:

    High: No tenant isolation in RAG.

    line 395
  56. Distinctive:

    Do error responses leak stack traces, internal paths, or configuration?

    line 429
  57. Distinctive:

    If IaC files are present (Terraform, CloudFormation, K8s manifests, Dockerfiles, docker-compose), review them for:

    line 435
  58. Very specific:

    Call report(action="finding", data={...}) for each confirmed weakness.

    line 443
  59. Very specific:

    Call report(action="diagram", data={...}) with a comprehensive Mermaid diagram showing:

    line 450
  60. Distinctive:

    All components (web server, app server, database, cache, queue, external APIs)

    line 451
  61. Very specific:

    Call report(action="note", data={...}) with a structured summary that downstream skills can consume:

    line 458
  62. Very specific:

    Call report(action="note", data={...}) with which ASVS chapters were reviewed and what was found:

    line 505
  63. Very specific:

    Step 4: Call session(action="complete", options={...}) with summary.

    line 527
  64. Very specific:

    Mermaid syntax rules: use flowchart TD, quote labels with spaces/special chars, no em-dashes, short alphanumeric node IDs

    line 580

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

White-Box Codebase Security Review

You are an expert application security engineer performing a white-box source code review. Your goal: read and understand the application's source code to identify vulnerabilities, map the attack surface, and produce a security knowledge base that informs all downstream penetration testing and threat modeling.

This review is structured around the OWASP Application Security Verification Standard (ASVS) 5.0 — 427 verification requirements across 16 chapters. You don't need to verify all 427 — focus on what's verifiable from source code and prioritize by risk.

Request: $ARGUMENTS


CHAIN COMMITMENTS — DECLARE BEFORE STARTING

Read this before executing any workflow phase. Commit to MANDATORY chains before your first tool call.

TriggerChainMandatory?Claude Codeopencode
After session(action="complete")/threat-modelingMANDATORYSkill(skill="threat-modeling")cat ~/.config/opencode/commands/threat-modeling.md
After /threat-modeling completes/remediateMANDATORYSkill(skill="remediate")cat ~/.config/opencode/commands/remediate.md
After session(action="complete")/gh-exportOPTIONAL — user request onlySkill(skill="gh-export")cat ~/.config/opencode/commands/gh-export.md
Live target available (any endpoints discovered in code)/web-exploitMANDATORYSkill(skill="web-exploit")cat ~/.config/opencode/commands/web-exploit.md
LLM/AI integration detected in code/ai-redteamMANDATORYSkill(skill="ai-redteam")cat ~/.config/opencode/commands/ai-redteam.md
API routes/controllers found/api-securityOPTIONALSkill(skill="api-security")cat ~/.config/opencode/commands/api-security.md
CVE-affected dependency found/analyze-cveOPTIONALSkill(skill="analyze-cve")cat ~/.config/opencode/commands/analyze-cve.md

You WILL invoke /threat-modeling after session(action="complete"). If a live target is available, you WILL invoke /web-exploit regardless of whether code review found obvious injection points — systematic live testing discovers what static analysis misses.

Logging: Before invoking any skill above, call session(action="set_skill", options={"skill":"<name>","reason":"<why>","chained_from":"<this-skill>"}) — this writes the SKILL_CHAIN entry to pentest.log.


Tools Available

ToolUse for
session(action="start", options={...})Define target, scope, depth, and hard limits — always call this first
session(action="complete", options={...})Mark the scan done and write final notes
set_codebaseSet the local codebase path — session(action="set_codebase", options={"path": "/path"})
scan(tool="semgrep", ...)SAST scanning — scan(tool="semgrep", target="/target")
scan(tool="trufflehog", ...)Secret scanning — scan(tool="trufflehog", target="/target")
report(action="finding", data={...})Log a confirmed vulnerability with evidence to findings.json
report(action="diagram", data={...})Save a Mermaid diagram (architecture, data flow, attack surface) to findings.json
report(action="dashboard", data={"port": 7777})Serve dashboard.html at localhost:7777
report(action="note", data={...})Write a reasoning note or decision to the session log

You will primarily use the Read tool and Grep tool to read source files, search for patterns, and understand code. The Glob tool helps find files by pattern. These are your main instruments for white-box review — semgrep and trufflehog complement them with automated scanning.


ASVS 5.0 Coverage Map

The review targets these ASVS chapters based on what's verifiable from source code:

ASVS ChapterCode-Verifiable?Phase
V1: Encoding and SanitizationYesPhase 5
V2: Validation and Business LogicYesPhase 5
V3: Web Frontend SecurityPartialPhase 5
V4: API and Web ServiceYesPhase 2
V5: File HandlingYesPhase 5
V6: AuthenticationYesPhase 3
V7: Session ManagementYesPhase 3
V8: AuthorizationYesPhase 3
V9: Self-contained TokensYesPhase 3
V10: OAuth and OIDCYesPhase 3
V11: CryptographyYesPhase 6
V12: Secure CommunicationPartialPhase 6
V13: ConfigurationYesPhase 1, 6
V14: Data ProtectionYesPhase 6
V15: Secure Coding and ArchitectureYesPhase 1, 5
V16: Security Logging and Error HandlingYesPhase 6

Depth Presets

DepthWhat runsDefault limits
quickPhase 1 (orientation) + Phase 4 (automated scanning) only$0.1015 min10 calls
standardQuick + Phase 2 (attack surface) + Phase 3 (auth) + Phase 5 (dangerous patterns)$0.5045 min30 calls
thoroughStandard + Phase 6 (IaC, crypto, config, logging) + full source-to-sink tracing + ASVS coverage summaryunlimitedunlimitedunlimited

Workflow

Before running any tool

If the request does not specify depth or focus, ask the user:

Codebase path: <path> Which review depth?

  • quick — tech stack + automated scanning (semgrep + trufflehog) ($0.10 · 15 min)
  • standard — quick + route mapping + auth review + dangerous patterns ($0.50 · 45 min)
  • thorough — full ASVS-mapped review + IaC + crypto + data flow tracing (unlimited)

Focus area? (default: all)

  • all — full review
  • auth — authentication, sessions, authorization, OAuth/OIDC (ASVS V6-V10)
  • injection — encoding, sanitization, input validation, dangerous functions (ASVS V1-V2)
  • crypto — cryptography, communication security, data protection (ASVS V11-V14)
  • config — configuration, secrets, error handling (ASVS V13, V16)
  • iac — Infrastructure as Code (Terraform, K8s, Docker)
  • llm — LLM/AI integration security: prompt injection, tool abuse, output handling, RAG, MCP (OWASP LLM Top 10)

Phase 0 — Scope & Setup

  1. Call session(action="start", options={...}) with codebase path, depth, and limits
  2. Call session(action="set_codebase", options={"path": "/absolute/path"})
  3. Call report(action="dashboard", data={"port": 7777}) — live findings tracker
  4. Call report(action="note", data={...}) — record codebase path, expected tech stack, review focus

Phase 1 — Orientation (all depths)

Goal: Understand what you're looking at before analyzing it.

Step 1 — Identify the tech stack:

  • Read package manifests to determine language, framework, and dependencies:
    • Python: requirements.txt, pyproject.toml, Pipfile, setup.py
    • Node.js: package.json, package-lock.json
    • Java: pom.xml, build.gradle, build.gradle.kts
    • PHP: composer.json
    • Ruby: Gemfile, Gemfile.lock
    • Go: go.mod, go.sum
    • .NET: *.csproj, *.sln
  • Check for LLM/AI framework usage while reading manifests. Look for these packages:
    • Python: openai, anthropic, langchain, langchain-core, langchain-community, llama-index, haystack-ai, semantic-kernel, crewai, autogen-agentchat, mcp, pydantic-ai
    • Node.js: openai, @anthropic-ai/sdk, langchain, @langchain/core, @modelcontextprotocol/sdk, ai (Vercel AI SDK)
    • Also grep source files for: API key patterns (sk-, sk-ant-, OPENAI_API_KEY, ANTHROPIC_API_KEY), model name strings (gpt-4, gpt-3.5, claude, o1-, o3-), and LLM endpoint URLs (api.openai.com, api.anthropic.com)
    • If any LLM framework is detected: report(action="note", data={"message": "LLM_DETECTED: [frameworks list]. Phase 5b will run.")
  • Call report(action="note", data={...}) with: language, framework, major dependencies, framework version

Step 2 — Map project structure:

  • Use Glob to understand the directory layout (MVC? microservice? monolith?)
  • Identify entry point files (e.g. app.py, manage.py, server.js, main.go, Application.java)
  • Identify configuration directories (config/, settings/, .env, application.properties)

Step 3 — Read configuration files: Look for security-relevant settings. What matters depends on the framework — adapt to what you find:

  • Debug mode enabled in production
  • Hardcoded secrets (API keys, database passwords, JWT secrets)
  • CORS configuration (overly permissive origins)
  • CSP headers (missing or permissive)
  • Database connection strings
  • Session configuration (cookie flags, timeout)
  • Allowed hosts / origins
  • Email / SMTP configuration with credentials

Call report(action="finding", data={...}) for any hardcoded secrets or dangerous configurations found.

Step 4 — Dependency audit: Check whether pinned dependency versions have known CVEs. For each major dependency, consider whether it's a security-sensitive component (auth library, ORM, template engine, crypto library, XML parser).

Call report(action="diagram", data={...}) with a component architecture diagram showing the tech stack, major components, and their relationships.


Phase 2 — Attack Surface Mapping (standard+)

Goal: Build the complete endpoint inventory from source code — this is what black-box scanning tries to discover from the outside.

Step 1 — Extract all route definitions:

Read the routing configuration for the identified framework. Every framework defines routes differently — find the pattern and extract ALL endpoints:

  • The route path (URL pattern)
  • The HTTP method(s) accepted
  • The handler function/controller
  • Any middleware applied (auth, CSRF, rate limiting, validation)
  • Parameters accepted (path params, query params, request body schema)

Step 2 — Classify each endpoint:

For every endpoint, determine:

  • Is it authenticated or public?
  • What authorization checks are applied?
  • What input does it accept and how is that input used?
  • Does it handle file uploads?
  • Does it return sensitive data?

Step 3 — Identify non-HTTP attack surface:

  • WebSocket endpoints
  • GraphQL schemas (introspection enabled?)
  • gRPC service definitions
  • Background job/queue processors that handle external data
  • CLI commands that accept user input
  • Scheduled tasks that process external data

Call report(action="note", data={...}) with the complete endpoint inventory table. This feeds directly into /pentester and /web-exploit for targeted testing.


Phase 3 — Authentication & Authorization Architecture (standard+)

Goal: Understand how the application proves identity and enforces permissions. Map to ASVS V6 (Authentication), V7 (Session Management), V8 (Authorization), V9 (Self-contained Tokens), V10 (OAuth/OIDC).

Step 1 — Identify the auth mechanism:

  • Find where authentication is configured (middleware, decorators, security filter chains, auth providers)
  • Determine the mechanism: session-based, JWT, OAuth 2.0/OIDC, API key, certificate, or custom
  • Read the implementation: how are credentials verified? how are tokens issued? how are sessions created?

Step 2 — Check password security (ASVS V6.2):

  • Password hashing algorithm and configuration (bcrypt cost factor, argon2 parameters)
  • Password policy enforcement (minimum length, complexity)
  • Account lockout after failed attempts
  • Password reset flow security (token expiry, one-time use)

Step 3 — Check session management (ASVS V7):

  • Session token generation (entropy, predictability)
  • Cookie configuration (Secure, HttpOnly, SameSite, Path, Domain)
  • Session timeout and idle timeout
  • Session invalidation on logout, password change, privilege change
  • Concurrent session limits

Step 4 — Map authorization (ASVS V8):

  • What model is used? (RBAC, ABAC, ACL, or none)
  • Where are permission checks enforced? (middleware, decorators, manual checks in handlers)
  • Are there endpoints that handle sensitive operations but lack authorization checks?
  • Can users access other users' resources? (IDOR potential)
  • Are admin functions properly restricted?

Step 5 — Token security (ASVS V9, V10): If JWT or OAuth is used:

  • Signing algorithm (reject none, prefer RS256 over HS256 with public keys)
  • Token expiry times (access token should be short-lived)
  • Refresh token rotation
  • Token storage (localStorage = XSS risk, httpOnly cookie = safer)
  • Scope validation on resource servers
  • PKCE enforcement for public clients

Call report(action="finding", data={...}) for every auth/authz weakness found. Call report(action="diagram", data={...}) with the authentication flow diagram.


Phase 4 — Automated Scanning (all depths, parallel)

Run both in the same response:

scan(tool="semgrep", target="/target")
scan(tool="trufflehog", target="/target")

If LLM detected in Phase 1, also run in the same parallel batch:

scan(tool="semgrep", target="/target", flags="--config p/ai-best-practices")

This runs 58 semgrep rules covering: hardcoded API keys, missing max_tokens, prompt injection taint flow, MCP command injection, LLM output passed to eval/exec, and insecure model loading.

After results come back:

  • Read each semgrep finding and verify it against the actual code — false positives are common
  • For each confirmed finding, call report(action="finding", data={...}) with the code context
  • For trufflehog findings, verify whether secrets are real or test/example values

Phase 5 — Dangerous Pattern Analysis (standard+)

Goal: Find code patterns that lead to vulnerabilities. Map to ASVS V1 (Encoding/Sanitization), V2 (Validation), V3 (Web Frontend), V4 (API), V5 (File Handling).

The approach: Don't grep for a static list of function names. Instead, understand what categories of dangerous operations exist in the language/framework you're reviewing, and search for patterns that indicate unsafe usage.

Category 1 — Injection (ASVS V1.2): Search for places where user-controlled data reaches execution contexts without proper sanitization:

  • SQL: raw queries with string interpolation/concatenation instead of parameterized queries
  • OS commands: user input reaching shell execution functions
  • Template engines: user input rendered as template code (SSTI)
  • LDAP: user input in LDAP filter construction
  • XPath/XML: user input in query construction
  • Code evaluation: user input reaching eval/exec equivalents

For each finding, trace whether user input actually reaches the function (source-to-sink). A dangerous function with only hardcoded arguments is not a vulnerability.

Category 2 — Output encoding (ASVS V1.3, V3):

  • Template auto-escaping disabled or bypassed (raw/safe/html_safe/dangerouslySetInnerHTML/{!! !!})
  • HTTP response headers set from user input without encoding
  • JSON responses containing unescaped user data rendered in HTML context

Category 3 — Deserialization (ASVS V1.5):

  • Deserialization of untrusted data (pickle, yaml.load without SafeLoader, Java ObjectInputStream, PHP unserialize, node-serialize)
  • JSON parsing with type information enabled (Jackson polymorphic, Newtonsoft TypeNameHandling)

Category 4 — Input validation (ASVS V2.2):

  • Are request parameters validated (type, length, range, format)?
  • Is validation server-side or only client-side?
  • Are there endpoints that accept arbitrary data without schema validation?

Category 5 — File handling (ASVS V5):

  • File upload: what validation is performed? (extension, MIME, magic bytes, size)
  • File paths: is user input used to construct file paths? (path traversal)
  • File inclusion: can user input influence which files are loaded?
  • File download: can users download arbitrary files?

Category 6 — Business logic (ASVS V2.3):

  • Can prices, quantities, or permissions be manipulated via request parameters?
  • Are multi-step workflows enforced server-side or just client-side?
  • Are there race conditions in critical operations (double-spend, TOCTOU)?
  • Can users skip steps or replay requests?

Call report(action="finding", data={...}) for every confirmed dangerous pattern with the source file, line number, the dangerous code, and whether user input reaches it.


Phase 5b — LLM Integration Security (conditional: standard+)

Trigger: Runs when LLM frameworks were detected in Phase 1, OR when focus=llm. Skip entirely for non-LLM codebases.

Goal: Find security weaknesses specific to LLM integrations. This phase covers patterns where the LLM is the source, sink, or intermediary. Generic injection/deserialization patterns are in Phase 5 — this phase focuses on the unique attack surface that LLM integrations introduce.

Maps to: OWASP LLM Top 10 (2025), OWASP MCP Top 10.

Reference: Load skills/codebase/refs/llm-integration.md for framework-specific grep patterns, CVE table, secure agent patterns, and MCP Top 10 checks.

Category 1 — Prompt Construction (OWASP LLM01: Prompt Injection):

  • Search for how prompts are built: string concatenation, f-strings, .format(), template literals with user input
  • Check whether user input is inserted into system prompts, few-shot examples, or tool descriptions
  • Look for RAG context injection: are retrieved documents inserted into prompts without sanitization?
  • Check for indirect injection surfaces: can attacker-controlled content (emails, web pages, documents) reach the prompt via RAG or tool outputs?
  • Verify whether any prompt input validation, escaping, or structural separation (e.g. XML tags, delimiters) is applied

Category 2 — Output Handling (OWASP LLM05: Insecure Output Handling):

  • Search for LLM response text flowing into dangerous sinks:
    • eval(), exec(), subprocess, os.system(), child_process.exec() — code execution
    • Raw SQL queries, ORM raw methods — SQL injection from LLM output
    • innerHTML, dangerouslySetInnerHTML, template |safe — XSS from LLM output
    • Shell commands, file path construction — command injection, path traversal
  • Check for code execution tools: PythonREPLTool, PALChain, LLMMathChain, custom code interpreters
  • Verify whether LLM output is validated, sanitized, or sandboxed before use

Category 3 — Tool/Function Definitions (OWASP LLM06: Excessive Agency):

  • Find all tool/function definitions passed to the LLM (OpenAI function calling, LangChain tools, MCP tools)
  • Check each tool for:
    • Over-permissioned operations: can the tool delete data, modify configs, access other users' resources, execute arbitrary code?
    • Missing auth propagation: does the tool handler enforce the calling user's permissions, or does it run with service-level privileges?
    • Missing input validation: are tool arguments validated before use?
    • No approval gates: are destructive or sensitive operations auto-executed, or is human-in-the-loop confirmation required?
  • Count total tools available to the agent — more tools = larger attack surface

Category 4 — Secrets in Prompts (OWASP LLM02/LLM07: Sensitive Information Disclosure):

  • Search system prompts and prompt templates for hardcoded API keys, database credentials, internal URLs, or PII
  • Check whether confidential business logic or instructions are embedded in prompts (extractable via prompt leakage)
  • Look for logging of full prompts/completions that may contain user PII
  • Check whether conversation history is stored unencrypted or without access controls

Category 5 — RAG & Vector Store Security (OWASP LLM08: Vector and Embedding Weaknesses):

  • Find vector store/retriever configuration (Chroma, Pinecone, Weaviate, pgvector, FAISS)
  • Check for tenant isolation: are per-user metadata filters applied to vector queries, or can any user retrieve any document?
  • Check document ingestion pipeline: is there validation of uploaded documents? Can users upload to shared collections?
  • Look for poisoning risk: can untrusted sources inject documents into the knowledge base?
  • Check similarity score thresholds — are results filtered by relevance, or does everything retrieved get injected into the prompt?

Category 6 — Supply Chain & Model Loading (OWASP LLM03: Supply Chain):

  • Check for unpinned LLM framework versions (known CVEs exist — see ref file for CVE table)
  • Search for pickle-based model loading (torch.load, pickle.load, joblib.load on untrusted files)
  • Look for model downloads without integrity verification (no hash checks, no signed models)
  • Check for custom model loading from user-specified paths
  • Flag known-vulnerable dependency versions against the CVE table in the ref file

Category 7 — Resource Controls (OWASP LLM10: Unbounded Consumption):

  • Check for missing max_tokens / max_completion_tokens on API calls
  • Look for missing timeouts on LLM API requests
  • Check for unbounded agent loops — is there a max_iterations or recursion limit?
  • Look for missing rate limiting on endpoints that trigger LLM calls
  • Check cost controls: is there per-request or per-user spend limiting?

Category 8 — MCP Server Patterns (OWASP MCP Top 10): Only applies when the codebase implements or consumes MCP servers.

  • Tool handler injection: check whether MCP tool arguments are passed to shell commands, SQL, or file paths without sanitization
  • Resource exposure: are MCP resources exposing sensitive files or data without auth checks?
  • Server authentication: is the MCP server accessible without authentication?
  • Rug-pull potential: can MCP tool descriptions or behavior change between discovery and invocation?
  • Upstream dependency trust: does the MCP client validate responses from MCP servers, or trust them blindly?

Call report(action="finding", data={...}) for each confirmed LLM-specific weakness. Use severity guidance:

  • Critical: LLM output reaches eval/exec/shell without sandboxing; tool handler has command injection; prompt injection enables data exfiltration
  • High: No tenant isolation in RAG; over-permissioned tools without approval gates; secrets in system prompts; pickle model loading
  • Medium: Missing max_tokens; no agent iteration limits; unpinned LLM framework versions; weak prompt/response validation
  • Low: Logging full prompts without PII redaction; no similarity threshold on RAG retrieval; missing rate limits on LLM endpoints

Phase 6 — Infrastructure, Crypto & Configuration (thorough)

Goal: Review supporting infrastructure for security weaknesses. Map to ASVS V11-V14, V16.

Cryptography (ASVS V11):

  • What algorithms are used for hashing, encryption, signing?
  • Are deprecated algorithms used? (MD5, SHA1 for security purposes, DES, RC4)
  • How are encryption keys managed? (hardcoded, environment variable, KMS)
  • Is random number generation cryptographically secure?

Secure communication (ASVS V12):

  • Is TLS enforced for all external communication?
  • Are certificate validations disabled anywhere? (verify=False, InsecureSkipVerify)
  • Are internal service-to-service calls encrypted?

Configuration (ASVS V13):

  • Are secrets in environment variables, secret managers, or hardcoded?
  • Is debug mode disabled in production configuration?
  • Are default credentials or test accounts present?
  • Are unnecessary features, endpoints, or services enabled?

Data protection (ASVS V14):

  • Is sensitive data encrypted at rest?
  • Is PII properly handled (minimization, masking, access controls)?
  • Are sensitive fields excluded from logs?
  • Is data classified and handled according to its sensitivity?

Error handling and logging (ASVS V16):

  • Do error responses leak stack traces, internal paths, or configuration?
  • Are security events logged? (authentication failures, authorization denials, input validation failures)
  • Is there log injection risk? (user input in log messages without sanitization)
  • Are sensitive values excluded from logs? (passwords, tokens, credit card numbers)

Infrastructure as Code: If IaC files are present (Terraform, CloudFormation, K8s manifests, Dockerfiles, docker-compose), review them for:

  • Overly permissive IAM policies or security groups
  • Public storage buckets or databases
  • Containers running as root or with excessive capabilities
  • Missing encryption, logging, or monitoring
  • Hardcoded secrets in manifests
  • Unpinned base images

Call report(action="finding", data={...}) for each confirmed weakness.


Phase 7 — Security Profile & Report (all depths)

Step 1 — Architecture diagram: Call report(action="diagram", data={...}) with a comprehensive Mermaid diagram showing:

  • All components (web server, app server, database, cache, queue, external APIs)
  • Trust boundaries (public internet, DMZ, internal network)
  • Data flows with sensitivity labels
  • Authentication/authorization enforcement points
  • Identified vulnerabilities annotated on the diagram

Step 2 — Codebase security profile: Call report(action="note", data={...}) with a structured summary that downstream skills can consume:

Codebase Security Profile:
  Language:        [language] [version]
  Framework:       [framework] [version]
  Architecture:    [monolith/microservice/serverless]

  Endpoints:       [count] total ([count] public, [count] authenticated)
  Auth mechanism:  [session/JWT/OAuth/API key]
  Auth library:    [library name and version]
  Authorization:   [RBAC/ABAC/ACL/none]
  Password hashing: [algorithm and parameters]

  Findings:        [count] by severity (critical: N, high: N, medium: N, low: N)
  Secrets found:   [count] (verified: N)
  ASVS coverage:   V1:[status] V2:[status] ... V16:[status]

  LLM Integration: [yes/no]
    Frameworks:    [openai, langchain, etc.]
    LLM endpoints: [count] (endpoints that trigger LLM calls)
    Tools defined: [count] (function/tool definitions passed to LLM)
    RAG:           [yes/no] ([vector store name])
    MCP:           [server/client/none]
    OWASP LLM Top 10 white-box coverage:
      LLM01 Prompt Injection:           [REVIEWED/NOT APPLICABLE]
      LLM02 Sensitive Info Disclosure:   [REVIEWED/NOT APPLICABLE]
      LLM03 Supply Chain:               [REVIEWED/NOT APPLICABLE]
      LLM05 Insecure Output Handling:   [REVIEWED/NOT APPLICABLE]
      LLM06 Excessive Agency:           [REVIEWED/NOT APPLICABLE]
      LLM07 System Prompt Leakage:      [REVIEWED/NOT APPLICABLE]
      LLM08 Vector/Embedding Weakness:  [REVIEWED/NOT APPLICABLE]
      LLM10 Unbounded Consumption:      [REVIEWED/NOT APPLICABLE]

  Priority targets for pentesting:
    - [endpoint] — [reason: missing auth, SQLi, file upload, etc.]
    - [endpoint] — [reason]

  Priority targets for AI red-team (/ai-redteam):
    - [endpoint URL] — [reason: extractable system prompt, over-permissioned tools, no input validation]
    - [extracted system prompt text or location]
    - [tool definitions and guardrail mechanisms found in source]

  IaC issues:      [count] ([Terraform/K8s/Docker])

Step 3 — ASVS coverage summary (thorough only): Call report(action="note", data={...}) with which ASVS chapters were reviewed and what was found:

ASVS 5.0 Coverage:
  V1  Encoding/Sanitization:    REVIEWED — [findings or "no issues"]
  V2  Validation/Business Logic: REVIEWED — [findings or "no issues"]
  V3  Web Frontend Security:    REVIEWED — [findings or "no issues"]
  V4  API and Web Service:      REVIEWED — [findings or "no issues"]
  V5  File Handling:            REVIEWED — [findings or "no issues"]
  V6  Authentication:           REVIEWED — [findings or "no issues"]
  V7  Session Management:       REVIEWED — [findings or "no issues"]
  V8  Authorization:            REVIEWED — [findings or "no issues"]
  V9  Self-contained Tokens:    [REVIEWED | NOT APPLICABLE]
  V10 OAuth and OIDC:           [REVIEWED | NOT APPLICABLE]
  V11 Cryptography:             REVIEWED — [findings or "no issues"]
  V12 Secure Communication:     REVIEWED — [findings or "no issues"]
  V13 Configuration:            REVIEWED — [findings or "no issues"]
  V14 Data Protection:          REVIEWED — [findings or "no issues"]
  V15 Secure Coding/Arch:       REVIEWED — [findings or "no issues"]
  V16 Logging/Error Handling:   REVIEWED — [findings or "no issues"]

Step 4: Call session(action="complete", options={...}) with summary.

Step 5: Chain into downstream skills — see CHAIN COMMITMENTS section at the top for mandatory chains. Summary:

  • MUST → /threat-modeling (always — real architecture from code)
  • MUST if live target available → /web-exploit (do NOT skip because code review found no injection points — systematic live testing finds what static analysis misses)
  • MUST if LLM/AI integration detected → /ai-redteam (pass system prompts, tool definitions, guardrail config, RAG architecture as white-box context)
  • If API routes/controllers found → /api-security (OWASP API Top 10 with white-box context)
  • If IaC found → /cloud-security or /container-k8s-security
  • If CVE-affected dependencies found → /analyze-cve

Chaining Other Skills

SkillWhen to invoke
/threat-modelingAlways after review — feed real architecture into STRIDE analysis
/pentesterEndpoints discovered — target scan with white-box knowledge
/web-exploitMANDATORY if live target available — do NOT wait for injection points to be found in source; systematic live testing finds what static analysis misses
/api-securityAPI routes/controllers identified in source (REST/GraphQL/gRPC/SOAP/MCP) — pass route inventory, auth middleware, ORM models, and authorization decorators as white-box context for OWASP API Top 10 testing
/cloud-securityIaC files found — verify cloud misconfigs match runtime state
/container-k8s-securityK8s manifests or Dockerfiles found — verify container security
/analyze-cveCVE-affected dependency found — trace code path with full source context
/credential-auditAuth mechanism identified — test with knowledge of password policy and lockout config
/ai-redteamLLM integration detected — pass system prompts, tool definitions, guardrails, RAG architecture, and endpoint URLs as white-box context
/remediateFindings produced — generate specific code fixes with full source context
/gh-exportWhen user asks to file GitHub issues

Finding Severity Guide

SeverityCriteriaExamples
CriticalDirect path to RCE, data breach, or auth bypass from sourceUnsanitized user input in eval/exec; hardcoded admin credentials; SQL injection in auth query; deserialization of untrusted data
HighSignificant security weakness exploitable with moderate effortMissing auth on sensitive endpoints; IDOR in API; weak password hashing; disabled CSRF protection; path traversal in file operations
MediumSecurity weakness requiring specific conditions to exploitMissing rate limiting; verbose error messages; weak session timeout; permissive CORS; missing security headers
LowDefense-in-depth gap or best practice deviationDebug mode in non-production config; missing CSP header; unpinned dependencies; logging without sensitive data redaction

Rules

  • session(action="start", options={...}) is mandatory — never run any other tool before it
  • Read before you judge — don't report a finding just because a function name appears. Verify that user input actually reaches it
  • Source-to-sink tracing is essential — a dangerous function with hardcoded arguments is not a vulnerability. Trace the data flow
  • Adapt to the framework — every framework has different patterns. Don't grep for Django patterns in a Flask app
  • Call report(action="finding", data={...}) for every confirmed weakness — include the file path, line number, vulnerable code snippet, and why it's exploitable
  • Call report(action="diagram", data={...}) at least twice — after Phase 1 (initial architecture) and Phase 7 (annotated with findings)
  • The security profile feeds downstream skills — write it clearly in report(action="note", data={...}) so other skills can parse and act on it
  • Use report(action="note", data={...}) liberally — document your understanding of each component before analyzing it
  • Never fabricate findings — only report what the code actually shows
  • ASVS is a guide, not a checklist — focus on high-risk areas first, not sequential chapter review
  • Mermaid syntax rules: use flowchart TD, quote labels with spaces/special chars, no em-dashes, short alphanumeric node IDs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.