Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2018-18955: Privilege Escalation via User Namespace Mapping in Linux Kernel (CVE-2018-18955)

Published Nov 16, 2018 · Updated 1 month ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 daysNo mention activity in the last 30 days.
CVSS7.0High · v3
EPSS7.7%95th percentile
CISA KEVNoNot listed
In the wildNonePublic exploit, no exploitation reported
Vendors
LinuxCanonical
IdentifiersCVE-2018-18955CWE-269

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.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

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.

Mitigation

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.

Remediation

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.

Public exploits

Exploits

2 exploits validated by Mallory's analysis. Hidden: 2 rejected by Mallory's analysis as not a working exploit; 5 not yet analyzed, such as Exploit-DB entries.

View more in app →
nested_namespace_idmap_limit_priv_esc.rbThis repository contains a single Metasploit module (Ruby file) that exploits CVE-2018-18955, a local privilege escalation vulnerability in certain Linux kernel versions (4.15.0 to 4.18.18, 4.19.0 to 4.19.1). The exploit leverages broken uid/gid mappings in nested user namespaces to escalate privileges to root. The module checks for the presence and setuid bit of the 'newuidmap' and 'newgidmap' helpers, verifies kernel version and configuration, and then uploads and executes exploit binaries (either compiled on the target or pre-compiled). The exploit works by injecting a cron job into /etc/crontab to execute a payload as root, typically resulting in a root shell or meterpreter session. The module is weaponized, allowing for customizable payloads and automated cleanup. The only file in the repository is the Metasploit module itself, written in Ruby, and it is designed to be used within the Metasploit Framework.Disclosed Nov 15, 2018 · Framework: metasploit · ruby · localWeaponizedCVE-2018-18955This repository is a local privilege escalation exploit for CVE-2018-18955, targeting Linux kernel versions 4.15.x through 4.19.x before 4.19.2. The vulnerability lies in improper handling of nested user namespaces, allowing a user with CAP_SYS_ADMIN in a user namespace to escalate privileges and access resources outside the namespace. The repository provides multiple exploitation techniques, each implemented as a separate shell script: bash_completion, cron, dbus, ldpreload, and polkit. Each script compiles the necessary C payloads (subuid_shell.c, subshell.c, rootshell.c, libsubuid.c) and uses a different method to trigger the vulnerability and create a setuid root shell at /tmp/sh. The C files implement the core logic for namespace manipulation and payload execution. The exploit requires local access and specific system configurations (user namespaces, newuidmap/newgidmap utilities, and sometimes additional services like cron, dbus, or polkit). The repository is operational and provides a working local root exploit with multiple vectors for exploitation.scheatkode · Disclosed Jan 19, 2022 · c · bash · localOperational
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
CanonicalUbuntu Linuxoperating_system
LinuxLinux Kerneloperating_system
FAQ

Frequently asked questions

Is CVE-2018-18955 exploited in the wild?
As of Oct 16, 2026, Mallory has no reports of CVE-2018-18955 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2018-18955?
Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2018-18955, the earliest disclosed Nov 15, 2018.
Is there a patch for CVE-2018-18955?
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).
What products are affected by CVE-2018-18955?
Linux Kernel and Canonical Ubuntu Linux.
How severe is CVE-2018-18955?
CVE-2018-18955 has a CVSS v3 score of 7.0 (High) and an EPSS score of 7.7% (95th percentile) as of Oct 16, 2026.
Activity feed

Recent activity

1 sources tracked across advisories and community write-ups. News coverage will land here when it surfaces.

View more in app →

No news coverage yet. Advisories and community discussion only.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activityCommunity discussion across Reddit, Mastodon, and other social sources.