[SECURITY] CVE-2024-50379 Apache Tomcat - RCE via write-enabled default servlet
Tomcat's default servlet, when write-enabled on a case-insensitive file system, could be raced so that a concurrently uploaded file bypasses case-sensitivity checks and is treated as a JSP. An attacker could then achieve remote code execution.
- Triaged in 3 days
- Fixed in 4 months
- Paid in 4 months
- Disclosed after 5 months
Summary by the program
If the default servlet is write enabled (readonly initialisation parameter set to the non-default value of false) for a case insensitive file system, concurrent read and upload under load of the same file can bypass Tomcat's case sensitivity checks and cause an uploaded file to be treated as a JSP leading to remote code execution.
https://lists.apache.org/thread/y6lj6q1xnp822g6ro70tn19sgtjmr80r
The report
Code injection triggered by a race condition on a Windows machine.
Impact
Code injection
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a time-of-check to time-of-use race: the case-sensitivity check and the file write are not atomic, so a concurrent upload can land a file that is later executed as a JSP.
Impact
An attacker could achieve remote code execution, but only when the default servlet is write-enabled and the file system is case-insensitive.
What the attacker needed
Default servlet write-enabled; case-insensitive file system; concurrent requests under load
The fix
Avoid write-enabling the default servlet on case-insensitive file systems; the text gives no fix.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Tomcat is a Java web server. Normally it stops you from uploading a file that it would later run as code, by checking the file name's letter case. If two requests happen at the same moment, that check can be skipped, so an uploaded file gets run as code.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.