Skip to content
Heist/ feed
Back to feed
Medium

Regular Expression Denial of Service (ReDoS) in huggingface/transformers

Type: advisorySources: OSV

A vulnerability in the `preprocess_string()` function of the `transformers.testing_utils` module in huggingface/transformers version v4.48.3 allows for a Regular Expression Denial of Service (ReDoS) attack. The regular expression used to process code blocks in docstrings contains nested quantifiers, leading to exponential backtracking when processing input with a large number of newline characters. An attacker can exploit this by providing a specially crafted payload, causing high CPU usage and potential application downtime, effectively resulting in a Denial of Service (DoS) scenario.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2025-2099
Confirmed fixed CVEs
Not specified
Updated in this feed
2 Nov 2026, 19:11 UTC · Revision 1

Source evidence

Regular Expression Denial of Service (ReDoS) in huggingface/transformers

core-osv · Original source

Published 19 May 2025, 11:22 UTC

A vulnerability in the `preprocess_string()` function of the `transformers.testing_utils` module in huggingface/transformers version v4.48.3 allows for a Regular Expression Denial of Service (ReDoS) attack. The regular expression used to process code blocks in docstrings contains nested quantifiers, leading to exponential backtracking when processing input with a large number of newline characters. An attacker can exploit this by providing a specially crafted payload, causing high CPU usage and potential application downtime, effectively resulting in a Denial of Service (DoS) scenario.

osv:CVE-2025-2099
Complete source record
{
  "id": "9f2aa682300ed6b0e0d870fcebabf81c88cec290028ae465c29ec1b53fddc3e4",
  "url": "https://osv.dev/vulnerability/CVE-2025-2099",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Regular Expression Denial of Service (ReDoS) in huggingface/transformers",
    "summary": "A vulnerability in the `preprocess_string()` function of the `transformers.testing_utils` module in huggingface/transformers version v4.48.3 allows for a Regular Expression Denial of Service (ReDoS) attack. The regular expression used to process code blocks in docstrings contains nested quantifiers, leading to exponential backtracking when processing input with a large number of newline characters. An attacker can exploit this by providing a specially crafted payload, causing high CPU usage and potential application downtime, effectively resulting in a Denial of Service (DoS) scenario.",
    "evidence": "osv:CVE-2025-2099",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2025-2099",
      "aliases": [
        "CVE-2025-2099",
        "GHSA-qq3j-4f4f-9583",
        "PYSEC-2025-40"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/huggingface/transformers",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "8cb522b4190bd556ce51be04942720650b1a3e57"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "last_affected": "4.48.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "8cb522b4190bd556ce51be04942720650b1a3e57"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v4.49.0-AyaVision",
            "v4.49.0-SigLIP-2",
            "v4.49.0-SmolVLM-2",
            "v4.33.1",
            "v4.16.0",
            "v4.15.0",
            "v4.14.0",
            "v4.13.0",
            "v4.12.0",
            "v4.11.0",
            "v4.10.0",
            "v4.9.0",
            "v4.8.0",
            "v4.7.0",
            "v4.6.0",
            "v4.5.0",
            "v4.4.0",
            "v4.3.0.rc1",
            "4.3.0.rc1",
            "v4.2.0",
            "v4.1.1",
            "v4.1.0",
            "v3.5.0",
            "v3.4.0",
            "v3.3.1",
            "v3.3.0",
            "v3.2.0",
            "v3.1.0",
            "v3.0.2",
            "v3.0.1",
            "3.0.1",
            "v3.0.0",
            "v2.11.0",
            "v2.10.0",
            "v2.9.1",
            "v2.9.0",
            "v2.8.0",
            "v2.7.0",
            "v2.6.0",
            "v2.5.1",
            "v2.5.0",
            "v2.4.1",
            "v2.4.0",
            "v2.3.0",
            "v2.2.2",
            "v2.2.1",
            "v2.2.0",
            "v2.1.1",
            "v2.1.0",
            "v2.0.0",
            "1.2.0",
            "1.1.0",
            "1.0",
            "v0.6.2",
            "v0.6.1",
            "v0.6.0",
            "v0.5.1",
            "v0.5.0",
            "0.5.0",
            "v0.4.0",
            "v0.3.0",
            "v0.2.0",
            "v0.1.2",
            "0.1.2"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-2099.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:22.858745996Z",
      "provider": "osv",
      "references": [
        "https://huntr.com/bounties/97b780f3-ffca-424f-ad5d-0e1c57a5bde4",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/2xxx/CVE-2025-2099.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-2099",
        "https://github.com/huggingface/transformers/commit/8cb522b4190bd556ce51be04942720650b1a3e57"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-1333"
        ],
        "cna_assigner": "@huntr_ai",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/2xxx/CVE-2025-2099.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-2099",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 489012,
  "published_at": "2025-05-19T11:22:36.908+00:00"
}