
Detects and exploits Apache Tomcat CVE-2025-55752 directory traversal via Rewrite Valve, enabling PUT-based JSP upload and remote code execution.
🚨🚨 CVE-2025-55752 — Apache Tomcat: Directory-protection bypass via Rewrite Valve → PUT-based RCE🚨🚨 Summary
CVE-2025-55752 is a security regression in Apache Tomcat introduced while fixing bug #60013. When the Rewrite Valve is used, Tomcat applies path normalization before URL decoding. This incorrect ordering enables crafted URIs to bypass the access checks implemented in StandardContextValve.java for protected paths such as /WEB-INF/ and /META-INF/. If the server accepts HTTP PUT requests (or exposes any writable file-upload endpoint), an attacker can upload malicious artifacts (for example .jsp or serialized sessions) and achieve remote code execution (RCE).
🚨 Affected versions
Older end-of-life (EOL) Tomcat branches that included the rewrite/normalization change may also be affected. Verify against your specific distribution/vendor build.
🚨 Impact
PUT🚨🚨 Technical details (concise)
StandardContextValve protections for /WEB-INF/ and /META-INF/.PUT or has a file-upload endpoint that places files under the webapp document root, the attacker can write .jsp or other executable content into a location that the server serves/executed, resulting in RCE.Remediation & defense strategies
Immediate (recommended)
Upgrade Tomcat to a fixed, supported release as soon as possible:
If immediate upgrade is not feasible (temporary mitigations)
Disable HTTP PUT at the server, connector, or reverse-proxy level (e.g., via web server config or firewall rules).
Harden / remove Rewrite rules that allow arbitrary rewriting to writable locations; specifically remove rules that rewrite or forward query parameters into file paths.
Harden file-upload handling in web applications:
/WEB-INF/, /META-INF/, or any application classpath.Filter/Block exploit URIs at perimeter (WAF / reverse proxy) by blocking suspicious encoded payloads and patterns that attempt to bypass /WEB-INF or /META-INF protections.
Least privilege for file stores: ensure webapp process cannot write to directories that are served or executed by the container.
Function Overview
This tool performs two-step detection based on the official CVE-2025-55752 description:
Attempts to exploit the incorrect ordering of URL normalization before decoding in Apache Tomcat’s Rewrite Valve, allowing path traversal to protected locations like /WEB-INF or /META-INF.
Attempts to upload a test JSP file via HTTP PUT, then checks if the protection mechanisms can be bypassed to access the uploaded file.
Check if path traversal to protected directories is possible:
python3 cve_2025_55752_detector.py http://target:8080 --check
Attempt to upload a JSP file and test access bypass:
python3 cve_2025_55752_detector.py http://target:8080
🔧 Customize the filename and payload content:
python3 cve_2025_55752_detector.py http://target:8080 --filename exploit.jsp --payload "<% out.println('PWNED'); %>"