Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2024-23113 PoC — Fortinet FortiOS 格式化字符串错误漏洞

Source
Associated Vulnerability
Title:Fortinet FortiOS 格式化字符串错误漏洞 (CVE-2024-23113)
Description:A use of externally-controlled format string in Fortinet FortiOS versions 7.4.0 through 7.4.2, 7.2.0 through 7.2.6, 7.0.0 through 7.0.13, FortiProxy versions 7.4.0 through 7.4.2, 7.2.0 through 7.2.8, 7.0.0 through 7.0.14, FortiPAM versions 1.2.0, 1.1.0 through 1.1.2, 1.0.0 through 1.0.3, FortiSwitchManager versions 7.2.0 through 7.2.3, 7.0.0 through 7.0.3 allows attacker to execute unauthorized code or commands via specially crafted packets.
Description
CVE-2024-23113 是存在于某特定软件或系统中的一个安全漏洞,该漏洞允许恶意攻击者在特定条件下利用系统中的缺陷实现未经授权的行为。这种行为可能包括但不限于远程代码执行、访问敏感信息或以更高权限执行操作。
Readme
# CVE-2024-23113

该脚本旨在检测CVE-2024-23113漏洞,这是FortiGate FGFM服务(FortiGate与FortiManager协议)在TCP端口541上运行时存在的格式字符串漏洞。此漏洞的成因在于攻击者可以控制格式字符串,从而可能导致远程代码执行(RCE)或其他意外行为。FGFM服务用于FortiGate设备和FortiManager之间的配置管理通信,未修补的版本在处理输入时存在不当,因而容易受到格式字符串漏洞的利用。

## 脚本工作原理

1. **网络连接设置**:
   - 脚本首先在目标设备的端口541上设置SSL/TLS连接。
   - 它使用`ssl.SSLContext`对象,并禁用了证书验证,以便与可能使用自签名证书的设备建立连接。

2. **有效负载构造**:
   - 连接建立后,脚本使用格式字符串漏洞(如`authip=%n`)构造恶意有效负载。`%n`指令告诉系统将到目前为止输出的字节数写入变量,这可能导致内存损坏。
   - 该恶意有效负载通过已建立的连接发送至目标设备。

3. **检测逻辑**:
   - 脚本接着检查目标设备在收到有效负载后的行为。
   - 如果连接突然中断并引发SSL警告,这表明目标存在漏洞,因为触发了格式字符串漏洞的保护机制(例如,glibc中的_FORTIFY_SOURCE)。
   - 如果连接保持打开状态,则表明目标设备可能已经打上补丁。

## 使用说明

1. **运行脚本**:
   - 使用Python 3运行脚本,执行以下命令:

     ```sh
     python POC-CVE-2024-23113.py
     ```

2. **输入主机名/IP**:
   - 系统会提示你输入要检查是否存在漏洞的主机名或IP地址。如果想退出,输入`exit`即可。

3. **输出结果**:
   - 如果目标设备存在漏洞,脚本会输出:

     ```
     [!] 警告:<hostname> 存在漏洞!
     ```

   - 如果目标设备已打上补丁,脚本会输出:

     ```
     [+] <hostname> 看起来已打上补丁。
     ```

## 要求

- 运行脚本的机器需要安装Python 3。
- 必须有对目标设备的网络访问权限,并确保端口541是开放的。
- 目标设备上必须运行FGFM服务。
File Snapshot

[4.0K] /data/pocs/5e150e1b63f816a6fcaadc6d9ff0dccf5b4ae4cc ├── [4.3K] POC-CVE-2024-23113.py └── [2.1K] README.md 0 directories, 2 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →