Dirty Cow (CVE-2016-5195) Privilege Escalation Demo

Dirty Cow (CVE-2016-5195) Privilege Escalation Demo.

Dirty COW (CVE-2016-5195) is a privilege escalation vulnerability in the Linux Kernel.
A race condition was found in the way the Linux kernel’s memory subsystem handled the copy-on-write (COW) breakage of private read-only memory mappings. An unprivileged local user could use this flaw to gain write access to otherwise read-only memory mappings and thus increase their privileges on the system.

Lets move to the demo:

Step 1:
Download the cowroot and save it as cowroot.c

Check username you logged in as using command whoami. you can see in pic i am logged in as juniour.

Step 2:
Check you system arch, using command uname -a.
you can see in setp 1 screenshot mine arch is x86_64.

According to the arch your system arch un-comment unsigned char sc[] ….. as show in screenshot below and save it.

Step 4:
Compile the cowroot.c and save it as cowroot.
$ gcc cowroot.c -o cowroot -pthread
compile cowroot

Step 5:
Time to get root privilege.
dirty cow root privilege
Type whoami to check you got root or not.

I hope you enjoyed Dirty COW (CVE-2016-5195) demo.

Credit: dirtycow.ninja

Bookmark the permalink.


  1. my target host return this code

    ‘/10613.c: line 35: ` struct { long next, prev; } lru;
    sh-3.2$ gcc dirtyc0w.c -o dirtyc0w lpthread

    whats seems the problem

Leave a Reply

Your email address will not be published. Required fields are marked *