This one’s mostly about 5.x kernels, and the people who found it used it to break out of containers.
At a glance
- CVE: CVE-2022-0185
- Severity: 8.4 (High) on NVD. Red Hat scores it 7.8 and rates it Important. It’s local: the attacker has to be running code on the box first.
- Affected: Linux 5.1 up to (but not including) 5.4.173, 5.10.93, 5.15.16 and 5.16.2. Kernels older than 5.1 never had the bug, so Debian 9 and 10, Ubuntu 18.04 and RHEL 7 aren’t affected. Ubuntu 20.04, Debian 11 and RHEL 8.4 onwards were.
- Known exploited: Yes. CISA added it to its Known Exploited Vulnerabilities (KEV) catalog on 2024-08-21. Working exploits were public from the start.
What’s going on
When something mounts a filesystem, the kernel collects the mount options through what it calls the “filesystem context” API. Filesystems that don’t support that newer API fall back to a legacy parser, legacy_parse_param(). Its length check used an unsigned subtraction that could wrap around to a huge number. A carefully sized option string then slipped past the check, and the kernel wrote past the end of a one-page heap buffer.
Normally you’d need CAP_SYS_ADMIN (admin rights) to get there. But the researchers pointed out that any unprivileged user can create a new user namespace with unshare and get that capability inside it. They built working root exploits for Ubuntu 20.04 and container escapes for Google’s hardened Container-Optimized OS.
For web hosts, that’s local privilege escalation and container escape in one. If an attacker gets code running through a web app, inside a container or not, this is a way to root on the host. Docker hosts and Kubernetes nodes on 5.x kernels are the ones to check first.
Timeline
- Disclosed: 2022-01-18 (oss-security, with the upstream fix in commit 722d94847de2)
- Patch released: 2022-01-18 upstream; Red Hat shipped RHEL 8 updates on 2022-01-19
- Published to NVD: 2022-02-11
- Added to CISA KEV: 2024-08-21
== UPDATE ==
Patches landed within days of disclosure back in 2022.
- Patch available: Yep.
- Fixed in: upstream 5.4.173, 5.10.93, 5.15.16, 5.16.2 and later. Distro examples: Ubuntu 20.04 kernel 5.4.0-96.109, Debian 11 “bullseye” 5.10.92-1 (DSA-5050-1) and RHEL 8 4.18.0-348.12.2.el8_5. Check your distro’s tracker (linked below) for your release.
- How to apply: update the kernel and reboot:
sudo apt update && sudo apt upgradeon Debian/Ubuntu orsudo dnf upgrade --refreshon RHEL and friends. Then confirm withuname -r. - If you can’t patch yet: turn off unprivileged user namespaces, which takes away the easy route to
CAP_SYS_ADMIN. Ubuntu’s suggestion issudo sysctl -w kernel.unprivileged_userns_clone=0. On RHEL 8, Red Hat suggests puttinguser.max_user_namespaces=0in/etc/sysctl.d/userns.confand runningsudo sysctl -p /etc/sysctl.d/userns.conf. Red Hat warns not to do this on container platforms like OpenShift that need user namespaces.
References
- https://nvd.nist.gov/vuln/detail/CVE-2022-0185
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2022-0185
- https://www.openwall.com/lists/oss-security/2022/01/18/7
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=722d94847de29310e8aa03fcbdb41fc92c521756
- https://access.redhat.com/security/cve/CVE-2022-0185
- https://ubuntu.com/security/CVE-2022-0185
- https://security-tracker.debian.org/tracker/CVE-2022-0185