Vulnerabilities in pkg:golang/github.com/opencontainers/umoci

PACKAGE
Advisory Identifier: GHSA-9m95-8hx6-7p9v
Advisory Summary

CVE-2021-29136 is a MODERATE (CVSS 5.5) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Github.com/opencontainers/umoci libraries in the Go ecosystem. The issue involves improper input validation in umoci. Remediation is available by upgrading affected packages to version 0.4.7.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/opencontainers/umoci

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/opencontainers/umoci. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9m95-8hx6-7p9v CVE-2021-29136 MODERATE Improper input validation in umoci

CVE-2021-29136 at a Glance

CVE Identifier CVE-2021-29136
GHSA Identifier GHSA-9m95-8hx6-7p9v
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/opencontainers/umoci
Package Ecosystem Go
Published Date
Last Updated

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:N/I:H/A:N).

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

How to Fix CVE-2021-29136

To remediate this vulnerability, upgrade all affected Github.com/opencontainers/umoci 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/opencontainers/umoci fixed: 0.4.7
Upgrade github.com/opencontainers/umoci to 0.4.7
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/opencontainers/umoci

How to Check if You Are Affected

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

inspect dependencies for github.com/opencontainers/umoci

Analyze the terminal output to locate any version of Github.com/opencontainers/umoci in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.7), 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/opencontainers/umoci, 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 umoci 0.4.6 and earlier can be tricked into modifying host files by creating a malicious layer that has a symlink with the name "." (or "/"). Because umoci deletes inodes if they change types, this results in the rootfs directory being replaced with an attacker-controlled symlink. Subsequent image layers will then be applied on top of the target of the symlink (which could be any directory on the host filesystem the user running umoci has access to). While umoci does have defences against symlink-based attacks, they are all implemented by resolving things relative to the rootfs directory -- if the rootfs itself is a symlink, umoci resolves it first. This vulnerability affects both "umoci unpack" and "umoci raw unpack". ### Patches This issue has been patched in umoci 0.4.7, see the references section for the specific commit which fixed this vulnerability. ### Workarounds Note that if you use umoci as an unprivileged user (using the --rootless flag) then umoci will not be able to overwrite any files that your user doesn't have access to. Other possible mitigations are to run umoci under an LSM profile such as AppArmor or SELinux to restrict the level of access it has outside of container image directories. ### References * [oss-security public disclosure](https://www.openwall.com/lists/oss-security/2021/04/06/2) * [patch](https://github.com/opencontainers/umoci/commit/d9efc31daf2206f7d3fdb839863cf7a576a2eb57) ### Credits Thanks to Robin Peraglie from Cure53 for discovering and reporting this vulnerability. ### For more information If you have any questions or comments about this advisory * Open an issue in <https://github.com/opencontainers/umoci>. * Email us at <security@opencontainers.org>.

CVE-2021-29136 Affected Github.com/opencontainers/umoci Versions

1 component(s)
Fixed Versions:
0.4.7
Product / Package Ecosystem Affected Versions Fixed Version
github.com/opencontainers/umoci
Go
< 0.4.7
0.4.7

References

Frequently Asked Questions

What is CVE-2021-29136?
CVE-2021-29136 is a security vulnerability in Github.com/opencontainers/umoci involving Improper input validation in umoci under CWE-20: Improper Input Validation.
Which Github.com/opencontainers/umoci versions are affected?
Affected versions include releases prior to 0.4.7 across affected packages: github.com/opencontainers/umoci.
What version fixes CVE-2021-29136?
Upgrading to 0.4.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/opencontainers/umoci affected?
Yes, github.com/opencontainers/umoci is affected in releases prior to 0.4.7. Upgrade your dependency to 0.4.7 or later.
What is the CVSS score of CVE-2021-29136?
CVE-2021-29136 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2021-29136?
CVE-2021-29136 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-2021-29136?
Run the dependency tree command: 'inspect dependencies for github.com/opencontainers/umoci'. 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-9m95-8hx6-7p9v",
  "modified" : "2022-03-15T21:39:42Z",
  "published" : "2022-02-15T01:17:37Z",
  "aliases" : [ "CVE-2021-29136" ],
  "summary" : "Improper input validation in umoci",
  "details" : "### Impact\n\numoci 0.4.6 and earlier can be tricked into modifying host files by\ncreating a malicious layer that has a symlink with the name \".\" (or\n\"/\"). Because umoci deletes inodes if they change types, this results in\nthe rootfs directory being replaced with an attacker-controlled symlink.\nSubsequent image layers will then be applied on top of the target of the\nsymlink (which could be any directory on the host filesystem the user\nrunning umoci has access to).\n\nWhile umoci does have defences against symlink-based attacks, they are\nall implemented by resolving things relative to the rootfs directory --\nif the rootfs itself is a symlink, umoci resolves it first.\n\nThis vulnerability affects both \"umoci unpack\" and \"umoci raw unpack\".\n\n### Patches\nThis issue has been patched in umoci 0.4.7, see the references section\nfor the specific commit which fixed this vulnerability.\n\n### Workarounds\nNote that if you use umoci as an unprivileged user (using the --rootless\nflag) then umoci will not be able to overwrite any files that your user\ndoesn't have access to. Other possible mitigations are to run umoci\nunder an LSM profile such as AppArmor or SELinux to restrict the level\nof access it has outside of container image directories.\n\n### References\n* [oss-security public disclosure](https://www.openwall.com/lists/oss-security/2021/04/06/2)\n* [patch](https://github.com/opencontainers/umoci/commit/d9efc31daf2206f7d3fdb839863cf7a576a2eb57)\n\n### Credits\nThanks to Robin Peraglie from Cure53 for discovering and reporting this\nvulnerability.\n\n### For more information\n\nIf you have any questions or comments about this advisory\n* Open an issue in <https://github.com/opencontainers/umoci>.\n* Email us at <security@opencontainers.org>.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/opencontainers/umoci"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/opencontainers/umoci/security/advisories/GHSA-9m95-8hx6-7p9v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29136"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opencontainers/umoci/commit/d9efc31daf2206f7d3fdb839863cf7a576a2eb57"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/04/06/2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-20T20:13:37Z",
    "nvd_published_at" : null
  }
}