CosmosEscape flaw could have exposed every Azure Cosmos DB account

Summary
Wiz researchers found that a Gremlin sandbox flaw in Azure Cosmos DB could enable code execution and cross-tenant access to databases. Microsoft says it fully remediated the issue and found no evidence of exploitation beyond the research.
Key points
- A flaw in Cosmos DB’s Gremlin query sandbox allowed researchers to use .NET reflection to achieve code execution on the database gateway.
- Credentials available to the gateway exposed a platform-wide signing key that could retrieve primary keys for Cosmos DB accounts across tenants, regions, and API types.
- The key also enabled access to a regional account registry, which could be queried to enumerate accounts or identify organizations by tenant or subscription ID.
- The attack chain could have enabled full read-write access to targeted customer databases, including private or network-isolated accounts, and potentially exposed Microsoft internal databases.
- Microsoft deployed an initial mitigation within 48 hours and completed the long-term fix across all regions in July 2026; it says no customer action is required.
- Microsoft reported no evidence of unauthorized activity beyond the researchers’ testing and said no customer data was accessed.
Article Details
- Attack Vectors
- A specially crafted Gremlin query exploited insufficient sandbox restrictions around .NET reflection, enabling file read, file write, and arbitrary code execution on the Cosmos DB DB Gateway.
- Credentials available on the DB Gateway cluster enabled access to a signing key that could retrieve primary keys across Cosmos DB accounts and tenants.
- The Cosmos Master Key could access the Config Store, enabling enumeration of accounts and identification of databases by tenant or subscription ID; retrieved primary keys could then provide read and write access to those databases.
- Compromising the DB Gateway could bypass network isolation and enable access to private Cosmos DB accounts.
- Defensive Notes
- Microsoft deployed a mitigation for the Gremlin API entry point, eliminated the Cosmos Master Key, and completed a long-term architectural fix across all regions.
- Microsoft strengthened service-to-service authentication and added network protections, monitoring, and detection capabilities.
- Microsoft reported finding no evidence of unauthorized exploitation beyond the researchers’ testing and stated that no customer data was accessed; no customer action was required.
MITRE ATT&CK
People
Hillai Ben-SassonWiz Research team member involved in the CosmosEscape research.Nir OhfeldWiz Research team member involved in the CosmosEscape research.Noam MalronWiz Research team member involved in the CosmosEscape research.Ronen ShustinWiz Research team member involved in the CosmosEscape research.Sagi TzadikWiz Research team member involved in the CosmosEscape research.Yuval AvrahamiWiz Research team member involved in the CosmosEscape research.
Vendors
Products
Azure Cosmos DBWiz Research uncovered CosmosEscape, a critical vulnerability in Azure’s flagship database service, Azure Cosmos DB, via its Gremlin API. The vulnerability could have been exploited to compromise every database in theMicrosoft CopilotCosmos DB is used internally across Microsoft - services like Microsoft Entra ID, Microsoft Teams, and Microsoft Copilot all store data in Cosmos DB. Their databases were potentially accessible via this vulnerability.Microsoft Entra IDCosmos DB is used internally across Microsoft - services like Microsoft Entra ID, Microsoft Teams, and Microsoft Copilot all store data in Cosmos DB. Their databases were potentially accessible via this vulnerability.Microsoft TeamsCosmos DB is used internally across Microsoft - services like Microsoft Entra ID, Microsoft Teams, and Microsoft Copilot all store data in Cosmos DB. Their databases were potentially accessible via this vulnerability.Service Fabricon the DB Gateway, a service that executes customer queries on their behalf, running on multi-tenant Service Fabric clusters.