Insecure Output Handling: SSRF, SQLi, and Command Execution Through an Agent's Tools
Red-team OpsBot, a ReAct tool-using support agent, by shaping the arguments it passes to its own tools. File a poisoned support ticket and a benign on-call query turns into a server-side request forgery against a metadata endpoint, a SQL injection that drops a canary and reads another tenant's rows, and code execution through a transform helper. Measure attack-success-rate, then close every sink: an allow-listed fetch, parameterized queries, and a removed code tool.
Hands-on labs require Pro · $29.99/mo · cancel anytime
What you'll learn
- 1Recon: map the agent and its toolsYou are red-teaming OpsBot (DV-ToolAgent), ACME Cloud's internal operations
- 2SSRF: make the agent fetch the internal metadata endpointDrive your first sink: server-side request forgery (SSRF) through http_fetch. The
- 3SQLi: read another tenant and drop the canaryDrive the second sink: SQL injection through db_query. The tool runs a
- 4Reliability: measure the SSRF ASROne lucky tool call is a demo. A finding needs an attack-success-rate (ASR): how
- 5Code execution: run the transform helperDrive the third sink: code execution through run_python. The tool runs an
- 6Harden (SSRF): close the fetch sink with an egress allow-listSwitch hats. You proved three sinks: SSRF, SQL injection, and code execution. The
- 7Harden (SQLi): parameterized, tenant-scoped queriesThe SSRF sink is closed (Step 6). Now close the second sink: SQL injection through
- 8Harden (RCE) + verify: remove the code tool and resist all three sinksTwo sinks are closed: SSRF (Step 6) and SQLi (Step 7). Close the last one, then
Prerequisites
- Comfortable reading Python
- Know what SSRF, SQL injection, and a shell command are
- No ML background required
Exam domains covered
Skills & technologies you'll practice
This advanced-level ai/ml lab gives you real-world reps across:
What you'll do in this lab
This is a hands-on offensive-security lab on insecure output handling at the tool-call sink (OWASP LLM05, with LLM06 excessive agency as the enabler). You attack OpsBot, a working ReAct tool-using agent, by treating its tool arguments as the output you control. You file one poisoned support ticket, and when an on-call engineer asks the agent to work it, the agent reads your text and calls a tool with your argument. You drive three real sinks: server-side request forgery that reaches an in-pod cloud-metadata endpoint, SQL injection that drops an audit canary and reads another tenant's records, and code execution through a transform helper that writes a sentinel file. Every callback and side effect is a deterministic in-pod oracle, so you see the exploit fire for real against a live model, not a mock.
You do not jailbreak the model. You influence the arguments it passes to a tool it is supposed to call, which is why refusal rates stay low: "summarize this status URL", "look up this customer", and "run this transform helper" are all in-distribution helpful behavior. After measuring how reliably the channel fires across realistic on-call prompts, you switch hats and close every sink on the sink side: an egress allow-list with explicit private-range and metadata denial, parameterized tenant-scoped queries that forbid stacked statements, and removing the arbitrary-code tool entirely, while a legitimate fetch and a legitimate customer lookup still work.