Critical CosmosEscape Flaw Breaks Customer Isolation in Azure Cosmos DB

A critical vulnerability named CosmosEscape allowed attackers to escape the restricted Gremlin API environment and execute arbitrary code on the DB Gateway component of Azure Cosmos DB. The flaw exploited weaknesses in .NET reflection protections, enabling file read/write operations and command execution that ultimately yielded the Cosmos Master Key. With this global signing key, an attacker could retrieve the primary key for any customer account and gain full read/write access. The exploit also exposed the Config Store containing account names, subscription identifiers, tenant details, and network rules. Even network-isolated and private instances remained vulnerable because the DB Gateway itself enforced those restrictions. Internal Microsoft services including Entra ID, Teams, and Copilot rely on Cosmos DB, amplifying the potential impact of the issue.

BoletimSecTranslated from Portuguese

Read at source

A critical vulnerability dubbed CosmosEscape could have allowed attackers to take control of virtually every instance of Azure Cosmos DB, including Microsoft’s own internal databases. The flaw broke the isolation boundary between different customers on the cloud platform.

The issue resided in the Gremlin API, which is used for graph-oriented database queries. Carefully crafted queries escaped the restricted sandbox and executed code on the infrastructure responsible for processing customer requests. Researchers chained the exploit by abusing limitations in .NET reflection protections.

Once inside the DB Gateway, the attackers developed techniques to read and write files and run arbitrary commands. Successful compromise of the gateway granted access to a global signing secret known as the Cosmos Master Key. This key enabled retrieval of the primary key for any account, providing complete read and write access.

The attack surface also included the Config Store, a directory holding account names, subscription and tenant identifiers, network rules, and other configuration data. Attackers could filter this information to target specific organizations. Even privately isolated instances remained exposed because the DB Gateway itself enforced network restrictions.

Internal Microsoft services such as Microsoft Entra ID, Teams, and Copilot rely on Cosmos DB, underscoring the broad potential reach of the vulnerability.

Meridian digestThe week's most consequential security stories, distilled into one briefing.See the digest

More in Vulnerabilities & Exploits

Telegram for Android Patches Voice Call Vulnerability Enabling Code Execution
Yandex Patches Millions of Stations After eMudhra Certificate Keys Compromised
Cisco ASA and FTD Face DoS Vulnerability in SSL VPN Already Exploited in the Wild