Attack Vectors · Foundational Guide

AI API Security: How to Secure LLM Endpoints in Production

In February 2026, an autonomous AI agent picked a target on its own, found the weak point in under two hours, and had full read-write access to one of the world's largest consulting firms' internal AI platform. Not through a sophisticated exploit. Through 22 API endpoints that simply required no authentication at all.

2 hrs
From first contact to full database read-write access, per multiple independent reports
91,403
Real attack sessions against exposed LLM endpoints, captured by GreyNoise's honeypots (Oct 2025–Jan 2026)
38%
Of live MCP servers Wiz scanned had no authentication at all

What Actually Happened at McKinsey — Verified Across Multiple Independent Reports

On February 28, 2026, security firm CodeWall pointed an autonomous, offensive AI agent at the open internet and let it choose its own target — with no prior knowledge of what it would find. It selected Lilli, McKinsey & Company's internal AI platform, serving more than 40,000 employees and processing hundreds of thousands of prompts a month across chat, document analysis, and retrieval-augmented search over decades of proprietary research.

The agent found McKinsey's own API documentation, publicly accessible, describing more than 200 endpoints. Of those, 22 required no authentication whatsoever. One accepted search queries and wrote them directly into a database call — a JSON field concatenated straight into SQL, a vulnerability class that has been on security checklists since the 1990s. Within roughly two hours, the agent had full read-write access to Lilli's production database: 46.5 million chat messages, 728,000 files, 57,000 user accounts, and 95 system prompts — the operational instructions governing how the AI actually behaved for every employee using it.

McKinsey's own public response confirms the essential facts: the firm was alerted by CodeWall's responsible disclosure, promptly confirmed the vulnerability, and fixed it within hours — patching all 22 unauthenticated endpoints within days. An independent forensic investigation found no evidence that client data had been accessed by any unauthorized party beyond CodeWall's own research agent.

What makes this a genuinely important case study, not just a headline

Nothing about this attack required insider access, stolen credentials, or a novel exploit technique. The agent had a domain name and a public disclosure policy to go on — nothing more. The vulnerability wasn't in the AI model's behavior at all. It was in the infrastructure sitting underneath it: unauthenticated endpoints and unsanitized input, the same two categories of flaw that have caused breaches in conventional web applications for over two decades, just now applied to an AI platform's action layer instead.

This Isn't an Isolated Incident — It's an Active, Ongoing Pattern

The McKinsey breach is the clearest, best-documented example, but it isn't unique. Real, measured attacker activity confirms the same underlying pattern is happening broadly, right now, across exposed AI infrastructure generally.

The Three Failure Points, in Order of How the McKinsey Attack Actually Chained Them

1. Unauthenticated endpoints treated as "internal only"

This is the root cause, and the most common one. An endpoint gets built for internal tooling, gets deployed without authentication because "nobody outside the company would know the URL," and that assumption quietly becomes the entire security model. It's the same failure class as an S3 bucket left public — the endpoint isn't hidden, it's undocumented, and undocumented is not the same thing as secured.

2. Unsanitized input reaching a database query directly

The McKinsey breach's actual technical mechanism was ordinary SQL injection — no AI-specific novelty required. What made it dangerous wasn't sophistication, it was where it landed: a database holding both user data and the system prompts controlling the AI's own behavior, meaning write access to one meant write access to both.

3. Operational configuration stored alongside user data

System prompts, RAG configuration, and access rules sitting in the same production database as chat logs and user records means a single write-access breach compromises both the data and the AI's own operating instructions at once. Separating these — different storage, different access controls, different change-logging — limits what a single successful attack can actually reach.

Securing AI API Endpoints in Practice

Final Takeaway

The McKinsey breach is genuinely useful precisely because nothing about it was exotic. No zero-day, no novel AI-specific attack technique, no nation-state sophistication — an autonomous agent with a domain name and public documentation found two of the oldest, most well-understood vulnerability classes in web security, applied to infrastructure that happened to have "AI" in its name. That's the real lesson: AI API security isn't a fundamentally new discipline requiring an entirely new set of controls. It's the same API security discipline that's existed for years, applied with the same rigor to infrastructure that too many teams are still treating as somehow exempt from it.

Would your API endpoints survive the same test?

Independent, adversarial testing for exactly this class of exposure — before an autonomous agent finds it first.

Frequently Asked Questions

What actually happened in the McKinsey Lilli breach?
On February 28, 2026, security firm CodeWall pointed an autonomous offensive AI agent at the open internet with no prior knowledge of the target. It selected McKinsey's internal AI platform, Lilli, found 22 unauthenticated API endpoints among 200+ that were publicly documented, exploited a basic SQL injection flaw in one of them, and achieved full read-write access to the production database within two hours — exposing 46.5 million chat messages, 728,000 files, 57,000 user accounts, and 95 system prompts. McKinsey patched the vulnerabilities within hours of responsible disclosure and stated it found no evidence client data was accessed by any unauthorized party beyond CodeWall itself.
Are MCP servers a real, current security risk?
Yes. Security researchers at Wiz scanned more than 500 live MCP servers and found 38% running with no authentication at all — meaning any client that could reach the endpoint could interact with it freely. Separately, a systemic flaw disclosed in the official MCP SDKs in April 2026 left an estimated 200,000 instances exposed across a supply chain touching more than 150 million package downloads.
Are attackers actually scanning for exposed LLM endpoints right now?
Yes, actively. GreyNoise's honeypot infrastructure captured 91,403 attack sessions specifically targeting exposed LLM endpoints between October 2025 and January 2026, from two distinct, systematic reconnaissance campaigns. By late January 2026, 60% of all attack traffic tracked by Pillar Security had shifted specifically to MCP endpoint reconnaissance.
What is the single most important first step to secure an AI API?
Require authentication on every endpoint, without exception — including internal tools, staging environments, and endpoints assumed to be low-risk. The McKinsey breach happened specifically because 22 endpoints were left unauthenticated on the assumption they were internal-only, and an autonomous scanning agent found them from the public internet with no prior knowledge of the target.

Related Reading