GHSA-9m95-8hx6-7p9v

Suggest an improvement
Source
https://github.com/advisories/GHSA-9m95-8hx6-7p9v
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/02/GHSA-9m95-8hx6-7p9v/GHSA-9m95-8hx6-7p9v.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-9m95-8hx6-7p9v
Aliases
Published
2022-02-15T01:17:37Z
Modified
2024-08-21T15:57:39.684817Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
Summary
Improper input validation in umoci
Details

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 * Open an issue in https://github.com/opencontainers/umoci. * Email us at security@opencontainers.org.

Database specific
{
    "nvd_published_at": null,
    "github_reviewed_at": "2021-05-20T20:13:37Z",
    "severity": "MODERATE",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-20"
    ]
}
References

Affected packages

Go / github.com/opencontainers/umoci

Package

Name
github.com/opencontainers/umoci
View open source insights on deps.dev
Purl
pkg:golang/github.com/opencontainers/umoci

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.4.7