Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTltOTUtOGh4Ni03cDl2

Improper input validation in umoci

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

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

Permalink: https://github.com/advisories/GHSA-9m95-8hx6-7p9v
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTltOTUtOGh4Ni03cDl2
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 2 years ago
Updated: over 1 year ago


CVSS Score: 5.5
CVSS vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N

Identifiers: GHSA-9m95-8hx6-7p9v, CVE-2021-29136
References: Repository: https://github.com/opencontainers/umoci
Blast Radius: 10.2

Affected Packages

go:github.com/opencontainers/umoci
Dependent packages: 29
Dependent repositories: 71
Downloads:
Affected Version Ranges: < 0.4.7
Fixed in: 0.4.7
All affected versions: 0.0.0, 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6
All unaffected versions: 0.4.7