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.
Readme
# CVE-2024-23113

The script is designed to detect CVE-2024-23113, which is a format string vulnerability in the FortiGate FGFM service (FortiGate to FortiManager protocol) running on TCP port 541. The vulnerability occurs because an attacker can control a format string, which could lead to Remote Code Execution (RCE) or other unintended behaviors. The FGFM service allows communication between FortiGate devices and FortiManager for configuration management, and an unpatched version has improper handling of input, making it susceptible to a format string exploit.
How the Script Works

    Network Connection Setup:
        The script first sets up an SSL/TLS connection to the target on port 541.
        It uses the ssl.SSLContext object with certificate verification disabled to establish the connection, as the device might have self-signed certificates.

    Payload Construction:
        Once connected, the script crafts a malicious payload using a format string exploit (authip=%n). The %n directive tells the system to write the number of bytes output so far into a variable, which can potentially lead to memory corruption.
        The crafted payload is sent to the target through the established connection.

    Detection Logic:
        The script then checks the target's behavior in response to the payload.
        If the connection is abruptly terminated and an SSL alert is raised, it suggests that the target is vulnerable because it triggered the format string vulnerability protection mechanisms (e.g., _FORTIFY_SOURCE in glibc).
        If the connection remains open, the target is likely patched.

Usage Instructions

    Run the Script:
        Run the script with Python 3 by executing:

        sh

    python check_vulnerability.py

Enter Hostname/IP:

    You will be prompted to enter a hostname or IP address to check if it is vulnerable.
    If you want to stop, type exit.

Output:

    If the target is vulnerable, the script will output:

[!] Warning: <hostname> is vulnerable!

If the target is patched, it will output:

        [+] <hostname> appears to be patched.

Requirements

    Python 3 installed on the machine running the script.
    Network access to the target device, ensuring port 541 is open.
    The FGFM service must be running on the target device.
File Snapshot

[4.0K] /data/pocs/6edbdde75eee119af27792bf1925b0f5b3dd6ac0 ├── [2.9K] POC-CVE-2024-23113.py └── [2.3K] 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 →