# CVE-2025-24813: Apache Tomcat: Potential RCE and/or information disclosure and/or information corruption with partial PUT

The Markdown version of <https://upatch.dev/cve/CVE-2025-24813>. Last updated 25 Nov 2026.

## At a glance

CVE-2025-24813 is rated Critical 9.8 (CVSS 3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). It affects Apache Tomcat (Apache Software Foundation) and was published on 10 Mar 2025. It is known exploited: CISA added it to its Known Exploited Vulnerabilities catalog on 1 Apr 2025. Its EPSS score is 99.9%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2025-24813-tomcat-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2025-24813, "Apache Tomcat: Potential RCE and/or information disclosure and/or information corruption with partial PUT", was published by Apache on 10 March 2025. When the DefaultServlet accepts writes (`readonly` set to `false`, off by default), a PUT with a `Content-Range` header makes Tomcat copy the resource into the web application's work directory under the request path with every `/` replaced by `.`. A partial PUT to `/evil/session` writes `work/<engine>/<host>/<app>/.evil.session`. When sessions are persisted by a `PersistentManager` with a `FileStore` in its default location, which is that same directory, a request carrying the cookie `JSESSIONID=.evil` makes Tomcat deserialize the attacker's file. That runs code when a deserialization gadget library is on the class path. The same file naming also lets an attacker view or inject content into files uploaded by partial PUT.

### Official description

Path Equivalence: 'file.Name' (Internal Dot) leading to Remote Code Execution and/or Information disclosure and/or malicious content added to uploaded files via write enabled Default Servlet in Apache Tomcat.

This issue affects Apache Tomcat: from 11.0.0-M1 through 11.0.2, from 10.1.0-M1 through 10.1.34, from 9.0.0.M1 through 9.0.98. The following versions were EOL at the time the CVE was created but are known to be affected: 8.5.0 though 8.5.100. Other, older, EOL versions may also be affected.

If all of the following were true, a malicious user was able to view security sensitive files and/or inject content into those files: - writes enabled for the default servlet (disabled by default) - support for partial PUT (enabled by default) - a target URL for security sensitive uploads that was a sub-directory of a target URL for public uploads - attacker knowledge of the names of security sensitive files being uploaded - the security sensitive files also being uploaded via partial PUT

If all of the following were true, a malicious user was able to perform remote code execution: - writes enabled for the default servlet (disabled by default) - support for partial PUT (enabled by default) - application was using Tomcat's file based session persistence with the default storage location - application included a library that may be leveraged in a deserialization attack

Users are recommended to upgrade to version 11.0.3, 10.1.35 or 9.0.99, which fixes the issue.

## What the upatch does

Two BPF LSM programs return `-EPERM` to processes whose executable is named `java`, in an application's work directory (`work/<engine>/<host>/<app>/`, as in `work/Catalina/localhost/ROOT` or an embedded Tomcat's `work/Tomcat/localhost/ROOT`):

| Hook               | Refused                                                                |
| ------------------ | ---------------------------------------------------------------------- |
| `lsm/inode_create` | Creating a file whose name starts with `.` directly in that directory  |
| `lsm/file_open`    | Opening a file there whose name starts with `.` and ends in `.session` |

Every file the vulnerable partial PUT writes starts with `.`, because a request path starts with `/`. Session ids never do. The `file_open` program also stops a payload that was planted before the upatch was loaded. Each program tests one byte of the file name first, and returns when it isn't `.`. A refusal from an earlier BPF LSM program on the same hook is passed on.

The `refused` per-CPU array counts refusals: key 0 for creates, key 1 for opens.

The policy: [`cve-2025-24813-tomcat-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2025-24813), 172 lines of BPF C attached at `lsm/inode_create` and `lsm/file_open`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Every partial PUT to a vulnerable Tomcat fails with HTTP 500, because its temporary file can't be created. This matches Apache's workaround of disabling partial PUT. Full PUTs keep working.
- A Java process can't create dot files directly in an application's work directory, or open dot-named `.session` files there. Tomcat itself never names sessions or compiled JSPs that way, and other files and subdirectories are untouched.
- Fixed Tomcat releases name their partial PUT temporary file `put-part-*`, which the upatch leaves alone.
- Not covered: a JVM started through a launcher whose executable isn't named `java`, a `workDir` outside the `work/<engine>/<host>/<app>` layout, and a dot file that existed before the upatch was loaded and doesn't end in `.session` (a partial PUT to that path reuses it).

## Preemption model and cost

The programs keep no state beyond the refusal counter, which they update with an atomic add, so they're correct under every preemption model, including preemptible RCU and `PREEMPT_RT`. On nearly every file create and open, a run costs one read of the name's first byte. Only dot-named files go on to the parent-directory and executable-name checks.

## Affected versions

Apache Tomcat:

| Branch | Affected             | Fixed in            |
| ------ | -------------------- | ------------------- |
| 11.0   | 11.0.0-M1 to 11.0.2  | 11.0.3              |
| 10.1   | 10.1.0-M1 to 10.1.34 | 10.1.35             |
| 9.0    | 9.0.0.M1 to 9.0.98   | 9.0.99              |
| 8.5    | 8.5.0 to 8.5.100     | never (end of life) |

Kernels: the program uses the `inode_create` LSM hook prototype that takes the mount's idmap as its first argument, as current mainline and bpf-next do. CO-RE relocates field offsets, not hook argument positions, so on a kernel with the older three-argument hook the verifier should refuse the program, which reads one argument past that hook's end. This was not tested on such a kernel.

## How it was tested

On a vulnerable Tomcat 9.0.98, the loaded upatch stopped both exploit steps: the partial PUT wrote no file and a planted session file was no longer deserialized. Normal uploads and sessions kept working.

- **Tested:** 24 Nov 2026
- **Target:** Apache Tomcat 9.0.98 on OpenJDK 21.0.13, DefaultServlet readonly=false, PersistentManager with FileStore, commons-collections 3.2.1, loopback only
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Machine:** EC2 t3.large
- **Distribution:** Ubuntu 26.04
- **shirudo:** 154afeea

### Results

| State           | Partial PUT writes the dot file | Planted .session deserialized (code runs as tomcat) | Full PUT | Normal session |
| --------------- | ------------------------------- | --------------------------------------------------- | -------- | -------------- |
| Before loading  | yes (HTTP 409)                  | yes                                                 | 201      | 200            |
| Upatch loaded   | no (HTTP 500)                   | no                                                  | 201      | 200            |
| After unloading | yes (HTTP 409)                  | yes                                                 | 201      | 200            |

- [Video](https://upatch.dev/media/cve-2025-24813-demo.mp4): Two minutes on the lab machine: the exploit runs code as tomcat, the upatch loads without a restart, the same exploit fails, and root cannot remove it.

## How to apply

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2025-24813
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2025-24813-1.0.0.bee oci://<registry>/<namespace>/cve-2025-24813 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2025-24813-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: shimont and romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [CVE-2025-24813 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2025-24813)
- [Apache announcement](https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq)
- [Apache Tomcat 9 security page](https://tomcat.apache.org/security-9.html), with the [10](https://tomcat.apache.org/security-10.html) and [11](https://tomcat.apache.org/security-11.html) pages
- Fix commits: [9.0.x eb61aade8f8d](https://github.com/apache/tomcat/commit/eb61aade8f8daccaecabf07d428b877975622f72), [10.1.x f6c01d6577cf](https://github.com/apache/tomcat/commit/f6c01d6577cf9a1e06792be47e623d36acc3b5dc), [11.0.x be8c59972afb](https://github.com/apache/tomcat/commit/be8c59972afbfdc25e3e8e00fe0c86aef626ca77)

### Links

- [CVE-2025-24813 on upatch.dev](https://upatch.dev/cve/CVE-2025-24813) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2025-24813)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2025-24813)
- [Vendor advisory](https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq)
- [CWE-44](https://cwe.mitre.org/data/definitions/44.html)
- [CWE-502](https://cwe.mitre.org/data/definitions/502.html)
- [CWE-706](https://cwe.mitre.org/data/definitions/706.html)
- Upatch source: [upatches/cve-2025-24813](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2025-24813)

### More references from NVD (9)

- [lists.apache.org](https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq) (Vendor Advisory)
- [openwall.com](http://www.openwall.com/lists/oss-security/2025/03/10/5) (Mailing List, Third Party Advisory)
- [lists.debian.org](https://lists.debian.org/debian-lts-announce/2025/04/msg00003.html) (Mailing List, Third Party Advisory)
- [security.netapp.com](https://security.netapp.com/advisory/ntap-20250321-0001/) (Third Party Advisory)
- [vicarius.io](https://www.vicarius.io/vsociety/posts/cve-2025-24813-detect-apache-tomcat-rce) (Issue Tracking)
- [vicarius.io](https://www.vicarius.io/vsociety/posts/cve-2025-24813-mitigate-apache-tomcat-rce) (Issue Tracking)
- [vicarius.io](https://www.vicarius.io/vsociety/posts/cve-2025-24813-tomcat-detect-vulnerability) (Issue Tracking)
- [vicarius.io](https://www.vicarius.io/vsociety/posts/cve-2025-24813-tomcat-mitigation-vulnerability) (Issue Tracking)
- [cisa.gov](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2025-24813) (Third Party Advisory, US Government Resource)
