Full Report
A now-patched vulnerability in Azure Cosmos DB could have let an attacker escape the service's Gremlin query sandbox and obtain full read and write access to databases across customer tenants, according to Wiz. Wiz, which codenamed the chain CosmosEscape, said the exploit chain began with a crafted query against a Gremlin database controlled by the attacker. From there, code execution on a
Analysis Summary
The following summary provides a technical overview of the vulnerability chain discovered by Wiz within the Azure Cosmos DB service.
# Vulnerability: CosmosEscape - Azure Cosmos DB Gremlin Sandbox Escape
## CVE Details
- **CVE ID:** None assigned (As noted in the article).
- **CVSS Score:** N/A (Estimated Critical based on cross-tenant full access capabilities).
- **CWE:** CWE-94: Improper Control of Generation of Code ('Code Injection') / CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection').
## Affected Systems
- **Products:** Microsoft Azure Cosmos DB.
- **Versions:** All versions prior to the July 2026 fix.
- **Configurations:** Systems utilizing the Gremlin (Graph) API. However, the resulting impact extended to all Cosmos DB APIs (SQL, MongoDB, Cassandra).
## Vulnerability Description
The vulnerability, dubbed **CosmosEscape**, resided in the custom Gremlin engine used by Cosmos DB. This engine translates Gremlin queries into .NET code for execution within a restricted sandbox. The researchers discovered that the sandbox did not properly restrict **.NET reflection**.
By using reflection, an attacker could bypass intended execution boundaries to create file-read and file-write primitives. This led to arbitrary code execution on the "DB Gateway"—a multi-tenant component running on Azure Service Fabric clusters. Once code execution was achieved, the researchers accessed a platform-wide signing secret ("Cosmos Master Key") and a regional "Config Store" database.
## Exploitation
- **Status:** PoC demonstrated by Wiz; no unauthorized exploitation reported by Microsoft.
- **Complexity:** Medium (Requires knowledge of .NET reflection and Gremlin query structures).
- **Attack Vector:** Network (Authenticated Gremlin API endpoint).
## Impact
- **Confidentiality:** **Total.** Potential read access to all customer databases across all tenants and regions.
- **Integrity:** **Total.** Potential write access to change data or modify network settings in the Config Store.
- **Availability:** **High.** The ability to modify or delete data across the platform.
## Remediation
### Patches
- **Vendor Action:** Microsoft has completed a server-side fix across all Azure regions as of July 2026. This fix included blocking the vulnerable entry point and rotating/eliminating the platform-wide signing key.
- **User Action:** No customer action is required as the fix was applied to the underlying cloud infrastructure.
### Workarounds
- **Note:** Because the platform has been patched by the provider, workarounds are no longer necessary. Historically, disabling the Gremlin API would have mitigated the initial entry point.
## Detection
- **Indicators of Compromise:** Microsoft conducted a log review and reported no signs of unauthorized activity beyond the researchers.
- **Detection Methods:** Users can monitor Azure Activity Logs for unusual access patterns, though the nature of this vulnerability (service-side compromise) makes direct customer-side detection difficult.
## References
- **Wiz Technical Write-up:** hxxps[://]www[.]wiz[.]io/blog/cosmosescape-taking-over-every-database-in-azure-cosmos-db
- **Azure Cosmos DB Connection Guide:** hxxps[://]learn[.]microsoft[.]com/en-us/azure/cosmos-db/gremlin/quickstart-dotnet
- **Black Hat USA Briefing:** hxxps[://]www[.]wiz[.]io/events/wiz-at-black-hat