Skip to content
Path traversal Disclosed report Advanced CVE-2025-24813

CVE-2025-24813: Remote Code Execution and/or Information disclosure and/or malicious content added to uploaded files via write enabled Default Servlet

Apache Tomcat's partial PUT handling built a temporary file name from the user-supplied path with separators replaced by dots, which could let an attacker read or write security-sensitive files. Under specific configurations, including file-based session persistence and a deserialisation-capable library, this could lead to remote code execution.

sw0rd1ight Follow

Originally disclosed on HackerOne

Bounty$4,323 High View original
  • Disclosed after 47 days

Summary by the program

The original implementation of partial PUT used a temporary file based on the user provided file name and path with the path separator replaced by ".".

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

The report

I am sw0rd1ight.I found an Apache Tomcat RCE vulnerability in tomcat 9.0.98. 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

I reported this vulnerability through the official Apache Tomcat security email and received a fix along with a CVE number CVE-2025-24813. this is screenshot of email and ASF response email I submitted.

Impact

Execute system commands to obtain system permissions

The original report as published on HackerOne, by sw0rd1ight. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Apache Tomcat is the servlet container the report targets, and the vulnerable component is the Default Servlet, the servlet that serves static files and handles HTTP PUT/DELETE when write access is enabled. Tomcat also supports partial PUT requests, where a client uploads a file in chunks using the Content-Range header, and the container assembles the chunks into the final file. Partial PUT support is enabled by default; write access for the Default Servlet is disabled by default.

The bug is tracked as CVE-2025-24813 and covers three possible outcomes: remote code execution, information disclosure, and malicious content being added to uploaded files. The researcher reports it against Tomcat 9.0.98.

Setup

The preconditions are the heart of this issue, because the vulnerability only exists when several configuration choices line up. For the information disclosure and content injection case, all of the following had to be true:

  1. Writes enabled for the Default Servlet (disabled by default).
  2. Support for partial PUT (enabled by default).
  3. A target URL for security sensitive uploads that was a sub-directory of a target URL for public uploads.
  4. Attacker knowledge of the names of the security sensitive files being uploaded.
  5. The security sensitive files also being uploaded via partial PUT.

For the remote code execution case, all of the following had to be true:

  1. The application was using Tomcat's file based session persistence with the default storage location.
  2. The application included a library that may be leveraged in a deserialisation attack.

No accounts, roles or tooling beyond the HTTP client are described in the report. The researcher states that the finding was made against Tomcat 9.0.98.

Finding it

The researcher, sw0rd1ight, reports finding an Apache Tomcat RCE vulnerability in Tomcat 9.0.98. The report does not describe the recon steps or the exact request that first revealed the behaviour; it presents the vulnerability together with the configuration conditions under which it is exploitable, as listed above.

The interesting part is the interaction between two features that are individually reasonable: partial PUT handling and the Default Servlet's write support. Partial PUT is on by default, so any deployment that enables writes for the Default Servlet inherits the chunked upload path without asking for it.

Exploitation

The report does not include the raw HTTP requests, payloads or command output used during exploitation. It describes the two exploitation paths by their preconditions and outcomes, and the impact section states the goal: execute system commands to obtain system permissions.

Step 1: Confirm the preconditions

Check that writes are enabled for the Default Servlet and that partial PUT is available. Partial PUT is enabled by default, so the decisive check is whether the deployment allows writes through the Default Servlet. The report gives no request for this step.

Step 2: Path for information disclosure and content injection

When a security sensitive upload target is a sub-directory of a public upload target, the attacker knows the names of the security sensitive files, and those files are uploaded via partial PUT, a malicious user was able to view security sensitive files and/or inject content into those files. The report does not show the requests used to read or modify a file.

Step 3: Path for remote code execution

When the application uses Tomcat's file based session persistence with the default storage location and includes a library that may be leveraged in a deserialisation attack, a malicious user was able to perform remote code execution.

Step 4: Report to the vendor

The researcher reported the vulnerability through the official Apache Tomcat security email and received a fix along with the CVE number CVE-2025-24813. The report mentions a screenshot of the submission email and the ASF response email, but no such image is included here.

Root cause

The program's summary explains the mechanism. The original implementation of partial PUT used a temporary file based on the user provided file name and path, with the path separator replaced by ..

The dangerous combination depends on deployment choices: writes for the Default Servlet are disabled by default, so a default installation is not exposed, while partial PUT is enabled by default. The RCE path additionally depends on file based session persistence using the default storage location and on a library usable in a deserialisation attack being present on the classpath.

Impact

The report's impact statement is that an attacker can execute system commands to obtain system permissions. The program summary is more precise about the range of outcomes and their conditions:

Outcome Conditions
View security sensitive files and/or inject content into them Writes enabled for the Default Servlet; partial PUT enabled; security sensitive upload target a sub-directory of a public upload target; attacker knows the file names; those files uploaded via partial PUT
Remote code execution Writes enabled for the Default Servlet; partial PUT enabled; file based session persistence with the default storage location; a library usable in a deserialisation attack on the classpath

Both outcomes require writes to be enabled for the Default Servlet, which is not the default. The RCE outcome is further conditional on the persistence configuration and on the presence of a suitable library, so it does not apply to every Tomcat instance that enables writes.

Fix

The researcher received a fix from the Apache Tomcat security team together with the CVE assignment. What the summary makes clear is the area that had to change: the temporary file naming used by partial PUT, which was derived from the user provided file name and path with the path separator replaced by ..

Variants to test

  1. Enable writes for the Default Servlet on a test instance and send a partial PUT with a Content-Range header. A positive result is the server accepting the chunked upload and creating a temporary file whose name reflects the supplied path.
  2. Set up a public upload directory with a security sensitive upload directory beneath it, upload a file via partial PUT, then request the sensitive path. A positive result is reading the sensitive file or seeing injected content in it.
  3. Configure file based session persistence with the default storage location, place a library usable in a deserialisation attack on the classpath, and attempt to influence a session file through partial PUT. A positive result is code execution triggered when the session is deserialised.
  4. Check other servlet containers and reverse proxies that implement partial PUT for temporary file naming derived from client supplied paths. A positive result is a temporary file that can be predicted or reached from a different URL space.

Hunting notes

This class of bug hides where a file upload feature builds a temporary path from client input. During recon, the signals are a server that accepts PUT on static paths, responses to Content-Range requests, and directory layouts where an upload directory sits under a publicly served directory. The RCE variant needs a deployment using file based session persistence in the default location plus a deserialisation gadget library, which is common enough in Java applications to be worth checking once write access is confirmed.

It does show that the submission went through the official Apache Tomcat security email and that the vendor produced a fix and a CVE.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

Apache Tomcat is a piece of software that runs Java web applications on a server. Think of it as the engine room of a website: it receives the requests your browser sends and hands them to the right application. One of its built-in parts, the Default Servlet, is the component that serves plain files (images, documents, static pages) and can also accept file uploads and deletions when an administrator turns that ability on.

Tomcat can also accept a file in pieces. Instead of sending a whole file in one request, a client can send it in chunks, and Tomcat glues the chunks together into the final file. This is called a partial PUT, and it is switched on by default. Writing files through the Default Servlet, on the other hand, is switched off by default.

The researcher, sw0rd1ight, found that when several configuration conditions line up, including writing being turned on, the way Tomcat names the temporary files used for chunked uploads can be abused. Depending on how the application is set up, an attacker could read sensitive files, add content to them, or even run their own commands on the server. The bug is tracked as CVE-2025-24813 and was reported against Tomcat 9.0.98.

Context

A few words first, because the rest of the article leans on them.

  • Servlet container: software that runs Java web applications and answers HTTP requests on their behalf. Tomcat is one.
  • Servlet: a small Java program inside the container that handles a particular kind of request.
  • Default Servlet: Tomcat's built-in servlet for static files. It serves files from disk, and, if the administrator allows it, it also accepts PUT (upload or overwrite a file) and DELETE (remove a file) requests.
  • HTTP PUT: a request method whose meaning is "store this content at this address". It is the upload counterpart of GET, which means "give me what is at this address".
  • Partial PUT: an upload split into chunks. The client sends several PUT requests, each carrying a piece of the file plus a Content-Range header that says which byte range of the final file that piece covers. Tomcat collects the pieces and assembles the complete file.
  • Content-Range header: a line in the request that tells the server which part of the file is being sent, for example which bytes from the start to the end.

The vulnerable component is the Default Servlet. Partial PUT support is enabled by default; write access for the Default Servlet is disabled by default. That difference matters: a default installation is not exposed, but anyone who enables writes inherits the chunked upload path without asking for it.

The CVE covers three possible outcomes: remote code execution, information disclosure, and malicious content being added to uploaded files. Remote code execution means the attacker gets their own commands to run on the server. Information disclosure means the attacker gets to read files they should not see.

Setup

The preconditions are the heart of this issue, because the vulnerability only exists when several configuration choices line up. For the information disclosure and content injection case, all of the following had to be true:

  1. Writes enabled for the Default Servlet (disabled by default).
  2. Support for partial PUT (enabled by default).
  3. A target URL for security sensitive uploads that was a sub-directory of a target URL for public uploads.
  4. Attacker knowledge of the names of the security sensitive files being uploaded.
  5. The security sensitive files also being uploaded via partial PUT.

For the remote code execution case, all of the following had to be true:

  1. The application was using Tomcat's file based session persistence with the default storage location.
  2. The application included a library that may be leveraged in a deserialisation attack.

Two of those terms need unpacking.

  • Session: when you log in to a website, the server needs to remember who you are between requests. It stores a small record called a session, and your browser carries a session identifier so the server can find the right record. A session is like the cloakroom ticket you get at a theatre: the ticket itself is not your coat, it just lets the attendant fetch it.
  • Session persistence: keeping those session records somewhere durable, so they survive a restart. Tomcat can write them to files on disk. "File based session persistence with the default storage location" means the application uses that disk storage and did not move it from the place Tomcat uses by default.
  • Deserialisation: turning stored data back into live objects in memory. Java can save an object as a stream of bytes and later rebuild it. If an attacker can control those bytes, and the application has a library with a suitable flaw on its classpath, rebuilding the object can run code. A classpath is simply the list of libraries the application can use.

No accounts, roles or tooling beyond the HTTP client are described in the report. The researcher states that the finding was made against Tomcat 9.0.98.

Finding it

The researcher reports finding an Apache Tomcat RCE vulnerability in Tomcat 9.0.98. The report does not describe the recon steps or the exact request that first revealed the behaviour; it presents the vulnerability together with the configuration conditions under which it is exploitable, as listed above.

The interesting part is the interaction between two features that are individually reasonable: partial PUT handling and the Default Servlet's write support. Partial PUT is on by default, so any deployment that enables writes for the Default Servlet inherits the chunked upload path without asking for it. Think of a building where the front door is locked by default but a side window is open by default: neither fact is alarming alone, but together they decide whether the building is actually secure.

Exploitation

The report does not include the raw HTTP requests, payloads or command output used during exploitation. It describes the two exploitation paths by their preconditions and outcomes, and the impact section states the goal: execute system commands to obtain system permissions.

Step 1: Confirm the preconditions

Check that writes are enabled for the Default Servlet and that partial PUT is available. Partial PUT is enabled by default, so the decisive check is whether the deployment allows writes through the Default Servlet. The report gives no request for this step.

Why this step comes first: every path in this bug depends on that one setting. If writes are off, there is nothing to exploit, no matter what else is configured. It is the equivalent of checking whether the side window is actually open before planning anything around it.

Step 2: Path for information disclosure and content injection

When a security sensitive upload target is a sub-directory of a public upload target, the attacker knows the names of the security sensitive files, and those files are uploaded via partial PUT, a malicious user was able to view security sensitive files and/or inject content into those files. The report does not show the requests used to read or modify a file.

In plain terms: imagine a website with a public folder for user uploads, and inside it a private folder for files that should stay secret. Because the private folder sits underneath the public one, a naming mistake in the temporary files used for chunked uploads can make a private file reachable, or let an attacker write into it. The attacker still needs to know the file names, and those files must themselves be uploaded in chunks. Reading a file you should not see is information disclosure; writing into it is content injection.

Step 3: Path for remote code execution

When the application uses Tomcat's file based session persistence with the default storage location and includes a library that may be leveraged in a deserialisation attack, a malicious user was able to perform remote code execution.

In plain terms: the server keeps session records as files in a known place. If an attacker can influence the contents of such a file through the chunked upload path, and the application has a library whose deserialisation can be abused, then the moment the server reads that session back, the attacker's data is turned into running code. That is the step from "I can write a file" to "I can run commands".

Step 4: Report to the vendor

The researcher reported the vulnerability through the official Apache Tomcat security email and received a fix along with the CVE number CVE-2025-24813. The report mentions a screenshot of the submission email and the ASF response email, but no such image is included here.

Reporting through the vendor's private security channel rather than a public issue tracker gives the maintainers time to build and ship a fix before attackers learn the details. The CVE number is the public identifier assigned to the flaw so that everyone, from administrators to scanners, can refer to the same thing.

Root cause

The program's summary explains the mechanism. The original implementation of partial PUT used a temporary file based on the user provided file name and path, with the path separator replaced by ..

A path separator is the character that separates folders in a path, such as the slash in uploads/private/report.txt. Replacing it with a dot turns that path into a single flat name like uploads.private.report.txt. The point of the replacement is to keep the temporary file in one directory instead of recreating the folder structure. It is like a cloakroom that writes your name on the ticket by copying whatever you tell it, including the name of someone else's coat.

The dangerous combination depends on deployment choices: writes for the Default Servlet are disabled by default, so a default installation is not exposed, while partial PUT is enabled by default. The RCE path additionally depends on file based session persistence using the default storage location and on a library usable in a deserialisation attack being present on the classpath.

Impact

The report's impact statement is that an attacker can execute system commands to obtain system permissions. The program summary is more precise about the range of outcomes and their conditions:

Outcome Conditions
View security sensitive files and/or inject content into them Writes enabled for the Default Servlet; partial PUT enabled; security sensitive upload target a sub-directory of a public upload target; attacker knows the file names; those files uploaded via partial PUT
Remote code execution Writes enabled for the Default Servlet; partial PUT enabled; file based session persistence with the default storage location; a library usable in a deserialisation attack on the classpath

Both outcomes require writes to be enabled for the Default Servlet, which is not the default. The RCE outcome is further conditional on the persistence configuration and on the presence of a suitable library, so it does not apply to every Tomcat instance that enables writes.

Fix

The researcher received a fix from the Apache Tomcat security team together with the CVE assignment. What the summary makes clear is the area that had to change: the temporary file naming used by partial PUT, which was derived from the user provided file name and path with the path separator replaced by ..

Variants to test

  1. Enable writes for the Default Servlet on a test instance and send a partial PUT with a Content-Range header. A positive result is the server accepting the chunked upload and creating a temporary file whose name reflects the supplied path.
  2. Set up a public upload directory with a security sensitive upload directory beneath it, upload a file via partial PUT, then request the sensitive path. A positive result is reading the sensitive file or seeing injected content in it.
  3. Configure file based session persistence with the default storage location, place a library usable in a deserialisation attack on the classpath, and attempt to influence a session file through partial PUT. A positive result is code execution triggered when the session is deserialised.
  4. Check other servlet containers and reverse proxies that implement partial PUT for temporary file naming derived from client supplied paths. A positive result is a temporary file that can be predicted or reached from a different URL space.

A reverse proxy is a server that sits in front of the application and forwards requests to it, often handling encryption and caching. If it also implements chunked uploads, it can carry the same naming mistake.

Hunting notes

This class of bug hides where a file upload feature builds a temporary path from client input. During recon, the signals are a server that accepts PUT on static paths, responses to Content-Range requests, and directory layouts where an upload directory sits under a publicly served directory. The RCE variant needs a deployment using file based session persistence in the default location plus a deserialisation gadget library, which is common enough in Java applications to be worth checking once write access is confirmed.

A gadget library is a library that is harmless on its own but can be chained into an attack when an attacker controls the data being deserialised.

It does show that the submission went through the official Apache Tomcat security email and that the vendor produced a fix and a CVE.

Glossary

  • Apache Tomcat: a Java servlet container, the software that runs Java web applications and answers HTTP requests for them.
  • Servlet: a small Java program inside a container that handles a particular kind of request.
  • Default Servlet: Tomcat's built-in servlet that serves static files and, when enabled, accepts PUT and DELETE requests.
  • HTTP: the request and response protocol browsers and servers use to talk to each other.
  • PUT: an HTTP method meaning "store this content at this address".
  • DELETE: an HTTP method meaning "remove what is at this address".
  • GET: an HTTP method meaning "give me what is at this address".
  • Partial PUT: an upload sent in several chunks that the server assembles into one file.
  • Content-Range header: a request line stating which byte range of the final file a chunk covers.
  • Header: a line of extra information attached to an HTTP request or response.
  • Remote code execution (RCE): a flaw that lets an attacker run their own commands on a server.
  • Information disclosure: a flaw that lets an attacker read data they are not supposed to see.
  • Content injection: adding or altering content in a file the attacker should not be able to modify.
  • CVE: a public identifier assigned to a known vulnerability so everyone can refer to the same issue.
  • Session: a server-side record that lets the server recognise a returning user between requests.
  • Session persistence: storing session records somewhere durable, such as files on disk, so they survive a restart.
  • Deserialisation: rebuilding live objects in memory from stored bytes; dangerous when an attacker controls the bytes and a suitable library is present.
  • Classpath: the list of libraries a Java application can use.
  • Gadget library: a library that is harmless alone but can be chained into an attack through deserialisation.
  • Path separator: the character that separates folders in a path, such as a slash.
  • Reverse proxy: a server in front of an application that forwards requests to it.
  • Recon: the information-gathering phase before an attack, where an attacker learns how a target is configured.
  • ASF: the Apache Software Foundation, the organisation that maintains Apache projects including Tomcat.

More by sw0rd1ight

View all

4 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.