Review LLM app code against the OWASP Top 10 for LLM Applications 2025. Runs a static scan for 10 risky patterns, answers 10 review questions from the code and writes a report. Use when asked for an LLM security or OWASP LLM review.
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
scripts/scan.py applies these ten patterns line by line to *.py, *.ts and *.js files. Each pattern maps to one OWASP risk. Every match is a hint that you must confirm by reading the code around it.
| Rule | Risk | What it flags |
|---|---|---|
| P01 | LLM05:2025 Improper Output Handling | eval( or exec( whose argument names completion, response, output, reply or content |
| P02 | LLM05:2025 Improper Output Handling | subprocess.<fn>(... shell=True ...) |
| P03 | LLM01:2025 Prompt Injection | an f-string on a line that mentions prompt or messages and interpolates request, req, query or user_input |
| P04 | LLM02:2025 Sensitive Information Disclosure | a literal that starts with sk-ant-, sk- or AIza followed by 20 or more key characters |
| P05 | LLM10:2025 Unbounded Consumption | a call to create(, generate_content( or complete( whose arguments contain no max_tokens, max_output_tokens or maxTokens |
| P06 | LLM03:2025 Supply Chain | pickle.load(, joblib.load( or torch.load( without weights_only=True |
| P07 | LLM03:2025 Supply Chain | trust_remote_code=True |
| P08 | LLM07:2025 System Prompt Leakage | return or jsonify on a line that mentions system_prompt or systemprompt |
| P09 | LLM06:2025 Excessive Agency | auto_approve=True or a flag whose name contains dangerous set to true (except names ending in deserialization) |
| P10 | LLM08:2025 Vector and Embedding Weaknesses | allow_dangerous_deserialization=True |
P01 and P02. Confirm that model output (directly or after string handling) reaches eval, exec or a shell. Fix: never execute model output; parse it as data (JSON with a schema), use ast.literal_eval for literals, and call subprocess.run([...]) with an argument list and shell=False, validating each value against an allow-list. False positives: exec(code) where code is a trusted constant; shell=True with a fixed literal command that has no variable input.
P03. Confirm that untrusted text is spliced into the instruction part of a prompt. Fix: keep fixed instructions in the system message, put user text in its own user message, delimit it, and test with injection strings. False positives: logging or UI strings on a line that also mentions messages; f-strings that interpolate trusted values.
P04. Confirm the literal is a real key and not a placeholder. Fix: remove it, rotate the key at the provider, load it from a secret manager or the deployment platform, and check git history for earlier copies. Never repeat the full key in the report.
P05. Confirm that the call is a model call (many libraries have a create( method). Fix: set max_tokens (or the library's equivalent) on every call and add per-user rate limits, timeouts and budgets. False positives: create of a non-model object; a limit passed through **kwargs built elsewhere.
P06 and P07. Confirm what is being loaded and from where. Fix: load only artifacts you produced or verified; use weights_only=True or the safetensors format; pin model revisions and hashes; do not enable remote code, pin a reviewed revision instead. False positives: loading a file that the application itself wrote in a trusted, private location.
P08. Confirm that the system prompt reaches a client, a response body or a log. Fix: return only the model answer; keep secrets out of the system prompt; enforce access control in code, not in prompt text. False positives: internal helper functions that return the prompt to another internal function.
P09. Confirm that tool actions run without human approval. Fix: require approval for state-changing or external actions, give each tool the least privilege it needs, and remove flags that disable safety checks. False positives: auto-approval limited to read-only tools in a sandbox.
P10. Confirm the vector store file can be written by anyone but you. Fix: deserialize only stores you created, keep them in a private location, verify a checksum, and separate data per tenant.
The patterns cannot see data flow. While answering the questions, also look for: retrieved documents or tool results inserted into prompts without marking them as untrusted data; model output rendered as HTML or Markdown links without encoding; model output used in SQL, shell, file paths or URLs; missing per-tenant filters on vector queries; tools that can write, delete, send or spend without limits.