CVE-2018-18955
High · 7.0CVSS
7.0
EPSS
7.6%
Published
Nov 16, 2018
CISA due date
—
Cloudanix analysis
A bug in the Linux kernel lets someone with limited rights inside a container-like environment read protected system files and take full control of the computer.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- High
- Impact
- Privilege Gain
- Component
- OS kernel
- Class
- Authorization Bypass
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Medium
What it actually does
map_write() in kernel/user_namespace.c mishandles ID transformations for nested user namespaces containing more than five UID or GID ranges, allowing a process with CAP_SYS_ADMIN inside the namespace to obtain unauthorized access to host resources such as /etc/shadow.
Why it matters to the business
Attackers can obtain root-level control of affected Linux systems, enabling theft of credentials, installation of persistent malware, and lateral movement; the vulnerability has been public and weaponized for years, so unpatched hosts represent a known, high-value target.
How an attack unfolds
An attacker first creates a user namespace with more than five UID/GID mappings, obtains CAP_SYS_ADMIN inside that namespace, then invokes map_write() so that the faulty kernel-to-namespaced ID conversion maps host credentials back into the namespace, bypassing isolation and granting access to files outside the namespace such as /etc/shadow.
How to fix it
Upgrade the Linux kernel to a version containing commit d2f007dbe7e4c9583eea6eb04d60001e85c6f1bd (or equivalent backport) so that 4.19.2 or later is running; rebuild and reboot with the patched kernel.
How to confirm the fix worked
Confirm the running kernel reports version 4.19.2 or newer, or verify the presence of commit d2f007dbe7e4c9583eea6eb04d60001e85c6f1bd in the kernel source tree; test that namespace ID mappings no longer permit bypass of host access controls.
Typical attack path
- Create a nested user namespace containing more than five UID or GID ranges
- Acquire CAP_SYS_ADMIN inside the namespace
- Invoke map_write() to trigger the incorrect ID mapping
- Read or write host resources outside the namespace (for example /etc/shadow)
- Escalate to full root privileges on the host system
How to detect it
Search kernel audit logs and syslog for creation of user namespaces with more than five mappings followed by unexpected access attempts to host files such as /etc/shadow; examine process trees for processes that suddenly gain root after namespace operations.
- map_write.*user_namespace
- CAP_SYS_ADMIN.*user_namespace.*>5
- unexpected open of /etc/shadow from within user namespace
What your security team should do
- Apply the kernel update containing the referenced commit immediately on all affected hosts
- Disable or restrict user namespaces for untrusted users where operationally feasible
- Audit workloads that rely on nested user namespaces with multiple UID/GID mappings
- Monitor kernel logs and process creation for anomalous namespace setup after patching
The record
In the Linux kernel 4.15.x through 4.19.x before 4.19.2, map_write() in kernel/user_namespace.c allows privilege escalation because it mishandles nested user namespaces with more than 5 UID or GID ranges. A user who has CAP_SYS_ADMIN in an affected user namespace can bypass access controls on resources outside the namespace, as demonstrated by reading /etc/shadow. This occurs because an ID transformation takes place properly for the namespaced-to-kernel direction but not for the kernel-to-namespaced direction.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | linux | 0 | 4.18.20-1 |
| Debian:12 | linux | 0 | 4.18.20-1 |
| Debian:13 | linux | 0 | 4.18.20-1 |
| Ubuntu:14.04:LTS | linux | 0 | 3.11.0-12.19 |
| Ubuntu:14.04:LTS | linux-aws | 0 | 4.4.0-1002.2 |
| Ubuntu:14.04:LTS | linux-azure | 0 | 4.15.0-1035.36~14.04.2 |
| Ubuntu:14.04:LTS | linux-lts-xenial | 0 | 4.4.0-13.29~14.04.1 |
| Ubuntu:16.04:LTS | linux | 0 | 4.2.0-16.19 |
| Ubuntu:16.04:LTS | linux-aws | 0 | 4.4.0-1001.10 |
| Ubuntu:16.04:LTS | linux-aws-hwe | 0 | 4.15.0-1030.31~16.04.1 |
| Ubuntu:16.04:LTS | linux-azure | 0 | 4.15.0-1035.36~16.04.1 |
| Ubuntu:16.04:LTS | linux-euclid | 0 | 4.4.0-9019.20 |
| Ubuntu:16.04:LTS | linux-gcp | 0 | 4.15.0-1025.26~16.04.1 |
| Ubuntu:16.04:LTS | linux-hwe | 0 | 4.15.0-42.45~16.04.1 |
| Ubuntu:16.04:LTS | linux-kvm | 0 | 4.4.0-1004.9 |
| Ubuntu:16.04:LTS | linux-oracle | 0 | 4.15.0-1007.9~16.04.1 |
| Ubuntu:16.04:LTS | linux-raspi2 | 0 | 4.2.0-1013.19 |
| Ubuntu:16.04:LTS | linux-snapdragon | 0 | 4.4.0-1012.12 |
| Ubuntu:18.04:LTS | linux | 0 | 4.15.0-42.45 |
| Ubuntu:18.04:LTS | linux-aws | 0 | 4.15.0-1029.30 |
| Ubuntu:18.04:LTS | linux-azure | 0 | 4.15.0-1035.36 |
| Ubuntu:18.04:LTS | linux-gcp | 0 | 4.15.0-1025.26 |
| Ubuntu:18.04:LTS | linux-gcp-edge | 0 | 4.18.0-1004.5~18.04.1 |
| Ubuntu:18.04:LTS | linux-hwe | 0 | 4.18.0-13.14~18.04.1 |
| Ubuntu:18.04:LTS | linux-kvm | 0 | 4.15.0-1027.27 |
| Ubuntu:18.04:LTS | linux-oem | 0 | 4.15.0-1028.33 |
| Ubuntu:18.04:LTS | linux-oracle | 0 | 4.15.0-1007.9 |
| Ubuntu:18.04:LTS | linux-raspi2 | 0 | 4.15.0-1029.31 |
| Ubuntu:Pro:16.04:LTS | linux-flo | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | linux-goldfish | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | linux-mako | 0 | No fix |
Related vulnerabilities
- CVE-2025-38562 In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix null… Also affects linux
- CVE-2025-38352 In the Linux kernel, the following vulnerability has been resolved: posix-cpu-timers: fix… Also affects linux
- CVE-2025-22037 In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix null… Also affects linux
- CVE-2025-21760 In the Linux kernel, the following vulnerability has been resolved: ndisc: extend RCU… Also affects linux
- CVE-2025-21758 In the Linux kernel, the following vulnerability has been resolved: ipv6: mcast: add RCU… Also affects linux
- CVE-2025-21664 In the Linux kernel, the following vulnerability has been resolved: dm thin: make… Also affects linux
- CVE-2024-57946 In the Linux kernel, the following vulnerability has been resolved: virtio-blk: don't… Also affects linux
- CVE-2024-57945 In the Linux kernel, the following vulnerability has been resolved: riscv: mm: Fix the… Also affects linux