Microsoft has addressed a chain of critical vulnerabilities found in the Azure Database for PostgreSQL Flexible Server that could let malicious users escalate privileges and gain access to other customers’ databases after bypassing authentication.
The Flexible Server deployment option for Azure Database for PostgreSQL gives customers the maximum possible control over their databases, including fine-grained tunning and multiple configuration parameters.
“By exploiting an elevated permissions bug in the Flexible Server authentication process for a replication user, a malicious user could leverage an improperly anchored regular expression to bypass authentication to gain access to other customers’ databases,” the Microsoft Security Response Center team explained today.
“This was mitigated within 48 hours (on January 13, 2022). [..] Customers using the private access networking option were not exposed to this vulnerability. The Single Server offering of Postgres was not impacted.”
Microsoft deployed fixes to all Flexible Servers by February 25, 2022, to address a remote code execution flaw in the Flexible Server PostgreSQL service and a privilege escalation bug.
The cloud security firm Wiz’s research team, who discovered the security bugs, collectively dubbed them ExtraReplica and disclosed it to Microsoft on January 11, 2022.
As explained by Microsoft, the Wiz researchers went through the following steps to gain elevated privileges and remote code execution, which allowed them to bypass cross-account authentication using a forged certificate and access other customers’ databases:
- Choose a target PostgreSQL Flexible Server.
- Retrieve the target’s common name from the Certificate Transparency feed.
- Purchase a specially crafted certificate from DigiCert or a DigiCert Intermediate Certificate Authority.
- Find the target’s Azure region by resolving the database domain name and matching it to one of Azure’s public IP ranges.
- Create an attacker-controlled database in the target’s Azure region.
- Exploit vulnerability #1 on the attacker-controlled instance to escalate privileges and gain code execution.
- Scan the subnet for the target instance and exploit vulnerability #2 to gain read access!
ExtraReplica attack flow (Wiz)
Microsoft says that none of its Azure customers using the impacted Flexible Servers before the fix rolled out were affected in any way, and no customer data was accessed without authorization by exploiting the ExtraReplica vulnerability chain.
Since the company has already addressed the security flaws on all vulnerable database servers, customers are not required to take any measures to protect their data.
However, Microsoft recommends deploying PostgreSQL flexible servers on Azure virtual networks (VNet), which provide private and secure network communication.
“In order to further minimize exposure, we recommend that customers enable private network access when setting up their Flexible Server instances,” Redmond explained.
“As with other cloud vulnerabilities, this issue did not receive a CVE identifier (unlike software vulnerabilities). It is not recorded or documented in any database,” the Wiz research team added.
“The absence of such a database impairs the ability of customers to monitor, track, and respond to cloud vulnerabilities.”
- 11/01/22 – Wiz Research reported the vulnerabilities to MSRC (case 69557)
- 13/01/22 – MSRC started investigating the vulnerabilities and subsequently fixed certificate issue (vulnerability #2)
- 14/01/22 – MSRC verified their fix, as observed by Wiz Research (certificate transparency).
- 15/01/22 – MSRC awarded Wiz Research with a $40,000 USD bounty
- 18/01/22 – MSRC stated that they successfully reproduced all vulnerabilities
- 25/02/22 – A fix was rolled out to all vulnerable instances
Last year, the Wiz research team also disclosed a new class of DNS vulnerabilities impacting major DNS-as-a-Service (DNSaaS) providers and allowing attackers to access sensitive info from corporate networks in what they described as “nation-state level spying” campaigns.
The researchers have also found several other security flaws in Microsoft Azure products, including Azure Cosmos DB, the Open Management Infrastructure (OMI) software agent, and the Azure App Service.