Skip to content
Access control Write-up Advanced

Wiz Research discovers "ExtraReplica"— a cross-account database vulnerability in Azure PostgreSQL

A chain of two vulnerabilities in Azure Database for PostgreSQL Flexible Server allowed an attacker to gain code execution on their own instance and then bypass authentication to read other customers' databases. The second flaw was an overly permissive regular expression in the certificate Common Name validation, enabling cross-tenant database replication.

Ronen Shustin Follow

Published on wiz.io

Tenant isolation is a fundamental premise of the cloud. Organizations trust that the cloud services they use, especially high value assets such as databases, are isolated from other customers.

Ronen Shustin, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a combination of a privilege escalation bug in Azure's modified PostgreSQL engine and an overly permissive regular expression in the certificate Common Name mapping that allowed a certificate for an arbitrary domain to authenticate as the replication user.

Impact

An attacker could replicate and gain read access to Azure PostgreSQL Flexible Server customer databases configured with public network access, regardless of firewall rules; instances with Private access (VNet) were not affected.

What the attacker needed

Azure account to create a database; Ability to purchase a certificate; Target uses public network access

How it was found

  1. Choose a target PostgreSQL Flexible Server.
  2. Retrieve the target’s common name from the Certificate Transparency feed.
  3. Purchase a specially crafted certificate from DigiCert or a DigiCert Intermediate Certificate Authority.
  4. Find the target’s Azure region by resolving the database domain name and matching it to one of Azure’s public IP ranges.
  5. Create an attacker-controlled database in the target’s Azure region.
  6. Exploit vulnerability #1 on the attacker-controlled instance to escalate privileges and gain code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This report describes two bugs in a cloud database service. The first let the researchers run their own code on the database server they rented. The second was a mistake in how the service checked security certificates, which let them pretend to be another customer's database and copy its data.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Ronen Shustin

View all

3 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.