🧠 Exploiting LLM APIs with Excessive Agency
A chatbot backed by a large language model was given direct access to backend APIs, including one that ran raw SQL. By simply asking the chatbot to call that API, an attacker could read the user table and delete a chosen user.
Published on infosecwriteups.com
This walkthrough covers the “Exploiting LLM APIs with Excessive Agency” lab provided by PortSwigger Web Security Academy.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the LLM integration exposed a raw SQL execution tool to the chatbot without any restriction, approval step or least-privilege design.
Impact
An attacker could read database contents and delete arbitrary users through the chatbot, with no authentication or approval beyond the chat itself.
What the attacker needed
Access to the public chat interface; none
The fix
The integration should be fixed by removing raw SQL and other sensitive tools from the LLM's reach and adding guardrails, validation and role-based limits.
How it was found
- Open the live chat on the site.
- Ask the chatbot who it is and what it can access.
- Ask which APIs it can call, revealing the SQL tool.
- Ask it to run a query listing all users.
- Ask it to run a delete query for the target username.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A large language model (LLM) is the kind of AI behind chat assistants. Here the assistant was wired to internal tools, one of which ran database commands, so anyone chatting with it could ask it to run those commands for them. The mistake is giving the assistant far more power than it needs.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.