Exploit-DB (searchsploit)
You can download the .cpp (C++) script with the following command:
1
searchsploit -m linux/local/40847.cpp
This is to compile within the compromised machine:
1
g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow 40847.cpp -lutil
This only works if the machine is vulnerable to dirty cow, you can use linpeas or linux exploit suggester to check for it. And also the machine must has the
g++
installed for the exploit compilation.