CVE-2016-5195
Linux Kernel — Linux Kernel Race Condition Vulnerability
Description
Race condition in mm/gup.c in the Linux kernel 2.x through 4.x before 4.8.3 allows local users to gain privileges by leveraging incorrect handling of a copy-on-write (COW) feature to write to a read-only memory mapping, as exploited in the wild in October 2016, aka "Dirty COW."
Response & Mitigation
Why act now?
Prioritisation rationale
Dirty COW is one of the most widely recognised Linux privilege-escalation vulnerabilities ever published, with an EPSS score of 83.5 % (99.7th percentile) reflecting the near-certainty of exploitation attempts against any exposed system. The CVSS v3 base score of 7.0 (AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H) is local-only, but that constraint is routinely satisfied in shared-shell environments, CI/CD pipelines, multi-tenant container hosts, and any system where SSH access is granted to more than one user. For NIS2-scoped organisations, priority should be treated as critical wherever unpatched Linux hosts carry interactive user sessions; the absence of the CISA ransomware-campaign flag does not diminish the risk, as the vulnerability is a reliable stepping stone in post-exploitation chains leading to full host compromise and lateral movement.
Runbook · Step 1
Immediate response (0-24 h)
- Check the kernel version on all Linux systems (
uname -r): any kernel from 2.x through 4.x before 4.8.3 is vulnerable — apply the distribution vendor patch immediately (RHEL/CentOS: RHSA-2016:2098 or equivalent; Ubuntu: USN-3107-1 / USN-3107-2; Debian: DSA-3696-1). - Systems that cannot be patched immediately should have interactive user access restricted to the minimum necessary set of authenticated accounts — Dirty COW requires local code execution, so the primary attack surface is SSH, web shells, or shared-shell environments.
- Audit all interactive user accounts on affected hosts for unexpected UID-0 entries or new SUID binaries:
find / -perm -4000 -user root 2>/dev/null. - Inspect running process trees for suspicious child processes spawned by web servers, database services, or container runtimes (
ps auxfor EDR process-ancestry view). - On container hosts (Docker, LXC, Kubernetes nodes), confirm the host kernel is patched — containers share the host kernel and are directly exposed regardless of image hardening.
- After patching, reboot the host to activate the new kernel; evaluate kexec as a low-downtime alternative only if a full reboot is operationally impossible.
Runbook · Step 2
Mitigation layers
- Network segmentation / access control: Restrict SSH access to bastion hosts; disable direct interactive logins on production systems. Every reduction in the number of local users directly shrinks the exploitable attack surface.
- Least privilege / IAM: Minimise unprivileged user accounts; audit and trim
sudoentries (visudo,/etc/sudoers.d/) to remove any unnecessary privilege grants. - Kernel hardening (short-term): Set
vm.mmap_min_addrto a higher value (sysctl -w vm.mmap_min_addr=65536) to reduce null-pointer exploit paths — note this does not fully block Dirty COW itself. Enforce SELinux or AppArmor in enforcing mode to raise the cost of post-exploitation steps. - File integrity monitoring: Apply AIDE or equivalent FIM to critical binaries and
/etc/passwd,/etc/shadow— Dirty COW is frequently used to overwrite these files directly to add a root-level backdoor account. - Container isolation: Enable seccomp profiles and user namespaces; block
--privilegedcontainer launches via OPA/Gatekeeper policy or Kubernetes Pod Security Admission. - Audit logging: Enable
auditdrules for write access to/proc/self/memand/proc/*/membefore the patch is deployed (see Detection rules).
Runbook · Step 3
Detection rules
- auditd — /proc/self/mem writes:
-a always,exit -F arch=b64 -S write -F path=/proc/self/mem -k dirtycow— alert on every hit; legitimate use of this path is extremely rare in production environments. - auditd — passwd/shadow modification: Monitor write access to
/etc/passwdand/etc/shadowby any process other thanpasswd,useradd, orchpasswd:-w /etc/passwd -p wa -k passwd_modification. - Sysmon (Linux) / EDR process tree: Alert when a process running as a non-root UID spawns a child process with UID 0 — Sigma shape:
EventID: 1, User: != root, ParentUser: != root, IntegrityLevel: System. - KQL (Microsoft Sentinel / Defender for Endpoint):
DeviceProcessEvents | where InitiatingProcessAccountSid != "S-1-5-18" and AccountSid == "S-1-5-18" | where FileName in ("bash","sh","python","perl")— catches the privilege-escalation moment when a root-context shell is spawned from a non-root parent. - Network telemetry (Zeek / Suricata): Correlate outbound connections from processes with an unexpected UID-0 context shortly after a non-root user login event — join
auth.logentries with netflow to surface post-exploitation lateral movement or C2 beaconing.
Metrics
Public exploit references
Public proof-of-concepts and detection templates for this vulnerability. Maturity ranges from reported PoCs through working detection scripts up to fully weaponized exploit modules. NEOSEC mirrors the code internally for forensic analysis; externally we only link to the original sources.
References & sources
- http://rhn.redhat.com/errata/RHSA-2016-2107.htmlvendor-advisoryx_refsource_REDHAT
- https://www.exploit-db.com/exploits/40616/exploitx_refsource_EXPLOIT-DB
- https://access.redhat.com/errata/RHSA-2017:0372vendor-advisoryx_refsource_REDHAT
- https://bto.bluecoat.com/security-advisory/sa134x_refsource_CONFIRM
- https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05352241x_refsource_CONFIRM
- http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.htmlx_refsource_CONFIRM
- https://www.exploit-db.com/exploits/40839/exploitx_refsource_EXPLOIT-DB
- https://dirtycow.ninjax_refsource_MISC
- https://www.exploit-db.com/exploits/40847/exploitx_refsource_EXPLOIT-DB
- http://rhn.redhat.com/errata/RHSA-2016-2118.htmlvendor-advisoryx_refsource_REDHAT
- http://rhn.redhat.com/errata/RHSA-2016-2128.htmlvendor-advisoryx_refsource_REDHAT
- https://source.android.com/security/bulletin/2016-12-01.htmlx_refsource_CONFIRM
- http://rhn.redhat.com/errata/RHSA-2016-2120.htmlvendor-advisoryx_refsource_REDHAT
- http://www.openwall.com/lists/oss-security/2016/10/26/7mailing-listx_refsource_MLIST
- http://rhn.redhat.com/errata/RHSA-2016-2133.htmlvendor-advisoryx_refsource_REDHAT
- http://rhn.redhat.com/errata/RHSA-2016-2098.htmlvendor-advisoryx_refsource_REDHAT
- https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03761en_usx_refsource_CONFIRM
- https://www.kb.cert.org/vuls/id/243144third-party-advisoryx_refsource_CERT-VN
- https://bugzilla.suse.com/show_bug.cgi?id=1004418x_refsource_CONFIRM
- http://www.securitytracker.com/id/1037078vdb-entryx_refsource_SECTRACK