Privilege Escalation via User Namespace Mapping in Linux Kernel (CVE-2018-18955)
CVE-2018-18955 is a privilege escalation vulnerability in the Linux kernel (versions 4.15.x through 4.19.x before 4.19.2) affecting the user namespace implementation. The flaw resides in the map_write() function in kernel/user_namespace.c, where improper handling of nested user namespaces with more than five UID or GID mapping extents leads to incorrect reverse ID transformation. This allows a user with CAP_SYS_ADMIN in a nested user namespace to bypass discretionary access controls (DAC) and gain unauthorized access to files outside the namespace, such as /etc/shadow. The vulnerability is triggered when more than five mapping extents are specified, causing access control checks (e.g., inode_owner_or_capable(), privileged_wrt_inode_uidgid()) to be bypassed due to invalid reverse mapping logic. The issue was introduced in commit 6397fac4915a and discovered by Jann Horn.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
A local attacker with CAP_SYS_ADMIN in a nested user namespace can exploit this vulnerability to bypass access controls and gain unauthorized access to sensitive files or resources outside the namespace, potentially leading to privilege escalation or container escape. The impact is high on confidentiality, integrity, and availability, as it allows reading of protected files (e.g., /etc/shadow) and potentially further system compromise.
If you can’t patch tonight, do this now.
If immediate patching is not possible, restrict the use of user namespaces or limit the ability for untrusted users to create nested user namespaces with multiple mapping extents. Consider disabling unprivileged user namespace creation (e.g., via sysctl kernel.unprivileged_userns_clone=0) as a temporary mitigation, though this may impact containerized workloads.
Patch, then assume compromise.
Upgrade the Linux kernel to version 4.19.2 or later, or apply the relevant distribution-provided patches. For Ubuntu, ensure kernel packages are updated to at least 4.15.0-42.45 (Bionic), 4.18.0-12.13 (Cosmic), or 4.19.0-12.13 (Disco). The fix (commit d2f007dbe7e4c9583eea6eb04d60001e85c6f1bd) ensures both forward and reverse mappings are properly updated and sorted in user namespaces.
2 exploits validated by Mallory's analysis. Hidden: 1 rejected by Mallory's analysis as not a working exploit; 5 not yet analyzed, such as Exploit-DB entries.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
1 sources tracked across advisories and community write-ups. News coverage will land here when it surfaces.
No news coverage yet. Advisories and community discussion only.