Skip to content
AI / LLM Write-up Beginner

🧠 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.

Aditya Bhatt Follow

Published on infosecwriteups.com

This walkthrough covers the “Exploiting LLM APIs with Excessive Agency” lab provided by PortSwigger Web Security Academy.

Aditya Bhatt, on infosecwriteups.com

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

  1. Open the live chat on the site.
  2. Ask the chatbot who it is and what it can access.
  3. Ask which APIs it can call, revealing the SQL tool.
  4. Ask it to run a query listing all users.
  5. 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.

More by Aditya Bhatt

View all

25 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

AI and LLM vulnerabilities

The lesson behind this report.

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.