Skip to content
Access control Write-up Advanced

The cloud has an isolation problem: PostgreSQL vulnerabilities affect multiple cloud vendors

Cloud vendors modified PostgreSQL to give customers semi-admin rights, but a flaw in Google Cloud SQL let a low-privileged user change a table's owner to the internal superuser role and then run commands as that user. The attacker could execute code on the managed database instance and, in some cases, reach other tenants' data.

Shir Tamari Follow

Published on wiz.io

As part of our ongoing research into the cloud, Wiz Research found vulnerabilities in popular PostgreSQL-as-a-Service offerings of multiple cloud vendors. These vulnerabilities were not the result of a bug in the PostgreSQL codebase, but rather in the code that cloud vendors introduced to the project to make it fit…

Shir Tamari (@shirtamari), Nir Ohfeld (@nirohfeld), Sagi Tzadik (@sagitz_), 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 vendor patch to the table-owner change function treated members of a customer-facing role as superusers, so a low-privileged user could assign a table to the internal admin role and have index functions run with that role's permissions.

Impact

The attacker could run commands on the database container and, in extreme cases, reach other customers' data, though the text notes the container shared the host network and further escalation was needed to reach the host.

What the attacker needed

A managed PostgreSQL instance; a low-privileged database user; ability to create tables and indexes

The fix

The text says the vendors collaborated on a mitigation plan but does not state the exact fix, so the vendor patch should stop treating the customer role as a superuser when changing table ownership.

How it was found

  1. Create a table and insert dummy content so the index function has data to work with.
  2. Create an index function on the table that contains the command to run.
  3. Change the table owner to the internal admin role used by the cloud provider.
  4. Run ANALYZE on the table so the engine switches to the owner's context and calls the index function with those permissions.

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.

Cloud providers run databases for many customers on shared machines. To keep customers from breaking things, they changed the database software to give limited admin powers. A mistake in those changes let a normal customer trick the database into running their code with the provider's own high-level account, which is like a hotel guest finding a master key.

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.

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.