☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
CVSS: 6.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H 🐛 CWE-1333
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2024-12391

CVE-2024-12391 Denial of Service in Binary-husky
📅 PUBLISHED: 2025-03-20 10:10 UTC 🔄 UPDATED: 2026-08-21 19:35 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.63%
👁️
0.63% probability
15.8× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1498
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS VECTOR BREAKDOWN 6.5
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: N Privileges Required None
UI: N User Interaction None
S: U Scope Unchanged
C: N Confidentiality None
I: N Integrity None
A: H Availability High
6.5
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-12391 is a Regular Expression Denial of Service (ReDoS) vulnerability identified in the binary-husky/gpt_academic project, specifically in the function 解析项目源码(手动指定和筛选源码文件类型) (Parse Project Source Code – Manually Specify and Filter Source File Types). The vulnerability exists as of commit 310122f and allows an attacker who can control both the regular expression pattern and the search string to cause the Python RE engine to take exponential time to process the input. This leads to a Denial of Service (DoS) condition, potentially hanging the server for an arbitrary amount of time. The CVSS score is 6.5 (Medium), with a network attack vector and low attack complexity. No patch is currently available, and the EPSS score is 0.0%, indicating low exploitation likelihood at this time.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability affects the gpt_academic Python package, which is distributed via PyPI. Users who install this package from PyPI are at risk if they expose the vulnerable function to user-controlled input. The supply chain risk is elevated because the package is open-source and may be integrated into larger systems without proper input validation. Organizations should audit their use of gpt_academic and ensure that the vulnerable function is not exposed to untrusted users.

CVSS Breakdown & Threat Level

  • CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
  • Base Score: 6.5 (Medium)
  • Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
  • Attack Complexity: Low (AC:L) – No special conditions are required.
  • Privileges Required: None (PR:N) – No authentication needed.
  • User Interaction: None (UI:N) – No user action required.
  • Scope: Unchanged (S:U) – The impact is confined to the vulnerable component.
  • Confidentiality Impact: None (C:N) – No data exposure.
  • Integrity Impact: None (I:N) – No data modification.
  • Availability Impact: High (A:H) – The service can be rendered unavailable.

Threat Level: Medium. While the impact is limited to availability, the ease of exploitation (low complexity, no privileges) makes it a viable vector for disrupting services.

Deep Dive & Mechanics

The vulnerability resides in the function 解析项目源码(手动指定和筛选源码文件类型), which allows users to provide custom regular expressions for filtering source code files. The Python re module uses a backtracking engine that can exhibit exponential time complexity for certain patterns, especially when combined with a malicious input string.

Mechanism:

  1. The user supplies a regular expression pattern (e.g., ^(a+)+$) and a search string (e.g., "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab").
  2. The Python RE engine attempts to match the pattern against the string. For patterns with nested quantifiers (like (a+)+), the engine may try an exponential number of backtracking paths.
  3. This causes the CPU to spike and the server to hang, effectively denying service to legitimate users.

Example of a malicious pattern: ^(a+)+$ with input "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" (where the b at the end forces backtracking).

Vulnerable vs. Patched Code

Vulnerable Code (commit 310122f): The function 解析项目源码 accepts user-provided regular expressions without any validation or timeout. The vulnerable snippet is conceptually:

def parse_source_code(regex_pattern, search_string):
    # No validation or timeout
    matches = re.findall(regex_pattern, search_string)
    return matches

Patched Code (Hypothetical): A patch would involve:

  1. Validating the regular expression pattern to reject known ReDoS patterns.
  2. Implementing a timeout for regex execution using signal or threading.
  3. Using a safer regex engine like regex library with timeout support.
import signal
import re

def parse_source_code(regex_pattern, search_string):
    # Validate pattern (basic check)
    if '^(' in regex_pattern and '+)+' in regex_pattern:
        raise ValueError("Potentially dangerous regex pattern")
    
    # Set a timeout for regex execution
    class TimeoutError(Exception):
        pass
    
    def handler(signum, frame):
        raise TimeoutError("Regex execution timed out")
    
    signal.signal(signal.SIGALRM, handler)
    signal.alarm(5)  # 5-second timeout
    
    try:
        matches = re.findall(regex_pattern, search_string)
    except TimeoutError:
        return []
    finally:
        signal.alarm(0)
    
    return matches

Exploitation & Lab Setup

Red Team (Exploitation)

Prerequisites:

  • Access to the gpt_academic instance with the vulnerable function exposed.
  • Ability to send HTTP requests to the endpoint that triggers 解析项目源码.

Exploit Steps:

  1. Identify the endpoint that accepts user-provided regular expressions (e.g., /parse_source_code).
  2. Craft a malicious regex pattern and input string. Example:
    • Pattern: ^(a+)+$
    • Input: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" (30 as followed by b)
  3. Send the request:
    curl -X POST http://target:port/parse_source_code \
         -d 'pattern=^(a+)+$&input=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab'
    
  4. The server will hang for an extended period (potentially minutes or hours), causing a DoS.

Expected Outcome: The server becomes unresponsive to other requests, and CPU usage spikes to 100%.

Blue Team (Detection & Defense)

Detection:

  • Monitor for requests with suspicious regex patterns (e.g., patterns with nested quantifiers like (a+)+, (a|aa)+, etc.).
  • Set up alerts for high CPU usage on the server.
  • Use WAF rules to block requests containing known ReDoS patterns.

Defense:

  • Implement input validation to reject patterns that match ReDoS signatures.
  • Use a timeout mechanism for all regex operations (e.g., signal.alarm or threading.Timer).
  • Limit the length of input strings and regex patterns.
  • Consider using a non-backtracking regex engine like re2 (via python-re2).

Indicators of Compromise (IOCs)

  • Network IOCs:

    • HTTP POST requests to endpoints like /parse_source_code with parameters pattern and input.
    • Patterns containing nested quantifiers (e.g., (a+)+, (a|aa)+, (a*)*).
    • Input strings with long sequences of repeating characters followed by a non-matching character.
  • System IOCs:

    • High CPU usage (near 100%) on the server.
    • Long-running Python processes consuming excessive CPU time.
    • Log entries showing regex execution times exceeding normal thresholds.
  • File IOCs:

    • Temporary files or logs containing malicious regex patterns.

Detection Engineering

YARA Rule

rule ReDoS_Attack_Pattern {
    meta:
        description = "Detects potential ReDoS attack patterns in HTTP requests"
        author = "Valters IT"
        date = "2025-04-10"
        cve = "CVE-2024-12391"
    strings:
        $pattern1 = /pattern=.*\([a-z]+\+\)\+/ nocase
        $pattern2 = /pattern=.*\([a-z]+\|\)\+/ nocase
        $pattern3 = /pattern=.*\([a-z]+\*\)\*/ nocase
        $input_long = /input=[a-z]{20,}[^a-z]/ nocase
    condition:
        any of ($pattern*) and $input_long
}

Sigma Rule

title: ReDoS Attack Detection for CVE-2024-12391
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP requests with malicious regex patterns targeting gpt_academic
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: apache
detection:
    selection:
        cs-method: 'POST'
        cs-uri-query|contains: '/parse_source_code'
        cs-uri-query|re: 'pattern=.*\([a-z]+\+\)\+'
        cs-uri-query|re: 'input=[a-z]{20,}[^a-z]'
    condition: selection
falsepositives:
    - Legitimate use of complex regex patterns (rare)
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2024-12391 ReDoS Attack Attempt"; flow:to_server; content:"POST"; http_method; content:"/parse_source_code"; http_uri; pcre:"/pattern=.*\([a-z]+\+\)\+/Ri"; pcre:"/input=[a-z]{20,}[^a-z]/Ri"; classtype:attempted-dos; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Disable the vulnerable function if not required, or restrict access to trusted users only.
  2. Implement input validation to reject regex patterns with nested quantifiers (e.g., (a+)+, (a|aa)+, (a*)*).
  3. Set a timeout for all regex operations using signal.alarm or threading.Timer (e.g., 5 seconds).
  4. Use a safer regex engine like re2 (via python-re2 library) which guarantees linear time execution.

Long-term Fix:

  • Monitor the binary-husky/gpt_academic repository for an official patch.
  • Apply the patch as soon as it becomes available.
  • Conduct a security review of all user-supplied input handling in the application.

Workaround:

  • If patching is not possible, consider using a reverse proxy (e.g., Nginx) to rate-limit requests to the vulnerable endpoint and block suspicious patterns.

Valters IT

👁️ SHODAN DORKS (THREAT HUNTING)

What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.

http.title:"gpt_academic"
http.html:"gpt_academic"

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-12391/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.