CVE-2021-3602: chroot isolation: environment value leakage to intermediate processes in github.com/containers/buildah
Summary
CVE-2021-3602: Buildah processes using chroot isolation may leak environment values to intermediate processes. Affects github.com/containers/buildah across 4 version ranges.
< 1.16.8
>= 1.17.0, < 1.17.2
>= 1.18.0, < 1.19.9
>= 1.20.0, < 1.21.3
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- golang-github-containers-buildah · Debian:11
The same CVE-2021-3602 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
github.com/containers/buildah is a Go package that provides a command-line interface for building and managing OCI (Open Container Initiative) images. It is commonly used in CI/CD environments and unprivileged containers. The package utilizes chroot isolation to run processes securely. However, a vulnerability has been discovered that allows the process being run to examine the environment variables of its immediate parent and grandparent processes.
Vulnerability Detail
The vulnerability (CVE-2021-3602) in github.com/containers/buildah's chroot isolation can lead to the leakage of sensitive information. When the original buildah process receives sensitive information through its environment, this information unintentionally gets shared with child processes started during the handling of RUN instructions or buildah run. These child processes can read the exposed information if they choose to do so. This vulnerability has a CVSS score of 5.5, indicating a moderate severity level.
How To Fix
Latest published version: v1.43.5 as of 22 Oct 2026
go get github.com/containers/buildah@v1.43.5
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 1.16.81.16.8go get github.com/containers/buildah@v1.16.8 -
>= 1.17.0, < 1.17.21.17.2go get github.com/containers/buildah@v1.17.2 -
>= 1.18.0, < 1.19.91.19.9go get github.com/containers/buildah@v1.19.9 -
>= 1.20.0, < 1.21.31.21.3go get github.com/containers/buildah@v1.21.3
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a workaround, users can invoke buildah in a container under env -i to start it with a reinitialized environment. This prevents the leakage of sensitive information.
Conclusion
The vulnerability in github.com/containers/buildah's chroot isolation can lead to the leakage of sensitive information to intermediate processes. It is recommended to upgrade to version 1.21.3 or later to fix this vulnerability. Alternatively, the workaround of starting buildah with a reinitialized environment can be used. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/containers/buildah →
FAQ
The vulnerability allows processes running in chroot isolation to access the environment variables of their immediate parent and grandparent processes. This can lead to the exposure of sensitive information.
To fix this vulnerability, upgrade your packages or images to include version 1.21.3 or later of github.com/containers/buildah.
Yes, you can use the workaround of invoking buildah in a container under env -i to start it with a reinitialized environment.
No, this vulnerability affects any usage of buildah in unprivileged containers utilizing chroot isolation.
For more information, you can open an issue in the buildah GitHub repository or email the buildah general mailing list or the podman security mailing list.
References
Related vulnerabilities
Recent vulnerabilities recorded for github.com/containers/buildah.