Apache Tomcat CVE-2025-24813漏洞检测工具

项目标题与描述

Apache Tomcat CVE-2025-24813 PoC检测工具

本项目是一个专门用于检测Apache Tomcat服务器CVE-2025-24813漏洞的概念验证(PoC)工具。该工具通过非侵入式的方式,对目标Tomcat服务器进行安全检查,包括版本识别、HTTP PUT权限测试和会话信息收集,所有操作均记录到详细的日志报告中。

功能特性

  • CSV批量处理:支持从CSV文件批量读取目标主机(需要包含"Hostname"和"IP address"两列)
  • 非侵入式检测:执行安全检测而不对目标系统造成破坏
  • 三重安全检查
    1. 从HTTP "Server"头中提取Tomcat版本信息
    2. 测试DefaultServlet的写权限(上传测试文件后立即删除)
    3. 获取目标服务器的会话ID
  • 完整日志记录:所有操作都带有时间戳和严重级别记录到控制台和报告文件
  • SSL支持:可处理HTTPS连接(默认禁用SSL警告用于测试)

安装指南

系统要求

  • Python 3.x
  • 网络连接权限
  • 对目标服务器的网络访问权限

依赖安装

bash 复制代码
pip install requests

安装步骤

  1. 克隆或下载项目文件到本地
  2. 确保Python环境已安装
  3. 安装所需的requests库
  4. 准备包含目标信息的CSV文件

使用说明

基础使用

  1. 准备CSV文件(如targets.csv),格式如下:
csv 复制代码
Hostname,IP address
TestServer,192.168.56.101
AnotherServer,192.168.56.102
  1. 运行检测脚本:
bash 复制代码
python3 cve_2025_24813_poc.py --csv targets.csv

输出说明

  • 控制台实时显示检测进度和结果
  • 在当前工作目录生成CVE_2025_24813_report.txt报告文件
  • 报告包含时间戳、检测目标和详细结果

核心代码

1. 报告初始化模块

python 复制代码
def init_report():
    """Initializes the report file in the current working directory."""
    global REPORT_FILE
    REPORT_FILE = os.path.join(os.getcwd(), "CVE_2025_24813_report.txt")
    try:
        with open(REPORT_FILE, 'w') as f:
            f.write("CVE-2025-24813 PoC Check Report\n")
            f.write(f"Start Time: {datetime.now()}\n")
            f.write("=" * 60 + "\n")
        log_message("INFO", "Report initialized.")
    except Exception as e:
        log_message("ERROR", f"Failed to initialize report file '{REPORT_FILE}': {e}")

2. 日志记录模块

python 复制代码
def log_message(level, message):
    """
    Logs a message with a timestamp and severity to the report file and prints it to the console.
    """
    timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    formatted = f"{timestamp} - {level} - {message}"
    print(f"{level}: {message}")
    try:
        with open(REPORT_FILE, 'a') as f:
            f.write(formatted + "\n")
    except Exception as e:
        pass

3. 主脚本结构

python 复制代码
#!/usr/bin/env python3
"""
PoC for CVE-2025-24813 (HTTP-based Checks Only) with CSV Input and Incremental Reporting

This script accepts a CSV file (with columns "Hostname" and "IP address") from the current working directory.
For each target, it performs the following non-intrusive checks:
  1. Extracts the Tomcat version from the HTTP "Server" header.
  2. Attempts an HTTP PUT on "CVE-2025-24813-check.txt" (with content "ThreatOPS was here --> MichaelFry@livenation.com")
     to determine if the DefaultServlet is write-enabled, then deletes the file.
  3. Retrieves a session ID from the target.
All actions are logged (with timestamps and severity levels) to the console and a report file in the CWD.
"""

4. 安全配置

python 复制代码
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

# Disable SSL warnings for testing purposes
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

该代码设计为模块化结构,核心功能包括报告生成、日志记录和HTTP请求处理,确保检测过程的安全性和可追溯性。 6HFtX5dABrKlqXeO5PUv/xT3pvZhDSsm+vWSaxtXdTeO7ytUMNgVPToBhhL/tOZRxYBBwPndIbnaQlVbqmBmGQ==

相关推荐
那个村的李富贵1 天前
光影魔术师:CANN加速实时图像风格迁移,让每张照片秒变大师画作
人工智能·aigc·cann
墨风如雪1 天前
16个AI两周手搓编译器:Claude Opus 4.6 正在改写代码规则
aigc
腾讯云开发者1 天前
“痛点”到“通点”!一份让 AI 真正落地产生真金白银的实战指南
人工智能
CareyWYR1 天前
每周AI论文速递(260202-260206)
人工智能
hopsky1 天前
大模型生成PPT的技术原理
人工智能
禁默1 天前
打通 AI 与信号处理的“任督二脉”:Ascend SIP Boost 加速库深度实战
人工智能·信号处理·cann
心疼你的一切1 天前
昇腾CANN实战落地:从智慧城市到AIGC,解锁五大行业AI应用的算力密码
数据仓库·人工智能·深度学习·aigc·智慧城市·cann
种时光的人1 天前
CANN仓库核心解读:catlass夯实AIGC大模型矩阵计算的算力基石
线性代数·矩阵·aigc
AI绘画哇哒哒1 天前
【干货收藏】深度解析AI Agent框架:设计原理+主流选型+项目实操,一站式学习指南
人工智能·学习·ai·程序员·大模型·产品经理·转行
数据分析能量站1 天前
Clawdbot(现名Moltbot)-现状分析
人工智能