CVE-2024-9407: Github.com/containers/buildah Improper Input Validation Vulnerability

MODERATE
Advisory Identifier: GHSA-fhqq-8f65-5xfc
CVSS 4.7
CWE-20
Published
Advisory Summary

CVE-2024-9407 is a MODERATE (CVSS 4.7) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Github.com/containers/buildah libraries in the Go ecosystem. The issue involves improper input validation in buildah and podman. Remediation is available by upgrading affected packages to version 1.37.4, 5.2.4.

CVE-2024-9407 at a Glance

CVE Identifier CVE-2024-9407
GHSA Identifier GHSA-fhqq-8f65-5xfc
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/containers/buildah
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-9407

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.

github.com/containers/buildah fixed: 1.37.4
Upgrade github.com/containers/buildah to 1.37.4
github.com/containers/podman/v5 fixed: 5.2.4
Upgrade github.com/containers/podman/v5 to 5.2.4
github.com/containers/podman fixed: 5.2.4
Upgrade github.com/containers/podman to 5.2.4
github.com/containers/podman/v2 fixed: 5.2.4
Upgrade github.com/containers/podman/v2 to 5.2.4
github.com/containers/podman/v3 fixed: 5.2.4
Upgrade github.com/containers/podman/v3 to 5.2.4
github.com/containers/podman/v4 fixed: 5.2.4
Upgrade github.com/containers/podman/v4 to 5.2.4
Verify Direct and Transitive Dependencies

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-2024-9407, 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.37.4), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. 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

A vulnerability exists in the bind-propagation option of the Dockerfile RUN --mount instruction. The system does not properly validate the input passed to this option, allowing users to pass arbitrary parameters to the mount instruction. This issue can be exploited to mount sensitive directories from the host into a container during the build process and, in some cases, modify the contents of those mounted files. Even if SELinux is used, this vulnerability can bypass its protection by allowing the source directory to be relabeled to give the container access to host files.

CVE-2024-9407 Affected Github.com/containers/buildah Versions

6 component(s)
Fixed Versions:
1.37.45.2.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/containers/buildah
Go
< 1.37.4
1.37.4
github.com/containers/podman/v5
Go
< 5.2.4
5.2.4
github.com/containers/podman
Go
< 5.2.4
5.2.4
github.com/containers/podman/v2
Go
< 5.2.4
5.2.4
github.com/containers/podman/v3
Go
< 5.2.4
5.2.4
github.com/containers/podman/v4
Go
< 5.2.4
5.2.4

References

Frequently Asked Questions

What is CVE-2024-9407?
CVE-2024-9407 is a security vulnerability in Github.com/containers/buildah involving Improper Input Validation in Buildah and Podman under CWE-20: Improper Input Validation.
Which Github.com/containers/buildah versions are affected?
Affected versions include releases prior to 1.37.4, 5.2.4 across affected packages: github.com/containers/buildah, github.com/containers/podman/v5, github.com/containers/podman, github.com/containers/podman/v2, github.com/containers/podman/v3, github.com/containers/podman/v4.
What version fixes CVE-2024-9407?
Upgrading to 1.37.4, 5.2.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/containers/buildah affected?
Yes, github.com/containers/buildah is affected in releases prior to 1.37.4. Upgrade your dependency to 1.37.4 or later.
Is github.com/containers/podman/v5 affected?
Yes, github.com/containers/podman/v5 is affected in releases prior to 5.2.4. Upgrade your dependency to 5.2.4 or later.
What is the CVSS score of CVE-2024-9407?
CVE-2024-9407 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2024-9407?
CVE-2024-9407 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2024-9407?
Run the dependency tree command: 'inspect dependencies for github.com/containers/buildah'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fhqq-8f65-5xfc",
  "modified" : "2024-12-20T15:30:48Z",
  "published" : "2024-10-01T21:31:35Z",
  "aliases" : [ "CVE-2024-9407" ],
  "summary" : "Improper Input Validation in Buildah and Podman",
  "details" : "A vulnerability exists in the bind-propagation option of the Dockerfile RUN --mount instruction. The system does not properly validate the input passed to this option, allowing users to pass arbitrary parameters to the mount instruction. This issue can be exploited to mount sensitive directories from the host into a container during the build process and, in some cases, modify the contents of those mounted files. Even if SELinux is used, this vulnerability can bypass its protection by allowing the source directory to be relabeled to give the container access to host files.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/buildah"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.37.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.37.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.3"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-9407"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containers/buildah/commit/e4e2ad5ca2088d7c388109394135ead7aaf1f4f4"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:10147"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:8846"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:9051"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:9454"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:9459"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:9926"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2024-9407"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2315887"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containers/podman/releases/tag/v5.2.4"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3169"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20241220-0010"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-01T22:32:05Z",
    "nvd_published_at" : "2024-10-01T21:15:08Z"
  }
}