Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Dirty-Cow-Ubuntu-Server-16.04.1 — CVE-2016-5195 (Dirty COW) privilege escalation on Ubuntu Server 16.04.1 — exploit, impact & mitigation | Kitploit
Tools/GitHubGitHub/cbry-96/dirty-cow-ubuntu-server-16.04.1
Privilege EscalationVulnerability AnalysisExploitationCTFPenetration TestingLearning & EducationLabs & Practice
GitHubcbry-96/dirty-cow-ubuntu-server-16.04.1

Dirty-Cow-Ubuntu-Server-16.04.1

CVE-2016-5195 (Dirty COW) privilege escalation on Ubuntu Server 16.04.1 — exploit, impact & mitigation

View Repository
1Oct 22, 2026Not yet reviewed
Share

Dirty COW — Privilege Escalation on Ubuntu Server 16.04.1

CVE Severity Platform Bootcamp Status

Privilege escalation lab exploiting the Dirty COW vulnerability (CVE-2016-5195), a race condition in the Linux kernel's copy-on-write subsystem that allows an unprivileged user to write to read-only system files, thereby gaining root access.


Ethical notice

This lab was run on a deliberately vulnerable virtual machine (Ubuntu Server 16.04.1 without security patches), in an isolated environment and on equipment I own. No third-party system was attacked. The documented techniques are intended exclusively for educational, defensive and professional portfolio purposes. Using them against systems without express written authorization is illegal.


Summary

IndicatorValue
Target machineUbuntu Server 16.04.1 (kernel vulnerable to Dirty COW)
VectorCVE-2016-5195 — race condition in copy-on-write
Exploit40847.cpp (EDB-ID 40847, Gabriele Bonacini)
ResultPrivilege escalation: access as root
Captured flag4GEEKS{Y0u_G0t_R00t}
Context4Geeks Academy Cybersecurity Bootcamp practice

Lab environment

  • Target system: unpatched Ubuntu Server 16.04.1, running as a virtual machine.
  • Isolation: internal network with no Internet access.
  • Initial access: standard user without administrative privileges.

Methodology

  1. Reconnaissance — identification of the operating system and kernel version.
  2. Vector identification — verification that the kernel is vulnerable to CVE-2016-5195.
  3. Exploit compilation — compilation of the 40847.cpp source code on the target system.
  4. Exploitation — execution of the exploit to modify /etc/passwd and overwrite the root password.
  5. Validation — confirmation of root access and capture of the flag.

Phase 1 — Reconnaissance

Verification of the kernel version to confirm that it is vulnerable:

uname -r
cat /etc/os-release

Linux kernels prior to version 4.8.3 are vulnerable to Dirty COW. Ubuntu 16.04.1 with an unpatched kernel meets this condition.


Phase 2 — Compiling the exploit

The 40847.cpp exploit modifies the /etc/passwd file by taking advantage of the race condition in the kernel's copy-on-write mechanism. Before running it, make a backup of the original file.

g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow 40847.cpp -lutil

Phase 3 — Exploitation

Running the exploit with the -s option to disable dirty writeback and open a shell with root privileges:

./dcow -s

The exploit overwrites the root entry in /etc/passwd with a known password (dirtyCowFun), allowing access as root.

Exploit execution and root access Successful exploit execution: a shell with root privileges is obtained.


Phase 4 — Validation

Confirmation of root access and capture of the exercise flag:

whoami
# root
cat FlagUserRoot.txt
# 4GEEKS{Y0u_G0t_R00t}

Captured flag Screenshot of the flag confirming root access on the target system.


Findings

IDFindingCVESeverity
F-01Kernel vulnerable to Dirty COW — allows privilege escalation to rootCVE-2016-5195🔴 Critical (CVSS 7.8)
F-02System without security patches applied—🔴 Critical

Remediation

TimeframeAction
ImmediateUpdate the kernel to a patched version (≥ 4.8.3)
Short (7–30 days)Apply all pending security updates (apt update && apt upgrade)
Medium (30–90 days)Implement automated patch management and integrity monitoring of critical files (/etc/passwd, /etc/shadow)

Root cause: unpatched Linux kernel on an exposed system. The underlying mitigation is an update and vulnerability management cycle, not just patching this CVE.


Lessons learned

  • Privilege escalation does not always require exposed services. Dirty COW is exploited locally, which shows that an attacker with limited access (even through a web shell or SSH with a weak user) can compromise the entire system.
  • Backing up before exploiting is essential. The exploit modifies /etc/passwd; without a backup, the system could become unusable.
  • Kernel patches are critical. This vulnerability was published in 2016 and affected Linux kernels in use for nearly a decade. An unpatched system is a compromised system.

Repository structure

Dirty-Cow-Ubuntu-Server-16.04.1/
├── README.md
├── 40847.cpp                  # Exploit CVE-2016-5195 (EDB-ID 40847)
├── FlagUserRoot.txt           # Flag del ejercicio
├── dirtyrootpasswoord.png     # Evidencia: ejecución del exploit
├── flagroot.png               # Evidencia: captura del flag
└── .gitignore

Tools used

  • g++ — exploit compilation
  • Ubuntu Server 16.04.1 — vulnerable target system
  • VirtualBox — virtualization and lab isolation

References

  • NVD — CVE-2016-5195 (Dirty COW)
  • Exploit-DB — 40847
  • dirtycow.ninja — Official vulnerability page

Credits

Practice based on an exercise from the 4Geeks Academy Cybersecurity Bootcamp. The execution, evidence, and documentation in this repository are my own work.

The 40847.cpp exploit was created by Gabriele Bonacini and published under the GPL v3 license.

Author

Bryan Calderón Herrera · Cybersecurity | Networks and Telecommunications GitHub: cbry-96

Download Tool

Related Tools

  • PEASS-ng

    PEASS - Privilege Escalation Awesome Scripts SUITE (with colors)

  • PrivescCheck

    Privilege Escalation Enumeration Script for Windows

  • LinEnum

    Scripted Local Linux Enumeration & Privilege Escalation Checks

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    Callisto

    jetp1ane/callisto

    Automated binary vulnerability analysis tool that decompiles executables via Ghidra, scans pseudo-C code with Semgrep, and validates findings using GPT-3.5-Turbo to reduce false positives.

    796
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    One-tap Android kernel exploit app for CVE-2026-43499, providing privilege escalation via kernel module loading, with offset extraction and on-device analysis tools.

    735
  • 3

    IMSIcatcher

    28zaaky/imsicatcher

    IMSI Catcher platform that deploys a rogue GSM cell to intercept SMS, inject messages and track mobile devices

    721
  • 4

    opencti

    opencti-platform/opencti

    Open Cyber Threat Intelligence Platform

    535
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    424
  • 6

    DFRoot

    a2333c/dfroot

    Android root tool for Samsung Galaxy S25 Ultra (SM-S938B) that chains DirtyFrag CVE-2026-43284 and CVE-2026-43499 to gain root automatically at boot via KernelSU.

    419

Explore all tools

Browse our collection of tools

View all tools →