cognitive cybersecurity intelligence

News and Analysis

Search

New CosmosEscape Vulnerability Lets Attackers Take Over Azure Cosmos DB Instances

New CosmosEscape Vulnerability Lets Attackers Take Over Azure Cosmos DB Instances

A critical vulnerability, dubbed CosmosEscape, in Microsoft Azure Cosmos DB could have let attackers seize control of virtually every database hosted on the service, including Microsoft’s own internal systems.

The vulnerability resided in Cosmos DB’s Gremlin API and, if exploited, could have enabled a cross-tenant attack affecting millions of customer workloads and Microsoft’s internal infrastructure.

Understanding these structural risks is increasingly vital when evaluating broader cloud platform security across multi-tenant enterprise environments.

New CosmosEscape Vulnerability

Wiz researchers were experimenting with Gremlin, a popular graph query language supported by Cosmos DB, when they noticed an unusual .NET exception.

Since most open-source Gremlin implementations run on the Java Virtual Machine (JVM), this suggested that Cosmos DB used a custom.NET-based Gremlin engine instead.

That distinction mattered because Gremlin servers typically compile queries into executable code and run them inside a restricted sandbox, and such sandboxes have historically proven fragile against determined attackers.

That suspicion paid off. The team discovered that Cosmos DB’s engine translated Gremlin queries into .NET code but failed to adequately restrict .NET reflection, a feature that lets code inspect and manipulate other code at runtime.

By exploiting this gap, researchers built file read, file write, and, eventually, full arbitrary code execution capabilities using nothing more than crafted queries run against their own database.

In a striking proof of concept, a specially designed Gremlin query executed the hostname command directly on Cosmos DB’s backend infrastructure.

Executing hostname on the Cosmos DB

This code execution gave researchers a foothold on the DB Gateway, the multi-tenant component responsible for running customer queries.

While customer databases weren’t stored on the same clusters, the Gateway still needed a way to reach them, and it did so using a signing key capable of retrieving any account’s primary key.

Crucially, this signing key wasn’t scoped to a single customer or region; it worked across tenants, regions, and API formats including SQL, MongoDB, Cassandra, and Gremlin.

Wiz dubbed this powerful secret the Cosmos Master Key. The Master Key also unlocked access to the Config Store, essentially Cosmos DB’s master directory listing every account on the platform along with subscription IDs, tenant IDs, network rules, and tags.

CosmosEscape’s Attack Chain

Because the Config Store was itself a queryable Cosmos DB database, attackers could have used it to enumerate every account in a region or filter results by tenant ID to precisely target a specific organization.

According to analysis published on the Wiz Research Blog, chaining sandbox escapes with unscoped signing keys bypasses fundamental cloud isolation boundaries.

These architectural risks align with broader Microsoft vulnerability trends, in which overprivileged machine accounts and underlying service permissions amplify the potential blast radius of a single flaw.

Chaining these two capabilities together created a devastating attack path: enumerate targets through the Config Store, then use the Master Key to pull their primary key and gain full read-write access to their data.

Because Cosmos DB underpins major Microsoft services such as Microsoft Entra ID, Microsoft Teams, and Microsoft Copilot, the exposure extended well beyond ordinary enterprise customers into Microsoft’s own backend systems.

CosmosEscape’s impact.

Even private, network-isolated databases were at risk, since the compromised DB Gateway itself enforced that isolation.

Evaluating these cross-tenant vectors underscores why security teams must continuously audit for cloud logging threats and unexpected access patterns across critical data stores.

Attack Lifecycle StageExploit MechanismImpact & ScopeGremlin Sandbox EscapeUnrestricted .NET reflection in query translationArbitrary code execution on DB GatewayCredential RetrievalUnscoped DB Gateway signing key extractionAccess to global Cosmos Master KeyTarget DiscoveryQuerying Cosmos DB Config Store directoryEnumeration of all accounts, tenant IDs, and network policiesData CompromisePrimary key generation via DB GatewayFull read-write access across all tenants and regions

Wiz responsibly disclosed CosmosEscape to Microsoft, which deployed a rapid hotfix and has since fully remediated the issue by eliminating the Cosmos Master Key entirely and adding new architectural safeguards.

Microsoft’s investigation found no evidence that the vulnerability was exploited maliciously prior to disclosure, and no action is required from Azure Cosmos DB customers.

 Strengthen Your SOC by Accelerating Threat Detection & Rapid Investigations. -> Integrate ANY.RUN With Your SOC Now.
The post New CosmosEscape Vulnerability Lets Attackers Take Over Azure Cosmos DB Instances appeared first on Cyber Security News.

Source: cybersecuritynews.com –

Subscribe to newsletter

Subscribe to HEAL Security Dispatch for the latest healthcare cybersecurity news and analysis.

More Posts