# What Happened?
On August 27, Wiz, a cloud security provider, publicly disclosed a series of flaws in Azure’s database service, Cosmos DB, that enables any user to download, remove or change company databases without any other credentials.
The flaw was found in Jupyter Notebook, an open-source visualization tool often used for statistical modeling, machine learning, and data cleaning. Although the tool has been available in Cosmos since 2019, Microsoft enabled it by default for Cosmos in February 2021.
To [gain access to the Cosmos database](https://www.wiz.io/blog/chaosdb-how-we-hacked-thousands-of-azure-customers-databases), Wiz researchers first accessed customers’ Cosmos primary keys, which enable full read, write and delete access to customer data. The notebook container allowed for privilege escalation into other customers’ notebooks, according to Wiz.
Wiz researchers discovered the vulnerability, which they named ChaosDB, on August 9 and informed Microsoft on August 12. Microsoft disabled the buggy Jupyter Notebook feature on August 14. The vulnerability has not been exploited in the wild, and no customer data was affected, according to Microsoft.
However, Microsoft’s recent track record for effectively communicating about its vulnerabilities [has been suspect](https://www.securityweek.com/windows-admins-scrambling-contain-printnightmare-flaw-exposure), according to various security experts. Microsoft caused confusion during July’s PrintNightmare incident when it first misdiagnosed the severity of the bug, only to update the documentation later on with confirmation that the vulnerability was a remote code execution.
According to Wiz, Microsoft only warned 30% of its customers about the vulnerability. The actual number of customers affected by ChaosDB is higher, Wiz researchers claimed.
# How Bad is This?
Wiz CTO Ami Luttwak, who was previously CTO of Microsoft’s Cloud Security Group, [called ChaosDB](https://www.theverge.com/2021/8/27/22644161/microsoft-azure-database-vulnerabilty-chaosdb) “the worst cloud vulnerability you can imagine.” The flaw left customers’ Cosmos DB databases exposed for the last two years.
If someone other than Wiz had found the same flaw between February 2021 and now and was able to find and enumerate a company’s Cosmos DB, there would have been far more risk.
However, the flaw was mitigated when Microsoft disabled the buggy Juptyer Notebook feature, according to Wiz.
# What Should I Do?
Microsoft advises all Cosmos DB customers to [regenerate their primary keys](https://docs.microsoft.com/en-us/azure/cosmos-db/secure-access-to-data?tabs=using-primary-key#primary-keys), a task that Microsoft cannot complete on their customers’ behalf.
The company also [provided several other steps](https://www.bleepingcomputer.com/news/microsoft/microsoft-warns-azure-customers-of-critical-cosmos-db-vulnerability/) to secure Cosmos DB:
* *As a standard security best practice, consider using the Azure Cosmos DB firewall and virtual network integration to control the access to your accounts at the network level.*
* *If you are using the Azure Cosmos DB Core (SQL) API, consider using the Azure Cosmos DB role-based access control (RBAC) to authenticate your database operations with Azure Active Directory instead of primary/secondary keys. With RBAC, you have the option to completely disable your account’s primary/secondary keys.*
* *For a complete overview of the security controls available on Azure Cosmos DB, refer to our security baseline.*
Cloud customers should be aware of the inherent risks involved with allowing a vendor to store customer data. [Cloud services aren’t assigned CVEs](https://www.infoq.com/news/2021/08/cve-cloud-vulnerabilities/), so flaws like ChaosDB get silently patched. A customer may or may not get notified about their exposure because it is up to the vendor to decide whether to perform secure auditing or pentesting.
Security experts, [including those at Wiz](https://www.darkreading.com/cloud/researchers-call-for-cve-approach-for-cloud-vulnerabilities/d/d-id/1341594), believe that there should be an industry initiative to develop a CVE repository for cloud services.
# How To Detect
Organizations running cloud services should have monitoring capabilities in place to avoid exposure to flaws like ChaosDB. As Wiz notes in their latest update a number of the actions involved in this are not logged out without additional efforts, [such as the last time a key was regenerated](https://www.wiz.io/blog/protecting-your-environment-from-chaosdb). However, there are a number of opportunities for monitoring to ensure your data is audited and properly secure.
IT and security teams should be able to monitor:
* Azure Access to IAM and other administrative actions
* Azure Cosmos DB Access via Role Base Access by enabling [Diagnostic Logs](https://docs.microsoft.com/en-us/azure/cosmos-db/monitor-cosmos-db-reference)
* Malicious access to other systems like Office 365 and Azure AD where these accounts may have roles that can impact your cloud infrastructure
*Note: This was originally* [*published on Blumira’s blog*](https://www.blumira.com/microsoft-azure-chaosdb/)*.*