


Perceptive Security
SOC/SIEM Consultancy

Azure Cosmos DB Flaw Exposed Platform-Wide Key That Could Access Any Database
Published:
30 July 2026 at 15:34:09
Alert date:
30 July 2026 at 17:06:28
Source:
thehackernews.com
Cloud & Virtualization, Database & Storage, Zero-Day Vulnerabilities, Identity & Access
A now-patched vulnerability in Azure Cosmos DB, dubbed CosmosEscape by Wiz, allowed attackers to escape the Gremlin query sandbox and gain full read/write access to databases across customer tenants. The exploit chain began with a specially crafted query against an attacker-controlled Gremlin database, leading to code execution. The flaw had the potential to expose a platform-wide key granting access to any customer database. Microsoft has since patched the vulnerability. The research was disclosed by Wiz, highlighting significant cross-tenant isolation risks in managed cloud database services.
Technical details
The vulnerability chain, codenamed 'CosmosEscape' by Wiz, affected Azure Cosmos DB's Gremlin API. The exploit begins with an attacker controlling a Gremlin database account. Azure Cosmos DB's custom Gremlin engine translates Gremlin queries into .NET code and executes them inside a restricted sandbox environment. The sandbox failed to account for .NET reflection, allowing researchers to build file-read and file-write primitives and ultimately achieve arbitrary code execution. Code execution landed on the DB Gateway, a component running customer queries on multi-tenant Azure Service Fabric clusters. From the DB Gateway, attackers could access a platform-wide signing secret dubbed the 'Cosmos Master Key.' This master key could retrieve the primary account key for any Cosmos DB account across all tenants, regions, and APIs (SQL, MongoDB, Cassandra, and Gremlin). The same secret also provided access to a regional 'Config Store' — a directory containing Cosmos DB account names, subscription and tenant identifiers, network settings, and tags — enabling targeted attacks against specific organizations. The exploit could also reach private and network-isolated accounts since the compromised gateway enforced network boundaries from inside the service. Write access to the Config Store also suggested network settings could potentially be modified. Data stored in Cosmos DB including Microsoft Teams messages and Microsoft Copilot conversation histories were potentially accessible. The vulnerability was reported to Microsoft in November 2025; the Gremlin entry point was blocked within 48 hours. The full long-term fix and elimination of the platform-wide key was completed across all regions in July 2026. The complete exploit chain is to be presented at Black Hat USA on August 6.
Mitigation steps:
Microsoft has stated that no customer action is required, as the vulnerable Gremlin entry point was blocked within 48 hours of the November 2025 report and the full platform-wide fix (including elimination of the platform-wide signing key) was completed across all regions in July 2026. Microsoft's review found no unauthorized activity outside the researchers' testing and no customer data was accessed. Organizations using Azure Cosmos DB should monitor Microsoft's official communications for any further guidance. As a general best practice, regularly rotate Cosmos DB account primary keys, apply least-privilege access controls, and monitor account activity logs for anomalous key retrieval or access patterns. Organizations should also review network isolation settings for their Cosmos DB accounts and ensure audit logging is enabled.
Affected products:
Azure Cosmos DB (Gremlin API)
Azure Cosmos DB (SQL API)
Azure Cosmos DB (MongoDB API)
Azure Cosmos DB (Cassandra API)
Azure Service Fabric (multi-tenant DB Gateway clusters)
Microsoft Teams (data stored in Cosmos DB)
Microsoft Copilot (data stored in Cosmos DB)
Related links:
https://www.wiz.io/blog/cosmosescape-taking-over-every-database-in-azure-cosmos-db
https://www.wiz.io/events/wiz-at-black-hat
https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/quickstart-dotnet
https://learn.microsoft.com/en-us/rest/api/cosmos-db/access-control-on-cosmosdb-resources
https://learn.microsoft.com/en-us/purview/edisc-search-teams
https://devblogs.microsoft.com/cosmosdb/how-microsoft-copilot-scales-to-millions-of-users-with-azure-cosmos-db/
https://thehackernews.com/2021/08/critical-cosmos-database-flaw-affected.html
https://thehackernews.com/2022/11/researchers-disclose-details-of.html
Related CVE's:
Related threat actors:
IOC's:
This article was created with the assistance of AI technology by Perceptive.
