Wiz Found a Master Key to Every Azure Cosmos DB, and Microsoft Fixed It Quietly
Cybersecurity

Wiz Found a Master Key to Every Azure Cosmos DB, and Microsoft Fixed It Quietly

A sandbox escape in Cosmos DB's Gremlin engine let Wiz researchers extract a platform-wide signing key that could retrieve the primary key of any Cosmos DB account across every tenant and region, reaching services as central as Entra ID, Teams, and Copilot.

PublishedAugust 2, 2026
Read time5 min read
Share

What Wiz found

Wiz Research disclosed CosmosEscape on July 30, a vulnerability chain in Azure Cosmos DB that began with the service's Gremlin graph API. Cosmos DB runs a custom Gremlin engine that compiles graph queries into .NET code, and the sandbox around that compilation was not tight enough. Using .NET reflection, the researchers broke out of the intended boundary and achieved arbitrary code execution on the DB Gateway, a component shared across every tenant on the service.

Code execution on a multi-tenant gateway is already serious. What made this a platform-level event was what the gateway could reach. From there the researchers recovered a signing key the DB Gateway used to obtain primary keys for customer accounts. That single key worked across all tenants, all regions, and every API flavor Cosmos DB exposes, including SQL, MongoDB, Cassandra, and Gremlin. Wiz named it the Cosmos Master Key, and the name is accurate.

What the master key unlocked

The key granted two capabilities that together describe a worst case for a managed database. The first is takeover: with the signing key, an attacker could request the primary key of any Cosmos DB account on demand, and a primary key in Cosmos DB confers full read and write access to that account's data. The second is enumeration: by querying the service's internal account directory, an attacker could list accounts and filter them by subscription or tenant ID.

Enumeration is what elevates this from a broad flaw to a precision weapon. A general ability to read arbitrary databases is dangerous, but the ability to first locate a specific victim's accounts and then extract their keys is how a real intrusion would proceed. An attacker who wanted a named enterprise's data could find its Cosmos DB accounts by tenant ID and pull the keys, all through publicly reachable endpoints and without ever authenticating as that customer.

The blast radius reached Microsoft itself

Cosmos DB is not a niche product. It is foundational infrastructure that underpins several of Microsoft's own flagship services, including Entra ID, Teams, and Copilot. Because the master key ignored tenant boundaries, the exposure extended past ordinary Azure customers and into the backends of the services that millions of organizations depend on for identity, collaboration, and increasingly for AI. Wiz framed the structural risk directly, noting that a vulnerability at this layer can cascade upward and threaten the services built on top of it.

That framing is the part enterprise leaders should sit with. When the identity provider and the AI assistant share the same underlying database platform, a single infrastructure flaw does not stay contained to one product. The interconnection that makes a cloud platform convenient is the same interconnection that lets one broken sandbox threaten the whole stack. This is the systemic risk of concentration, and it is not unique to Microsoft.

Credit for the response, questions about the model

Microsoft's handling deserves credit. Wiz reported the issue on November 20, 2025, and within 48 hours Microsoft had deployed a hotfix that blocked the vulnerable Gremlin entry point. The permanent architectural fix rolled out across all regions and completed by July 2026, and Microsoft says it found no evidence of exploitation beyond the researchers' own testing. No customer action is required, which is the outcome a shared-responsibility model is supposed to deliver for platform-layer flaws.

The harder question sits with the authentication model rather than the response. CosmosEscape worked because Cosmos DB still leans on long-lived primary keys, static secrets that grant total access to an account and that a compromised gateway could hand out. Microsoft has offered Entra ID role-based access control for Cosmos DB for years precisely to move away from this pattern. This incident is the argument for adopting it, so that account access depends on identity and short-lived tokens rather than a standing key that a single upstream bug can leak.

What this changes for the roadmap

There is no patch for customers to apply here, which makes the useful response a governance one. If you run Cosmos DB, treat primary keys as the liability they are. Prefer Entra ID role-based access control, disable local key authentication where the workload allows, and rotate any keys that have been static for a long time. These steps shrink the value of a leaked key and shorten the window in which a stolen one is useful, even though they cannot prevent a platform-layer flaw on their own.

The broader lesson is about how you reason under concentration. When one platform sits beneath your identity, your collaboration, and your AI tooling, its infrastructure security becomes an assumption in every risk assessment you write. Watching the disclosures at that layer, asking vendors pointed questions about tenant isolation, and keeping the option to segment critical data across providers are all part of governing a cloud estate you do not operate yourself. CosmosEscape was caught by researchers. The next one at this layer may not be.

The pattern behind these gateway bugs

CosmosEscape belongs to a family of cloud vulnerabilities that has become depressingly familiar, where a shared control-plane component holds a secret that ignores the very tenant boundaries the platform sells. Wiz and others have documented similar patterns across managed database and analytics services, and the shape rarely changes. A convenience in the architecture, here a single signing key that let the gateway serve every customer, becomes the exact mechanism an attacker needs once code execution lands on that component. The isolation customers assume exists is enforced by software that can be broken.

For technology leaders this is a reason to read cloud vendors' security disclosures as data about their engineering, not as isolated events. A vendor that finds these flaws through a mature bug bounty, fixes the entry point in days, and re-architects the underlying weakness is demonstrating the capability you are actually buying. Microsoft's 48-hour hotfix and multi-month architectural remediation fit that profile. The response is the signal worth tracking, because at this layer you are trusting the provider's process far more than any control you can configure yourself.

Tagged#news#security#cybersecurity#breach#cisa#ransomware#zero-day#supply-chain#ai-security#azure#cosmos-db#cloud-security#wiz#microsoft#multi-tenant#vulnerability