Threat reportVulnerabilityTL-2026-1784
CosmosEscape: Platform-Wide Cosmos Master Key Exposure via Gremlin API Sandbox Escape in Azure Cosmos DB
Wiz Research discovered CosmosEscape, an unpatched vulnerability chain in Azure Cosmos DB's custom Gremlin query engine that let any standard Cosmos DB account holder abuse .NET reflection to escape the query sandbox, achieve arbitrary code execution on the multi-tenant DB Gateway, and retrieve the platform-wide 'Cosmos Master Key' — a signing secret capable of pulling the primary key for any customer account across every tenant, region, and API surface (SQL, MongoDB, Cassandra, Gremlin).
Key facts
| Identifiers | TL-2026-1784 |
|---|---|
| Also known as | CosmosEscape |
| Severity | CRITICAL |
| Affected products | Microsoft Azure Cosmos DB — Gremlin API; Microsoft Azure Cosmos DB — SQL (Core) API; Microsoft Azure Cosmos DB — MongoDB API; Microsoft Azure Cosmos DB — Cassandra API; Microsoft Azure Cosmos DB — DB Gateway (Service Fabric multi-tenant component); Microsoft Microsoft Entra ID (Cosmos DB-backed data store); Microsoft Microsoft Teams (Cosmos DB-backed message storage); Microsoft Microsoft Copilot (Cosmos DB-backed conversation history) |
| Weaknesses (CWE) | CWE-470, CWE-284, CWE-668, CWE-522 |
| Tools | Atlas (Wiz AI Vulnerability Researcher, early version) |
| MITRE ATT&CK techniques | T1059 Command and Scripting Interpreter, T1078.004 Cloud Accounts, T1098 Account Manipulation, T1190 Exploit Public-Facing Application, T1210 Exploitation of Remote Services, T1213 Data from Information Repositories, T1485 Data Destruction, T1526 Cloud Service Discovery, T1528 Steal Application Access Token, T1530 Data from Cloud Storage, T1548 Abuse Elevation Control Mechanism, T1552 Unsecured Credentials and 4 more in the attack flow |
| Motivation | UNKNOWN |
| Target sectors | technology, government administration, financial-services, health, cloud-service-providers, enterprise-saas, telecoms, critical-infrastructure |
| Target regions | Global |
| Detection rules | 9 (1 shown free) |
| Sources | 11 cited sources |
Detection coverage
As of 2026-07-31, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-1784 across Splunk SPL, Microsoft KQL and Sigma, covering 16 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.
Free detection: Cross-Tenant Cosmos DB Data-Plane Access Fan-Out (SPL)
Detects a single client identity/IP issuing data-plane requests against three or more distinct Cosmos DB accounts within a 15-minute window — the lateral-movement pattern CosmosEscape enabled once a stolen master key produced valid primary keys for many tenants, mirroring the researchers' tenant-ID-filtered Config Store enumeration followed by data-plane access with the harvested keys.
- Languages: Splunk SPL, Microsoft KQL, Sigma
- ATT&CK: T1580, T1526, T1213, T1530, T1210
- Data sources: azure_cosmosdb_diagnostic_logs, dataplanerequests, azure_monitor_logs
- Severity: critical
- Confidence: medium
Splunk SPL
index=azure sourcetype="azure:cosmosdb:dataplanerequests" category=DataPlaneRequests
| bin _time span=15m
| stats dc(databaseAccountName) as distinct_accounts values(databaseAccountName) as accounts count by clientIpAddress, userAgent, _time
| where distinct_accounts >= 3
| sort - distinct_accountsMicrosoft KQL
CDBDataPlaneRequests
| where TimeGenerated > ago(24h)
| summarize DistinctAccounts=dcount(DatabaseAccountName), Accounts=make_set(DatabaseAccountName), Requests=count() by ClientIpAddress, UserAgent, bin(TimeGenerated, 15m)
| where DistinctAccounts >= 3
| order by DistinctAccounts descSigma
title: Cross-Tenant Azure Cosmos DB Data-Plane Access Fan-Out (Config-Store-Style Enumeration)
id: 3d8b5e71-4f2a-4d6c-9b8e-1a7c5f9e2d64
status: experimental
description: Detects a single client identity/IP issuing data-plane requests against 3+ distinct Cosmos DB accounts within a 15-minute window, consistent with cross-tenant enumeration and lateral use of primary keys retrieved via an unscoped master-key-style credential, mirroring CosmosEscape's tenant-ID-filtered Config Store enumeration.
references:
- https://www.wiz.io/blog/cosmosescape-taking-over-every-database-in-azure-cosmos-db
author: Threadlinqs Team
date: 2026-07-31
tags:
- attack.discovery
- attack.t1580
- attack.t1526
- attack.collection
- attack.t1213
- attack.t1530
- attack.lateral-movement
- attack.t1210
logsource:
category: application
product: azure
service: cosmosdb
detection:
selection:
EventID: 'DataPlaneRequests'
timeframe: 15m
condition: selection | count(DatabaseAccountName) by ClientIpAddress > 2
falsepositives:
- Legitimate multi-tenant SaaS platforms, MSPs, or backup/DR/monitoring tooling that intentionally access many Cosmos DB accounts from a shared service identity or IP
level: highKnown false positives:
- Legitimate multi-tenant SaaS platforms, MSPs, or backup/DR/monitoring tooling that intentionally access many Cosmos DB accounts from a shared service identity or IP
- Centralized CI/CD or data-pipeline services performing scheduled bulk reads/writes across multiple environment-specific Cosmos accounts
Tuning notes: Adjust the distinct-account threshold (default 3 in 15 minutes) and time window to your environment's normal cross-account access patterns; allowlist known MSP/multi-tenant service identities; correlate with prior listKeys/regenerateKey activity (SPL/KQL/Sigma-002) to prioritize alerts where key theft preceded the fan-out.
- CosmosEscape-Style .NET Reflection Abuse in Gremlin Query (KQL) · unlock with TL Creds
- Mass Cosmos DB Primary-Key Retrieval Across Multiple Accounts (KQL) · unlock with TL Creds
- Cross-Tenant Cosmos DB Data-Plane Access Fan-Out (KQL) · unlock with TL Creds
- CosmosEscape-Style .NET Reflection Abuse in Gremlin Query (Sigma) · unlock with TL Creds
- Mass Cosmos DB Primary-Key Retrieval Across Multiple Accounts (Sigma) · unlock with TL Creds
- Cross-Tenant Cosmos DB Data-Plane Access Fan-Out (Sigma) · unlock with TL Creds
- CosmosEscape-Style .NET Reflection Abuse in Gremlin Query (SPL) · unlock with TL Creds
- Mass Cosmos DB Primary-Key Retrieval Across Multiple Accounts (SPL) · unlock with TL Creds
Indicators of compromise
As of 2026-07-31, Threadlinqs Intelligence tracks 16 indicators of compromise for TL-2026-1784.
Technical analysis
Microsoft deployed a hotfix within 48 hours of Wiz's November 20, 2025 report and completed a full architectural remediation eliminating the master key by July 2026; Microsoft found no evidence of malicious exploitation.
CosmosEscape is a multi-stage vulnerability chain in Microsoft Azure Cosmos DB, reported by Wiz Research (with early assistance from Wiz's in-development AI vulnerability-research tool, 'Atlas') and disclosed publicly on July 30, 2026, with a full technical breakdown scheduled for a Black Hat USA 2026 briefing titled 'One Key to Rule Them All: Taking Over a Flagship Cloud Service.'
The chain began when researchers noticed an unusual .NET exception while experimenting with Cosmos DB's Gremlin graph-query API. That exception revealed that, unlike a standard JVM-based Apache TinkerPop Gremlin implementation, Cosmos DB runs a custom engine that translates Gremlin graph queries directly into executable .NET code inside a restricted sandbox. The sandbox's restrictions did not adequately account for .NET reflection — a runtime feature that lets code inspect and invoke other code — and researchers used reflection-based primitives to build file-read, file-write, and ultimately arbitrary code execution capability, purely through crafted Gremlin queries issued against a database the researchers themselves owned. As proof, they executed the `hostname` command directly on the backend.
The code execution landed on the DB Gateway, a multi-tenant service built on Azure Service Fabric that brokers and authenticates every customer query regardless of which API (SQL, MongoDB, Cassandra, or Gremlin) issued it. From that foothold, researchers found the DB Gateway held a platform-wide signing key — the 'Cosmos Master Key' — that was not scoped to any single account, tenant, region, or API type. Presenting that key to Cosmos DB's control plane returned the primary key of any target account, granting full administrative, cross-tenant, data-plane read/write access — including the ability to read, modify, or delete customer data.
A second discovery compounded the impact: Cosmos DB's Config Store, the regional directory of account metadata (account names, subscription IDs, tenant IDs, network configuration, and tags), is itself implemented as a Cosmos DB SQL-API database. Using the same code-execution foothold, researchers could query the Config Store with full SQL flexibility, filtering by tenant ID to precisely enumerate and target specific organizations at platform scale. Because the compromised DB Gateway is also the component responsible for enforcing network isolation, private and network-restricted Cosmos DB accounts were not protected from this path, and Config Store write access created a theoretical route to durably weaken an account's network isolation settings.
Microsoft's Entra ID, Microsoft Teams, and Microsoft Copilot all store data in Cosmos DB, meaning the exposure chain had a plausible blast radius reaching well beyond direct Cosmos DB customers into core Microsoft 365 identity, messaging, and AI-assistant data. Wiz reported the issue to Microsoft on November 20, 2025; Microsoft acknowledged the same day and deployed a hotfix blocking the vulnerable Gremlin entry point within 48 hours (November 22, 2025). Microsoft then completed a longer-term architectural fix — eliminating the platform-wide Cosmos Master Key entirely and hardening service-to-service authentication — across all Azure regions by July 2026. Microsoft's review of access logs found no evidence of exploitation beyond Wiz's own authorized testing, and stated no customer data was accessed. No CVE identifier or CVSS score has been assigned. CosmosEscape is technically distinct from, but part of the same lineage as, two earlier Cosmos DB flaws: ChaosDB (2021) and CosMiss (2022), both of which involved the Jupyter Notebook feature rather than the Gremlin query engine.
MITRE ATT&CK techniques by tactic:
Execution
T1059 Command and Scripting Interpreter
stealth
Persistence
Initial Access
T1190 Exploit Public-Facing Application
Lateral Movement
T1210 Exploitation of Remote Services
Collection
T1213 Data from Information Repositories; T1530 Data from Cloud Storage
Impact
T1485 Data Destruction; T1565.001 Stored Data Manipulation
Discovery
T1526 Cloud Service Discovery; T1580 Cloud Infrastructure Discovery
Credential Access
T1528 Steal Application Access Token; T1552 Unsecured Credentials
Privilege Escalation
T1548 Abuse Elevation Control Mechanism; T1611 Escape to Host
Reconnaissance
T1595.002 Vulnerability Scanning
privilege-escalation
Remediation
Patches
- Hotfix blocking the vulnerable Gremlin API entry point (Microsoft, November 22, 2025)
- Full architectural fix rolled out across all Azure regions (Microsoft, completed July 2026)
Immediate actions
- Microsoft-deployed hotfix blocking the vulnerable Gremlin API entry point (live November 22, 2025, within 48 hours of report)
- Cosmos Master Key fully eliminated from the platform architecture — no platform-wide signing key remains
- No customer-side action required per Microsoft; fix is entirely server-side and platform-managed
Workarounds
- None required or available on the customer side; Microsoft confirmed the vulnerability is fully remediated platform-side with no residual customer exposure
Longer-term hardening
- Architectural migration of Cosmos DB's key-retrieval model away from any platform-wide/unscoped signing secret
- Hardened service-to-service authentication between the DB Gateway and backend control-plane services
- Additional network protections, monitoring, and detection capabilities deployed across all Azure Cosmos DB regions
- Restrictions tightening how Gremlin query translation exposes .NET reflection primitives to prevent recurrence of the sandbox-escape class of bug
Affected and fixed versions
- Microsoft — Azure Cosmos DB — Gremlin API
Vulnerable versions: All Cosmos DB accounts reachable via the Gremlin API prior to the November 22, 2025 hotfix
Fixed in: Post-November 22, 2025 hotfix; fully remediated platform-wide by the July 2026 architectural fix - Microsoft — Azure Cosmos DB — SQL (Core) API
Vulnerable versions: Any account whose primary key could be retrieved via the exposed Cosmos Master Key prior to remediation
Fixed in: Fully remediated by the July 2026 architectural fix (Cosmos Master Key eliminated) - Microsoft — Azure Cosmos DB — MongoDB API
Vulnerable versions: Any account whose primary key could be retrieved via the exposed Cosmos Master Key prior to remediation
Fixed in: Fully remediated by the July 2026 architectural fix (Cosmos Master Key eliminated) - Microsoft — Azure Cosmos DB — Cassandra API
Vulnerable versions: Any account whose primary key could be retrieved via the exposed Cosmos Master Key prior to remediation
Fixed in: Fully remediated by the July 2026 architectural fix (Cosmos Master Key eliminated) - Microsoft — Azure Cosmos DB — DB Gateway (Service Fabric multi-tenant component)
Vulnerable versions: DB Gateway builds prior to the November 22, 2025 hotfix
Fixed in: Hardened DB Gateway with scoped, service-to-service authenticated key retrieval post-July 2026 - Microsoft — Microsoft Entra ID (Cosmos DB-backed data store)
Vulnerable versions: Indirectly exposed via shared Cosmos DB backend prior to remediation
Fixed in: Protected as of the completed Cosmos DB architectural fix - Microsoft — Microsoft Teams (Cosmos DB-backed message storage)
Vulnerable versions: Indirectly exposed via shared Cosmos DB backend prior to remediation
Fixed in: Protected as of the completed Cosmos DB architectural fix - Microsoft — Microsoft Copilot (Cosmos DB-backed conversation history)
Vulnerable versions: Indirectly exposed via shared Cosmos DB backend prior to remediation
Fixed in: Protected as of the completed Cosmos DB architectural fix
Timeline
- Wiz Research discovers ChaosDB, an earlier Cosmos DB vulnerability chain in the Jupyter Notebook feature (distinct attack surface from Gremlin, but the same broad vulnerability lineage as CosmosEscape).
- Wiz Research reports ChaosDB to Microsoft.
- Microsoft disables the vulnerable Jupyter Notebook feature underlying ChaosDB as an interim mitigation.
- Wiz Research and Microsoft publicly disclose ChaosDB, the first in the lineage of Cosmos DB platform-wide credential-exposure vulnerabilities that CosmosEscape continues.
- The CosMiss vulnerability — missing authentication on Cosmos DB's Jupyter Notebook workspace forwarding IDs, also part of the same Cosmos DB vulnerability lineage — is introduced, per Orca Security's later root-cause analysis.
- Orca Security reports the CosMiss vulnerability to Microsoft.
- Microsoft fixes the CosMiss flaw worldwide within two days of Orca Security's report.
- Orca Security publicly discloses full technical details of CosMiss.
- Microsoft acknowledges receipt of Wiz's report the same day.
- Wiz Research reports the CosmosEscape vulnerability chain to Microsoft.
- Microsoft begins the longer-term architectural remediation work to eliminate the platform-wide Cosmos Master Key.
- Microsoft deploys a hotfix blocking the vulnerable Gremlin API entry point, within 48 hours of the initial report.
- Microsoft completes the full architectural fix across all Azure regions; the Cosmos Master Key no longer exists in Cosmos DB's architecture.
- Wiz Research publicly discloses CosmosEscape via its research blog; coverage follows from The Hacker News, GBHackers, Hackread, TechTimes, SC Media, and CyberSecurityNews.
- Wiz Research is scheduled to present the full exploit chain, including the crafted Gremlin query that initiated the sandbox escape, at Black Hat USA 2026 in a briefing titled 'One Key to Rule Them All: Taking Over a Flagship Cloud Service.'
Sources cited
- CosmosEscape: Taking Over Every Database in Azure Cosmos DB Wiz · Vendor report · 2026-07-30
- Critical Vulnerability in Microsoft Azure Cosmos DB Opens Up Jupyter Notebooks (ChaosDB, related prior Cosmos DB flaw) Dark Reading · Research · 2021-08-27
- ChaosDB Explained: Azure's Cosmos DB Vulnerability Walkthrough Wiz · Research · 2021-08-26
- CosMiss: Azure Cosmos DB Vulnerability orca.security · Research · 2022-11-01
- CosmosEscape Vulnerability gbhackers.com · News · 2026-07-31
- Azure Cosmos DB Flaw Exposed Platform-Wide Key That Could Access Any Database The Hacker News · News · 2026-07-30
- Microsoft Fixes CosmosEscape Flaw That Could Allow Any Cosmos DB Takeover hackread.com · News · 2026-07-30
- CosmosEscape: Wiz Research Breached Azure Cosmos DB Gateway, Extracted Key to Every Database techtimes.com · News · 2026-07-30
- Critical Azure Cosmos DB flaw risked cross-tenant compromise scworld.com · News · 2026-07-30
- New CosmosEscape Vulnerability Lets Attackers Take Over Azure Cosmos DB Instances cybersecuritynews.com · News · 2026-07-30
- Researchers Disclose Details of Critical 'CosMiss' RCE Flaw Affecting Azure Cosmos DB The Hacker News · News · 2022-11-01
Previous and next in vulnerability
- Multiple Vulnerabilities in PHP (GovCERT.HK A26-07-52): Phar Symlink DoS, Bundled-libgd GIF Memory Corruption, pgsql SQL Injection, and BCMath Out-of-Bounds Write (CVE-2026-7260, CVE-2026-9672, CVE-2026-17543, CVE-2026-17544) Previous report
- ShutterGap: Ephemeral Public Exposure of AWS RDS/DocumentDB Snapshots, AMIs & SSM Documents Evades CSPM/CNAPP Scan Cycles Next report
AI-drafted from 11 cited sources; published ; last updated —.