☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
CVSS: 5.3 🐛 CWE-1333
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-2099

CVE-2025-2099 Denial of Service in Huggingface
📅 PUBLISHED: 2025-05-19 11:22 UTC 🔄 UPDATED: 2026-09-23 20:31 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: CONFIRMED — 3+ independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.58%
👁️
0.58% probability
14.5× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
5.3
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-2099 is a Regular Expression Denial of Service (ReDoS) vulnerability discovered in the Hugging Face transformers library, specifically within the preprocess_string() function of the transformers.testing_utils module. The flaw resides in a regular expression used to process code blocks in docstrings, which contains nested quantifiers. This allows an attacker to craft a payload with a large number of newline characters, causing exponential backtracking during regex evaluation. The result is high CPU consumption and potential application downtime, leading to a Denial of Service (DoS) condition. The vulnerability affects version v4.48.3 and has a CVSS score of 5.3 (Medium). No public exploit code or patch details are currently available.

⚡ 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 PyPI package transformers. Organizations using this library in production or CI/CD pipelines should assess their exposure. The attack vector is network-based, requiring no authentication, and can be triggered by processing untrusted input that includes docstrings. Supply chain risk is elevated due to the widespread use of Hugging Face Transformers in machine learning workflows.

CVSS Breakdown & Threat Level

  • CVSS Score: 5.3 (Medium)
  • Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
  • Attack Vector: Network (AV:N)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: None (UI:N)
  • Scope: Unchanged (S:U)
  • Confidentiality Impact: None (C:N)
  • Integrity Impact: None (I:N)
  • Availability Impact: Low (A:L)

The threat level is medium due to the low availability impact and the requirement for a specially crafted payload. However, the ease of exploitation (no authentication, network-based) makes it a viable vector for resource exhaustion attacks.

Deep Dive & Mechanics

The vulnerability is located in the preprocess_string() function within transformers.testing_utils. This function processes docstrings to extract code blocks for testing purposes. The vulnerable regular expression is designed to match code blocks delimited by triple backticks (```). The regex contains nested quantifiers, such as (?:[^]|(?!``))*, which can cause catastrophic backtracking when the input contains a large number of newline characters.

When an attacker provides a payload with many newlines (e.g., thousands of \n characters) inside a code block, the regex engine attempts to match the pattern against the input. Due to the nested quantifiers, the engine explores an exponential number of ways to partition the input, leading to high CPU usage and potential application hang. This is a classic ReDoS pattern.

The vulnerable regex pattern (simplified) looks like:

```(?:[^`]|`(?!``))*```

The * quantifier combined with the alternation (?:[^]|(?!``)) creates a situation where the regex can backtrack extensively on inputs with many newlines.

Vulnerable vs. Patched Code

Vulnerable Code (v4.48.3):

def preprocess_string(text):
    # Vulnerable regex with nested quantifiers
    pattern = r"```(?:[^`]|`(?!``))*```"
    return re.sub(pattern, "", text)

Patched Code (Hypothetical):

def preprocess_string(text):
    # Use atomic grouping or possessive quantifiers to prevent backtracking
    pattern = r"```(?:[^`]|`(?!``))*+```"
    return re.sub(pattern, "", text)

The patch would involve using possessive quantifiers (*+) or atomic groups to eliminate backtracking. Alternatively, a non-regex approach could be used.

Exploitation & Lab Setup

Red Team

To exploit this vulnerability, an attacker would craft a payload containing a large number of newline characters within a code block. The following Python script demonstrates the attack:

&#105;mport requests
&#105;mport sys

# Target endpoint that processes docstrings
url = "http://target.com/process"

# Craft payload with many newlines
payload = "```" + "\n" * 10000 + "```"

# Send request
response = requests.post(url, data=&#123;"input": payload&#125;)
print(f"Status: &#123;response.status_code&#125;")
print(f"Response time: &#123;response.elapsed.total_seconds()&#125; seconds")

The attacker would observe high CPU usage on the server and potential timeout.

Blue Team

To detect exploitation attempts, monitor for:

  • High CPU usage on servers running Hugging Face Transformers.
  • Requests with unusually large payloads containing many newline characters.
  • Slow response times or timeouts from endpoints that process docstrings.

Indicators of Compromise (IOCs)

  • Network: HTTP POST requests with large payloads (e.g., >10KB) containing repeated newline characters.
  • System: High CPU usage by Python processes running Hugging Face Transformers.
  • Logs: Application logs showing timeouts or slow processing of preprocess_string().

Detection Engineering

YARA Rule

rule CVE_2025_2099_ReDoS_Payload &#123;
    meta:
        description = "Detects payloads targeting CVE-2025-2099 ReDoS in Hugging Face Transformers"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-2099"
    strings:
        $re_pattern = /```(?:[^`]|`(?!``))*```/ nocase
        $newline_flood = /\n&#123;100,&#125;/ nocase
    condition:
        $re_pattern and $newline_flood
&#125;

Sigma Rule

title: CVE-2025-2099 ReDoS Exploitation Attempt
id: 8a9b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP requests with large newline sequences targeting Hugging Face Transformers
author: Valters IT
logsource:
    category: webserver
    product: generic
detection:
    selection:
        cs-method: 'POST'
        cs-uri-query|contains: 'process'
        cs-body|contains: '```'
        cs-body|re: '\n&#123;100,&#125;'
    condition: selection
falsepositives:
    - Legitimate large code blocks
level: medium

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-2099 ReDoS Exploitation Attempt"; flow:to_server; content:"POST"; http_method; content:"```"; http_client_body; pcre:"/\n&#123;100,&#125;/R"; classtype:attempted-dos; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate: If using v4.48.3, restrict access to endpoints that process untrusted docstrings. Implement input length limits and rate limiting.
  2. Short-term: Monitor for patches from Hugging Face. Apply the patch as soon as available.
  3. Long-term: Replace the vulnerable regex with a non-backtracking approach (e.g., using re.match with atomic groups or a custom parser). Consider using re.fullmatch with possessive quantifiers.
  4. Detection: Deploy the provided YARA, Sigma, and Suricata rules to detect exploitation attempts.
  5. Supply Chain: Review usage of the transformers library in your environment. Consider using a software composition analysis (SCA) tool to track vulnerable dependencies.

Valters IT
DevSecOps & Cyber Threat Intelligence

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-2099/ · 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.