CVE-2024-9675

7.8 HIGH

📋 TL;DR

This vulnerability in Buildah allows attackers to bypass path validation in cache mounts, enabling arbitrary host directory access during container builds. Users running Buildah with untrusted Containerfiles are affected, particularly in CI/CD pipelines or shared build environments.

💻 Affected Systems

Products:
  • Buildah
Versions: All versions before 1.35.4
Operating Systems: Linux, Any OS running Buildah
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires user to run Buildah with a malicious Containerfile containing specially crafted RUN instructions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full host filesystem compromise allowing data theft, privilege escalation, or persistent backdoor installation through malicious container builds.

🟠

Likely Case

Unauthorized access to sensitive host files (configs, secrets, credentials) during container build processes, potentially leading to data exfiltration.

🟢

If Mitigated

Limited impact with proper user isolation, trusted Containerfile sources, and restricted build permissions.

🌐 Internet-Facing: MEDIUM - Buildah typically runs in internal build environments, but internet-facing CI/CD systems could be targeted.
🏢 Internal Only: HIGH - Internal build systems with multiple users or automated pipelines are primary targets for exploitation.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW - Requires only a malicious Containerfile with specific RUN instructions.

Exploitation requires the ability to execute Buildah commands, typically through build system access or CI/CD pipeline control.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Buildah 1.35.4 and later

Vendor Advisory: https://access.redhat.com/errata/RHSA-2024:8563

Restart Required: No

Instructions:

1. Update Buildah: 'sudo dnf update buildah' (RHEL/Fedora) or 'sudo apt-get update && sudo apt-get install buildah' (Debian/Ubuntu). 2. Verify version: 'buildah --version' should show 1.35.4 or higher.

🔧 Temporary Workarounds

Restrict Buildah Usage

linux

Limit Buildah execution to trusted users and environments only.

sudo chmod 750 /usr/bin/buildah
sudo setfacl -m u:trusteduser:rx /usr/bin/buildah

Use Containerfile Validation

all

Implement pre-build scanning of Containerfiles for suspicious cache mount paths.

grep -r '--mount=type=cache' Containerfile | grep -v '^#'

🧯 If You Can't Patch

  • Run Buildah in isolated environments (VMs, sandboxes) with minimal host access.
  • Implement strict user/group permissions and audit all Containerfile sources before building.

🔍 How to Verify

Check if Vulnerable:

Run 'buildah --version' and check if version is below 1.35.4.

Check Version:

buildah --version

Verify Fix Applied:

Confirm 'buildah --version' returns 1.35.4 or higher and test cache mount functionality with safe paths.

📡 Detection & Monitoring

Log Indicators:

  • Unusual cache mount paths in Buildah logs
  • Multiple failed path validation attempts

Network Indicators:

  • Unexpected outbound connections during container builds

SIEM Query:

source="buildah" AND ("cache" AND "mount" AND NOT "valid")

🔗 References

📤 Share & Export