Wiz Details IBM Cloud PostgreSQL Flaw That Could Enable a Supply-Chain Attack

· Original article ↗

Summary

Wiz disclosed a PostgreSQL privilege-escalation and exposed-credentials chain in IBM Cloud Databases that enabled access to internal build repositories and a potential supply-chain attack path. IBM patched the issues; it reported no indication of further exploitation.

Key points

  • Wiz said a SQL injection in a privileged PostgreSQL function enabled superuser queries and commands on the database’s underlying virtual machine.
  • A Kubernetes service-account token found on the instance provided API access, including permission to retrieve known secrets.
  • Wiz recovered private container registry credentials and found additional internal service credentials in container image build-history metadata.
  • With those credentials and network access from the database environment to internal build servers, Wiz said it could overwrite files in repositories used to build PostgreSQL images.
  • The demonstrated access established a potential supply-chain attack path; the article does not report that a malicious actor exploited it or that customers were affected.
  • Wiz reported the findings to IBM Cloud, which said it fixed the issues for all customers by September 3, 2022; no customer action was required.
  • IBM Cloud stated there was no indication its systems or services had been further exploited by other parties.

Article Details

Attack Vectors
  • A SQL injection in PostgreSQL's security-definer create_subscription function enabled arbitrary queries as the database superuser.
  • The researchers used PostgreSQL's COPY statement to execute commands on the virtual machine hosting the database, then opened a reverse shell and scanned the internal network.
  • A Kubernetes service-account token found in the pod allowed access to the Kubernetes API and retrieval of a named secret containing private container-registry credentials.
  • The researchers pulled and scanned container images, including their individual layers, and found plaintext credentials in image build-history metadata.
  • Overly permissive network access from the production database environment to internal build servers, combined with recovered repository credentials, allowed the researchers to overwrite files in packages used to build PostgreSQL images.
Defensive Notes
  • Continuously monitor environments for exposed or forgotten secrets, including credentials in container images and image layers.
  • Enforce strict network controls between production and internal build environments.
  • Restrict container-registry access and scope permissions to prevent unauthorized image retrieval and lateral movement.
  • Review Kubernetes API access and service-account permissions to prevent unnecessary access to secrets, pods, and other resources.
  • IBM Cloud reported that it patched the issues for all customers and fully mitigated them on 2022-09-03; it stated that there was no indication of further exploitation.

MITRE ATT&CK

People

Vendors

Products

Tools

Industries

Related Articles