Critical Flaw Led to Azure Cosmos DB Pwnage
Critical CosmosEscape vulnerability in Azure Cosmos DB allowed full read/write access to all databases.
Summary
A critical vulnerability dubbed CosmosEscape in Azure Cosmos DB could have allowed attackers to obtain a platform-wide master key, granting full read and write access to any Cosmos DB account. The flaw, exploitable via the Gremlin API, could have exposed Microsoft's internal databases as well as customer data. Wiz researchers discovered the vulnerability and reported it to Microsoft, which deployed a hotfix within two days and a long-term fix later.
Full text
A critical vulnerability in the Azure Cosmos DB database service could have allowed attackers to compromise all databases on the service, cybersecurity outfit Wiz reports. Referred to as CosmosEscape, the security defect could have allowed an attacker to obtain a platform-wide key and retrieve the primary key of any Cosmos DB account, gaining full read and write access across the service. Armed with the key, an attacker could have listed all databases on the service, filtering them by specific organization identifiers, such as subscription and tenant IDs. “Chained together, these capabilities could have enabled precision targeting at platform scale: from identifying a specific organization’s databases to compromising them, all from publicly accessible endpoints,” Wiz says. According to the cybersecurity firm, because Microsoft uses Cosmos DB to store data across Entra ID, Teams, and Copilot, the vulnerability potentially exposed the tech giant’s databases to unauthorized access. The issue could have been exploited through the Gremlin API, a popular graph query language that relies on a custom Gremlin engine, compiling queries into .NET code that was executed in a sandbox.Advertisement. Scroll to continue reading. Pwning the sandbox While the engine enforced restrictions to prevent access beyond Gremlin operations, it did not account for .NET reflection, which Wiz used to build arbitrary code execution primitives. “By bypassing the Gremlin sandbox, we’ve gained code execution on the DB Gateway, a service that executes customer queries on their behalf, running on multi-tenant Service Fabric clusters,” Wiz explains. The cybersecurity firm then discovered that the gateway was using a signing key to retrieve customer accounts’ primary keys and access their databases, and that the signing key worked across tenants, regions, and even APIs. “It was a platform-wide key that could retrieve the primary key for any Cosmos DB account on the service, all through publicly accessible endpoints. We dubbed it the Cosmos Master Key,” Wiz notes. Through the master key, the cybersecurity firm’s researchers could access a configuration store containing details on every Cosmos DB account, including names, subscription IDs, tenant IDs, and various other configuration data. Pwning the databases “The Config Store was itself a Cosmos DB database, meaning it could be queried with the full flexibility of CosmosDB’s SQL engine. It also meant that the Cosmos Master Key could retrieve its primary key – enabling attackers that exploited CosmosEscape to list all accounts in a region, or query by specific tenant ID to identify a specific organization’s databases,” the company explains. An attacker with the master key and access to the configuration store could enumerate all Cosmos DB accounts, filter them, and retrieve a target’s primary key to gain full read and write access to all their databases. According to Wiz, the attack could also be mounted against private and network-isolated Cosmos DB accounts, as well as Microsoft’s own databases. Wiz reported the vulnerability to Microsoft in November 2025. Within two days, Microsoft deployed a hotfix to block the attack vector. In July, the tech giant completed the rollout of a long-term architectural fix across all regions. “Microsoft conducted extensive reviews of access logs and found no evidence of unauthorized activity outside of the researcher’s testing activity, and no customer data was accessed. There is no customer action required,” the company said. Related: Critical Code Execution Vulnerability Patched in TeamCity Related: JFrog Zero-Days Exploited in OpenAI-Hugging Face Hack Related: Apple Patches 87 Vulnerabilities in iOS, 155 in macOS Tahoe Related: Critical Arista VeloCloud Orchestrator Vulnerability Exploited as Zero-Day Written By Ionut Arghire Ionut Arghire is an international correspondent for SecurityWeek. Daily Briefing Newsletter Subscribe to the SecurityWeek Email Briefing for the latest cybersecurity threats, trends, and expert insights. More from Ionut Arghire Discern Security Raises $13 Million in Series A FundingCantina Emerges From Stealth With $8 Million in FundingCritical Ruflo Flaw Lets Attackers Spawn Rogue AI Swarms US and Allies Update SBOM GuidanceChrome 151 Patches 370 VulnerabilitiesMate Security Raises $35 Million for Agentic SOCUS, Australia Release OT Isolation Guidance for Critical Infrastructure Spur Raises $200 Million for IP Intelligence Platform Latest News Prompted by OpenAI Disclosure, Anthropic Finds Its Own Models Hacked 3 OrganizationsCareCloud Data Breach Impacts Over 350,000Critical Code Execution Vulnerability Patched in TeamCity CISA Urges Water Sector to Protect OT After Coordinated Attacks on PLCsBank of America to Acquire Cybersecurity Firm MDSecOkta to Acquire Identity Threat Detection Firm PermisoTimeless Compliance: Why Better Questions Beat Bigger FrameworksDataBahn Raises $40 Million for Agentic Data Pipeline Management Trending Daily Briefing NewsletterSubscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts. Webinar: Rethinking Cyber Defense for AI-Speed Attacks August 18, 2026 Join this live webinar as we explore if detection-first security operations can keep pace with AI, or if it’s time to rethink prevention as the strongest default. Register Virtual Event: CodeSecCon 2026 August 19, 2026 CodeSecCon bridges the gap between dev and security. Discover best practices for secure coding, innovative risk-reduction tools, and safe AI integration to cultivate a true DevSecOps culture. Safely secure your apps! Register People on the MoveAlex Levinson has been named Executive Director at the National Collegiate Cyber Defense Competition.Hack The Box has appointed Konstantinos Dolkas as CTO and has promoted Christine Bartlett to CMO.The Department of Energy has appointed Andrew McClure as Director of the Office of Cybersecurity, Energy Security, and Emergency Response (CESER).More People On The MoveExpert Insights Timeless Compliance: Why Better Questions Beat Bigger Frameworks The best compliance programs aren't the biggest ones. They're the ones built on a short list of questions that can actually be answered, and that still hold true when the models change. (Matt Honea) Is Patching Dead? Vulnerability Management in the Post-Mythos Era You cannot out-patch a machine that writes a working exploit from a vulnerability description in twenty hours. Stop trying to optimize a game you cannot win. (Danelle Au) When Identity Verification Fails: Lessons from a Real-World SIM Swap and Near Account Takeover Identity confidence changes throughout every interaction and should be reassessed continuously as new risk signals emerge. (Torsten George) Legacy Systems, Real-World Impacts: The Reality of OT Security Legacy systems, safety concerns, and critical infrastructure risks make OT vulnerability disclosure one of cybersecurity's most challenging balancing acts. (Tod Beardsley) The Shift Toward Business-Aligned Risk Management Moving from isolated, technical data to a continuous risk lifecycle can help organizations align security controls with actual business consequences. (Steve Durbin) Flipboard Reddit Whatsapp Whatsapp Email