macOS ◆ xterm-256color ◆ bash 7195 views

This is a simple PoC of CVE-2016-5195 (AKA Dirty COW) against an Ubuntu 16.04 VM spun up on Scaleway.

After downloading and compiling the PoC, we then create a file named /tmp/.pwn. We can place what ever we want in this script, so long as it ends in /bin/bash. We then save this file, and set it to executable.

We now use the PoC to overwrite the first line in /etc/passwd, changing the default shell for the root user to point to our malicious /tmp/.pwn script.

Next time root logs in, the script /tmp/.pwn will execute. We of course could put a reverse shell in here, or any other piece of nastiness in order to elevate to root.