VYPR
Moderate severityNVD Advisory· Published Apr 4, 2022· Updated Aug 3, 2024

CVE-2022-27651

CVE-2022-27651

Description

A flaw was found in buildah where containers were incorrectly started with non-empty default permissions. A bug was found in Moby (Docker Engine) where containers were incorrectly started with non-empty inheritable Linux process capabilities, enabling an attacker with access to programs with inheritable file capabilities to elevate those capabilities to the permitted set when execve(2) runs. This has the potential to impact confidentiality and integrity.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
github.com/containers/buildahGo
< 1.25.01.25.0

Affected products

1

Patches

2
90b3254c7404

Add a test for CVE-2022-27651

https://github.com/containers/buildahNalin DahyabhaiMar 24, 2022via ghsa
1 file changed · +14 0
  • tests/run.bats+14 0 modified
    @@ -786,9 +786,23 @@ _EOF
     	if test "$DBUS_SESSION_BUS_ADDRESS" = ""; then
     		skip "${1:-test does not work when \$BUILDAH_ISOLATION = chroot}"
     	fi
    +	_prefetch alpine
     
     	run_buildah from --quiet --pull=false --signature-policy ${TESTSDIR}/policy.json alpine
     	cid=$output
     	run_buildah run --cgroupns=host $cid cat /proc/self/cgroup
     	expect_output --substring "/user.slice/"
     }
    +
    +@test "run-inheritable-capabilities" {
    +	skip_if_no_runtime
    +
    +	_prefetch alpine
    +
    +	run_buildah from --quiet --pull=false --signature-policy ${TESTSDIR}/policy.json alpine
    +	cid=$output
    +	run_buildah run $cid grep ^CapInh: /proc/self/status
    +	expect_output "CapInh:	0000000000000000"
    +	run_buildah run --cap-add=ALL $cid grep ^CapInh: /proc/self/status
    +	expect_output "CapInh:	0000000000000000"
    +}
    
e7e55c988c05

do not set the inheritable capabilities

https://github.com/containers/buildahGiuseppe ScrivanoFeb 28, 2022via ghsa
2 files changed · +1 7
  • chroot/run.go+1 1 modified
    @@ -897,7 +897,7 @@ func setCapabilities(spec *specs.Spec, keepCaps ...string) error {
     	capMap := map[capability.CapType][]string{
     		capability.BOUNDING:    spec.Process.Capabilities.Bounding,
     		capability.EFFECTIVE:   spec.Process.Capabilities.Effective,
    -		capability.INHERITABLE: spec.Process.Capabilities.Inheritable,
    +		capability.INHERITABLE: []string{},
     		capability.PERMITTED:   spec.Process.Capabilities.Permitted,
     		capability.AMBIENT:     spec.Process.Capabilities.Ambient,
     	}
    
  • run_linux.go+0 6 modified
    @@ -1964,9 +1964,6 @@ func setupCapAdd(g *generate.Generator, caps ...string) error {
     		if err := g.AddProcessCapabilityEffective(cap); err != nil {
     			return errors.Wrapf(err, "error adding %q to the effective capability set", cap)
     		}
    -		if err := g.AddProcessCapabilityInheritable(cap); err != nil {
    -			return errors.Wrapf(err, "error adding %q to the inheritable capability set", cap)
    -		}
     		if err := g.AddProcessCapabilityPermitted(cap); err != nil {
     			return errors.Wrapf(err, "error adding %q to the permitted capability set", cap)
     		}
    @@ -1985,9 +1982,6 @@ func setupCapDrop(g *generate.Generator, caps ...string) error {
     		if err := g.DropProcessCapabilityEffective(cap); err != nil {
     			return errors.Wrapf(err, "error removing %q from the effective capability set", cap)
     		}
    -		if err := g.DropProcessCapabilityInheritable(cap); err != nil {
    -			return errors.Wrapf(err, "error removing %q from the inheritable capability set", cap)
    -		}
     		if err := g.DropProcessCapabilityPermitted(cap); err != nil {
     			return errors.Wrapf(err, "error removing %q from the permitted capability set", cap)
     		}
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

14

News mentions

0

No linked articles in our index yet.