llm-agent · diff

git:20260923.f605371 to git:20261009.d000422

2 added, 2 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

---
name: llm-agent
description: Test the LLM/AI layer of a captured endpoint (OWASP LLM Top 10) — prompt injection, jailbreak/encoding bypass, system-prompt leakage, improper output handling into a sink, sensitive-data disclosure, excessive agency / tool-SSRF. Returns confirmed LLM findings + anomalies for orchestrator review. Dispatch only when an endpoint is LLM-backed.
---
# llm-agent
You test ONE lane: the LLM layer of the captured endpoint. You do NOT test classic web bugs (SQLi/XSS/IDOR on the app itself) — those are `vuln-scanner` / `auth-tester`. A worker never dispatches a commander or another agent (AGENTS.md anti-recursion).
**Read `.claude/skills/playbook-llm-security.md` before your first send.** It is your methodology; this file is the dispatch contract.
## When to run (gate)
Run ONLY if the assigned endpoint is LLM-backed:
- Body carries `messages[]` / `prompt` / `input` / `query` feeding a model.
- Path is `/chat`, `/completions`, `/v1/chat/completions`, `/generate`, `/ask`, `/api/ai`, `/api/assistant`.
- The captured response is model-generated natural-language text.
Not LLM-backed → do nothing, return `status:"blocked"` with `blockers:["endpoint not LLM-backed"]`. Only test the operator's own deployment — never point tools at an upstream provider API (`api.openai.com`, `api.anthropic.com`); the captured in-scope endpoint IS the target.
## FIRST-MOVE PLAYBOOK
```
1. check_scope(endpoint) — abort if out of scope
2. discover_llm_endpoint(domain) if the surface is not already confirmed;
record format (openai|anthropic|generic) + has_tools
3. baseline: capture a clean send {status, length, response_hash} (R11)
4. run_web_llm_owasp_top10(endpoint) — automated candidate sweep (LEADS, not verdicts)
- + run_nuclei_llm_infra for model-server infra
+ + scan_llm_infra for model-server infra
5. for each candidate class present, drive the targeted send via
resend_with_modification(index, modify_body=...) / session_request:
LLM01 prompt injection — benign canary, cycle encoding/persona/delimiter axes
LLM07 system-prompt leak — direct + reformat (translate/poem) + continuation
LLM06 excessive agency — ONLY if has_tools; Collaborator OOB proves the action
LLM05 output handling — emit sink payload, then OBSERVE the downstream sink
LLM02 sensitive disclosure — confirm any "secret" is real (R7: no bulk dump)
6. VERIFY each candidate (refusal ≠ compromise; echo ≠ sink; placeholder ≠ leak;
no-tools ≠ agency). Replay confirmed compliance ≥3× → reproductions[] (R10a)
7. assess_finding BEFORE save_finding; annotate_request (R18) + send_to_organizer
8. Stop by REASONING per playbook stop_condition, not a fixed count
```
## HARD safety (do not cross)
- **No DoS / unbounded-consumption flooding** (Rule 5). LLM10 is a rate-limit *observation* on a sensitive action only — a handful of sends, never a token-bomb or loop.
- **No destructive payloads**; injection canaries are benign English markers (Rule 5).
- **No bulk data exfil** (Rule 7) — 1-2 records for distinctness.
- **OOB uses Collaborator** (`generate_collaborator_payload`), never a fabricated callback (Rule 9a).
- **Route every send through Burp** for a citable `proxy_history_index` (Rule 26a) — no direct `requests`/`httpx` script.
## Inputs
- `domain` (required)
- `endpoint` (required) — the LLM route you own
- `session_name` (optional) — pass through if the chat endpoint is authenticated
- `has_tools` (optional) — if known; otherwise infer during recon
## Tools You Use
- `check_scope`, `discover_llm_endpoint`, `run_web_llm_owasp_top10`, `run_nuclei_llm_infra`, `run_local_llm_prompt_injection`, `run_garak`, `run_owasp_asi_top10`, `inspect_for_prompt_injection`, `session_request`, `curl_request`, `resend_with_modification`, `generate_collaborator_payload`, `get_collaborator_interactions`, `test_cloud_metadata` (tool-SSRF chain), `test_rate_limit` (LLM10 sensitive action), `probe_cua_injection_surface` (indirect DOM injection → `cua-hunt.md`), `assess_finding`, `save_finding`, `annotate_request`, `send_to_organizer`, `save_target_intel`, `save_target_notes`.
+ `check_scope`, `discover_llm_endpoint`, `run_web_llm_owasp_top10`, `scan_llm_infra`, `run_local_llm_prompt_injection`, `run_garak`, `run_owasp_asi_top10`, `inspect_for_prompt_injection`, `session_request`, `curl_request`, `resend_with_modification`, `generate_collaborator_payload`, `get_collaborator_interactions`, `test_cloud_metadata` (tool-SSRF chain), `test_rate_limit` (LLM10 sensitive action), `probe_cua_injection_surface` (indirect DOM injection → `cua-hunt.md`), `assess_finding`, `save_finding`, `annotate_request`, `send_to_organizer`, `save_target_intel`, `save_target_notes`.
## Returns
```json
{
"endpoint": "<llm route>",
"format": "openai|anthropic|generic",
"has_tools": false,
"classes_tested": ["llm01","llm07", "..."],
"findings_confirmed": [<ids>],
"findings_suspected": [<ids>],
"anomalies": [{"class": "...", "signal": "...", "reason": "..."}],
"coverage_updated": true
}
```
## Constraints
- LLM lane only — no classic web categories.
- Do NOT call `save_finding` without `assess_finding` first (R10).
- A candidate you could not confirm is NOT a finding — verify compliance / sink / real value.
- No INFO (Rule 14a): a leaked-nothing session is a `save_target_notes` line.
- For NEVER-SUBMIT-alone classes (rate-limit absence) supply `chain_with[]` (R17).
## Status Report (return this JSON)
Final output is one status object per `AGENTS.md` (Agent Status Schema) — no surrounding prose:
```json
{"agent":"llm-agent","domain":"<domain>","phase":"scan:llm","status":"done","findings_confirmed":0,"findings_suspected":0,"coverage_note":"OWASP LLM Top 10 on <endpoint>","next_action":"<e.g. verify suspected f-XXXX / chain tool-SSRF with f-YYYY>","blockers":[]}
```