CVE-2021-3602: Github.com/containers/buildah Buildah Processes Using Chroot Isolation Vulnerability
MODERATECVE-2021-3602 is a MODERATE (CVSS 5.5) buildah processes using chroot isolation vulnerability (CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer) affecting Github.com/containers/buildah libraries in the Go ecosystem. The issue involves buildah processes using chroot isolation may leak environment values to intermediate processes. Remediation is available by upgrading affected packages to version 1.16.8, 1.17.2, 1.19.9, 1.21.3.
CVE-2021-3602 at a Glance
Security Impact
CVSS: 5.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2021-3602
To remediate this vulnerability, upgrade all affected Github.com/containers/buildah dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/containers/buildah to 1.16.8
Upgrade github.com/containers/buildah to 1.17.2
Upgrade github.com/containers/buildah to 1.19.9
Upgrade github.com/containers/buildah to 1.21.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/containers/buildah
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-3602, inspect your project dependencies for Github.com/containers/buildah:
inspect dependencies for github.com/containers/buildah
Analyze the terminal output to locate any version of Github.com/containers/buildah in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.16.8), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer, where the product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors. In Github.com/containers/buildah, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-3602 Affected Github.com/containers/buildah Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/containers/buildah
|
Go |
< 1.16.8
|
1.16.8
|
|
github.com/containers/buildah
|
Go |
≥ 1.17.0
< 1.17.2
|
1.17.2
|
|
github.com/containers/buildah
|
Go |
≥ 1.18.0
< 1.19.9
|
1.19.9
|
|
github.com/containers/buildah
|
Go |
≥ 1.20.0
< 1.21.3
|
1.21.3
|
References
Frequently Asked Questions
What is CVE-2021-3602?
Which Github.com/containers/buildah versions are affected?
What version fixes CVE-2021-3602?
Is github.com/containers/buildah affected?
What is the CVSS score of CVE-2021-3602?
What CWE is associated with CVE-2021-3602?
How can I check Go dependencies for CVE-2021-3602?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7638-r9r3-rmjj",
"modified" : "2023-08-29T18:32:51Z",
"published" : "2021-07-19T15:19:09Z",
"aliases" : [ "CVE-2021-3602" ],
"summary" : "Buildah processes using chroot isolation may leak environment values to intermediate processes",
"details" : "### Impact\nWhen running processes using \"chroot\" isolation, the process being run can examine the environment variables of its immediate parent and grandparent processes (CVE-2021-3602). This isolation type is often used when running `buildah` in unprivileged containers, and it is often used to do so in CI/CD environments. If sensitive information is exposed to the original `buildah` process through its environment, that information will unintentionally be shared with child processes which it starts as part of handling RUN instructions or during `buildah run`. The commands that `buildah` is instructed to run can read that information if they choose to.\n\n### Patches\nUsers should upgrade packages, or images which contain packages, to include version 1.21.3 or later.\n\n### Workarounds\nAs a workaround, invoking `buildah` in a container under `env -i` to have it started with a reinitialized environment should prevent the leakage.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [buildah](https://github.com/containers/buildah/issues)\n* Email us at [the buildah general mailing list](mailto:buildah@lists.buildah.io), or [the podman security mailing list](mailto:security@lists.podman.io) if it's sensitive.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/containers/buildah"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.16.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.16.7"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/containers/buildah"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.17.0"
}, {
"fixed" : "1.17.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.17.1"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/containers/buildah"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.18.0"
}, {
"fixed" : "1.19.9"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.19.8"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/containers/buildah"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.20.0"
}, {
"fixed" : "1.21.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.21.2"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/containers/buildah/security/advisories/GHSA-7638-r9r3-rmjj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-3602"
}, {
"type" : "WEB",
"url" : "https://github.com/containers/buildah/commit/a468ce0ffd347035d53ee0e26c205ef604097fb0"
}, {
"type" : "WEB",
"url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1969264"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/containers/buildah"
}, {
"type" : "WEB",
"url" : "https://pkg.go.dev/vuln/GO-2022-0345"
}, {
"type" : "WEB",
"url" : "https://ubuntu.com/security/CVE-2021-3602"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-212" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-07-15T20:26:57Z",
"nvd_published_at" : "2022-03-03T19:15:00Z"
}
}