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.
HexTyx Security Research·
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.
Real, active reconnaissance: GreyNoise's honeypot infrastructure captured 91,403 attack sessions specifically targeting exposed LLM endpoints between October 2025 and January 2026 — two distinct, systematic campaigns mapping the expanding attack surface of misconfigured AI deployments, not opportunistic one-off probes.
MCP servers specifically are under-secured at scale: Wiz scanned more than 500 live MCP servers — the protocol increasingly used to let AI agents call tools, read files, and query databases — and found 38% running with no authentication at all. Any client that could simply reach the endpoint could interact with it freely.
The reconnaissance is shifting specifically toward MCP: by late January 2026, 60% of all attack traffic tracked by Pillar Security had moved specifically to MCP endpoint reconnaissance — attackers deliberately mapping the newest, least-defended entry point into an organization's internal infrastructure.
Supply-chain scale matters here too: OX Security disclosed a systemic architectural flaw in April 2026 embedded in the official MCP SDKs themselves — not one product, but a design default inherited by every downstream project trusting the reference implementation, leaving an estimated 200,000 instances exposed across a supply chain touching more than 150 million package downloads.
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
Require authentication on every endpoint, no exceptions — including anything assumed to be internal-only, staging environments, and endpoints that seem too obscure to matter. "Nobody would find it" is not a security control.
Run a genuine API inventory, not an assumed one — the McKinsey breach happened at a firm that almost certainly believed it had documented, authenticated infrastructure. The gap wasn't a lack of policy; it was a lack of verification that the policy was actually being followed everywhere.
Treat MCP endpoints with at least the same rigor as any other production API — the protocol is new enough that most security teams haven't yet built the same default controls and monitoring around it that conventional APIs already have.
Parameterize every database query — no string concatenation, ever — the specific flaw at McKinsey has had a well-known, standard fix for over two decades. This isn't a novel AI-era problem requiring a novel AI-era solution.
Store system prompts and operational configuration separately from user data — with stricter write controls and real change-logging, so a data-layer breach doesn't automatically become a model-behavior breach too.
Monitor for the behavioral signature of reconnaissance, not just known exploits — repeated error-generating requests, sequential ID enumeration, and unusual endpoint access patterns are detectable before an attack chain completes, not just after.
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.
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.