CVE-2021-32760: Github.com/containerd/containerd Archive Package Allows Chmod Of Vulnerability

MODERATE
Advisory Identifier: GHSA-c72p-9xmj-rx3w
CVSS 5.0
CWE-668 CWE-732
Published
Advisory Summary

CVE-2021-32760 is a MODERATE (CVSS 5.0) archive package allows chmod of vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Github.com/containerd/containerd libraries in the Go ecosystem. The issue involves archive package allows chmod of file outside of unpack target directory. Remediation is available by upgrading affected packages to version 1.4.8, 1.5.4.

CVE-2021-32760 at a Glance

CVE Identifier CVE-2021-32760
GHSA Identifier GHSA-c72p-9xmj-rx3w
Severity MODERATE
CVSS v3.1 Base Score 5.0
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Github.com/containerd/containerd
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.0

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

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

How to Fix CVE-2021-32760

To remediate this vulnerability, upgrade all affected Github.com/containerd/containerd 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/containerd/containerd fixed: 1.4.8
Upgrade github.com/containerd/containerd to 1.4.8
github.com/containerd/containerd fixed: 1.5.4
Upgrade github.com/containerd/containerd to 1.5.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/containerd/containerd

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-32760, inspect your project dependencies for Github.com/containerd/containerd:

inspect dependencies for github.com/containerd/containerd

Analyze the terminal output to locate any version of Github.com/containerd/containerd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.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-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. In Github.com/containerd/containerd, 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 A bug was found in containerd where pulling and extracting a specially-crafted container image can result in Unix file permission changes for existing files in the host’s filesystem. Changes to file permissions can deny access to the expected owner of the file, widen access to others, or set extended bits like setuid, setgid, and sticky. This bug does not directly allow files to be read, modified, or executed without an additional cooperating process. ## Patches This bug has been fixed in containerd 1.5.4 and 1.4.8. Users should update to these versions as soon as they are released. Running containers do not need to be restarted. ## Workarounds Ensure you only pull images from trusted sources. Linux security modules (LSMs) like SELinux and AppArmor can limit the files potentially affected by this bug through policies and profiles that prevent containerd from interacting with unexpected files. ## For more information If you have any questions or comments about this advisory: * [Open an issue](https://github.com/containerd/containerd/issues/new/choose) * Email us at security@containerd.io if you think you’ve found a security bug.

CVE-2021-32760 Affected Github.com/containerd/containerd Versions

2 component(s)
Fixed Versions:
1.4.81.5.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/containerd/containerd
Go
< 1.4.8
1.4.8
github.com/containerd/containerd
Go
≥ 1.5.0
< 1.5.4
1.5.4

References

Frequently Asked Questions

What is CVE-2021-32760?
CVE-2021-32760 is a security vulnerability in Github.com/containerd/containerd involving Archive package allows chmod of file outside of unpack target directory under CWE-668: Exposure of Resource to Wrong Sphere.
Which Github.com/containerd/containerd versions are affected?
Affected versions include releases prior to 1.4.8, 1.5.4 across affected packages: github.com/containerd/containerd.
What version fixes CVE-2021-32760?
Upgrading to 1.4.8, 1.5.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/containerd/containerd affected?
Yes, github.com/containerd/containerd is affected in releases prior to 1.4.8, 1.5.4. Upgrade your dependency to 1.4.8, 1.5.4 or later.
What is the CVSS score of CVE-2021-32760?
CVE-2021-32760 has a CVSS v3.1 base score of 5.0 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2021-32760?
CVE-2021-32760 is classified under CWE-668: Exposure of Resource to Wrong Sphere (The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.).
How can I check Go dependencies for CVE-2021-32760?
Run the dependency tree command: 'inspect dependencies for github.com/containerd/containerd'. 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-c72p-9xmj-rx3w",
  "modified" : "2024-01-31T15:31:56Z",
  "published" : "2021-07-26T21:17:45Z",
  "aliases" : [ "CVE-2021-32760" ],
  "summary" : "Archive package allows chmod of file outside of unpack target directory",
  "details" : "## Impact\n\nA bug was found in containerd where pulling and extracting a specially-crafted container image can result in Unix file permission changes for existing files in the host’s filesystem.  Changes to file permissions can deny access to the expected owner of the file, widen access to others, or set extended bits like setuid, setgid, and sticky.  This bug does not directly allow files to be read, modified, or executed without an additional cooperating process.\n\n## Patches\n\nThis bug has been fixed in containerd 1.5.4 and 1.4.8.  Users should update to these versions as soon as they are released.  Running containers do not need to be restarted.\n\n## Workarounds\n\nEnsure you only pull images from trusted sources.\n\nLinux security modules (LSMs) like SELinux and AppArmor can limit the files potentially affected by this bug through policies and profiles that prevent containerd from interacting with unexpected files.\n\n## For more information\n\nIf you have any questions or comments about this advisory:\n\n* [Open an issue](https://github.com/containerd/containerd/issues/new/choose)\n* Email us at security@containerd.io if you think you’ve found a security bug.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containerd/containerd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containerd/containerd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.5.0"
      }, {
        "fixed" : "1.5.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/containerd/containerd/security/advisories/GHSA-c72p-9xmj-rx3w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32760"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/containerd/commit/22e9a70c71eff6507be71955947a611f2ed91e6c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/containerd/commit/7ad08c69e09ee4930a48dbf2aab3cd612458617f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/containerd/containerd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/containerd/releases/tag/v1.4.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/containerd/releases/tag/v1.5.4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DDMNDPJJTP3J5GOEDB66F6MGXUTRG3Y3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DDMNDPJJTP3J5GOEDB66F6MGXUTRG3Y3"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202401-31"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-668", "CWE-732" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-22T20:21:14Z",
    "nvd_published_at" : "2021-07-19T21:15:00Z"
  }
}