Skip to content
SQL injection Write-up Advanced

How we hacked McKinsey's AI platform

An unauthenticated SQL injection in McKinsey's Lilli AI platform allowed an autonomous agent to read and write the production database, exposing millions of chat messages, files, user accounts, and AI system prompts. The agent also chained an IDOR to access individual employees' search histories.

codewall.ai

Published on codewall.ai

An autonomous AI agent found a SQL injection in McKinsey's Lilli AI platform. What it extracted was worse than we expected.

The author, on codewall.ai

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 concatenated user-controlled JSON keys directly into SQL queries instead of using parameterised queries or whitelisting field names.

Impact

The injection gave full read and write access to the production database, exposing 46.5 million chat messages, 728,000 files, 57,000 user accounts, and AI system prompts, and could have allowed an attacker to silently rewrite prompts to poison advice or exfiltrate data.

What the attacker needed

No credentials; internet access to the target

The fix

McKinsey patched all unauthenticated endpoints, took the development environment offline, and blocked public API documentation.

How it was found

  1. The agent mapped the attack surface and found publicly exposed API documentation with over 200 endpoints.
  2. It identified 22 endpoints that did not require authentication.
  3. It found an unprotected endpoint that wrote user search queries to the database, where JSON keys were concatenated into SQL.
  4. It observed JSON keys reflected in database error messages, confirming SQL injection.
  5. It ran fifteen blind iterations, using error messages to learn the query shape, until production data was returned.
  6. It chained the SQL injection with an IDOR to read individual employees' search histories.

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.

SQL injection is when user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the field names in a JSON object were put directly into the SQL, so an attacker could inject commands and read or modify the database. The platform also had an IDOR, meaning changing an identifier in a request let someone access another user's data.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.