Attacking Agentic AI — Abusing Insecure Function Calls to Break Output Handling.
The LLM agent's search function passed user input directly into a SQL query without sanitisation, allowing SQL injection. An attacker could use UNION-based injection to dump sensitive data from the database.
Published on infosecwriteups.com
Use the FREE link for non-members here 👉 link
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 application failed to sanitise or parameterise the LLM-generated output before using it in a SQL query.
Impact
An attacker could dump sensitive data such as credit card data or PII from the database, though in this CTF the impact was limited to a flag.
What the attacker needed
Access to the chat interface; LLM agent with a search function
The fix
Applications should properly sanitise LLM output and always use parameterised SQL queries.
How it was found
- Ask the LLM about its role and capabilities.
- Ask the LLM to list and describe its available functions.
- Test the search_package function with a normal query.
- Inject a single quote to trigger a SQL error and confirm SQLite backend.
- Use UNION-based SQL injection to query table names from sqlite_master.
- Bypass a guardrail by instructing the LLM to ignore special characters, then dump the secret table.
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.
An AI agent was given a tool to search for packages. When a user typed a search term, the agent put that text straight into a database query without cleaning it. This let an attacker add extra database commands to steal information.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.