CosmosEscape flaw could have exposed every Azure Cosmos DB account

· Original article ↗

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

Vendors

Products

Tools

Related Articles