Wiz Details PostgreSQL Flaws in Google Cloud and Azure Managed Services

· Original article ↗

Summary

Wiz researchers describe PostgreSQL service flaws in Google Cloud and Azure that enabled operating-system command execution. They report escalating access in Google Cloud and achieving cross-tenant database access in Azure.

Key points

  • Wiz says the flaws stemmed from cloud vendors’ modifications to PostgreSQL for managed, multi-tenant services, rather than bugs in PostgreSQL’s core code.
  • In Google Cloud SQL, researchers combined a vendor-specific table-ownership permission with PostgreSQL index-function behavior to execute commands as the database administrator.
  • Wiz reports escalating from database command execution to root in the container, then escaping to the host by exploiting network access and the guest agent’s configuration process.
  • In Azure Database for PostgreSQL, Wiz says unrestricted CREATEROLE permissions let them grant a user powerful built-in roles and execute commands on the host.
  • Wiz reports using the Azure foothold to demonstrate unauthorized access to other customers’ databases; it says Google Cloud’s stricter tenant isolation limited the impact there.
  • Wiz says it disclosed issues to more than a dozen managed PostgreSQL vendors; implementation differences complicated coordinated fixes, and Aiven released its hardenings as open source.

Article Details

Attack Vectors
  • In Cloud SQL for PostgreSQL, the researchers combined a permission flaw in ALTER TABLE ownership changes with a malicious index function. ANALYZE invoked the function as the table owner, cloudsqladmin, enabling operating-system command execution through PostgreSQL COPY FROM PROGRAM.
  • In the Cloud SQL container, the researchers used a symlink to redirect writes to a root-owned file under a directory they controlled. They overwrote ld.so.preload and used a shared library loaded by the SUID mount program to obtain root privileges.
  • The researchers used the shared network namespace and network capabilities to inject a fake configuration response to the host's guest agent. The response added an SSH key and created a user, enabling access to the host virtual machine.
  • In Azure Database for PostgreSQL, unrestricted CREATEROLE permission allowed creation of a user with pg_read_server_files, pg_write_server_files, and pg_execute_server_program roles. The researchers used COPY FROM PROGRAM to execute commands and open a reverse shell.
Defensive Notes
  • Enforce and maintain tenant isolation to limit the impact of vulnerabilities in managed services.
  • Restrict CREATEROLE and prevent regular users from assigning themselves powerful built-in roles.
  • Harden provider-specific PostgreSQL modifications that grant superuser-like capabilities to customers.

MITRE ATT&CK

People

Vendors

Products

Tools

Industries

Related Articles