All hands-on labs

Premium Hands-on labbeginnerAWS

LLM05 Improper Output Handling to Customer Records

An internal reporting assistant turns your plain-English questions into database queries, and the reporting service runs whatever it writes. Get past the assistant's topic guardrail with an ordinary sales request and watch a trusted service read customer records it was never meant to share.

  • 5 guided tasks
  • Capture the flag

Scenario

Context: In June 2024, the security firm JFrog published a report on Vanna.AI, a popular open-source library for building "text-to-SQL" tools. These tools let you ask a database a question in plain English, such as "What were our sales last quarter?" The tool then translates that into a query, runs it, and shows the answer. Vanna can also draw a chart of the result, providing a lot of convenience.

To draw that chart, Vanna asked the LLM to write a small Python program, and then it ran that program on its server without looking at it first. Since the LLM writes that program from the user's question, whoever types the question also has a say in what code runs. JFrog's researchers hid instructions inside a question, the LLM followed them, and Vanna ran the result (CVE-2024-5565).

Vanna isn't the only example of an issue like this. Earlier CVEs in LangChain (CVE-2023-36189) and LlamaIndex (CVE-2024-23751), two other popular LLM libraries, describe a similar mistake with SQL. A carefully worded question could make the LLM write a malicious database command. In each case, the app trusted whatever the LLM wrote.

Our lab scenario: You're on the security team at Ledgerline, a company that sells billing and invoicing software to other businesses.

The development team has put together a system that goes live for every sales rep on Friday. You've been tasked with reviewing its security. One of the abuse cases to test is whether access is limited to least privilege: sales employees only see sales data, and only the CRM team sees customer accounts.

Your manager wants to know whether that rule is enforced before launch, and IT set you up with a Northwest sales analyst login to find out.

What you will learn

  • Understand what [OWASP LLM05 Improper Output Handling](https://genai.owasp.org/llmrisk/llm052025-improper-output-handling/) means in practice
  • Learn how users can get an AI assistant to write queries that read data they shouldn't see (such as customer records)
  • Learn why an app should check an LLM's output before blindly returning it
Hands-on lab

LLM05 Improper Output Handling to Customer Records

Included in Cybr Premium.