Common Weakness Enumeration

CWE-1333

Weakness Allowed

Inefficient Regular Expression Complexity

Abstraction: Base · Status: Draft

The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.

Mapping guidance

This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.

Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Relationships and members
ChildOf: CWE-407 · View CWE-1000
ChildOf: CWE-407 · View CWE-1003
Modes of introduction
Implementation

A RegEx can be easy to create and read using unbounded matching characters, but the programmer might not consider the risk of excessive backtracking.

Implementation

Backtracking becomes a weakness if all of these conditions are met:

The number of possible backtracking attempts is exponential relative to the length of the input.

The input can fail to match the regular expression.

The input can be long enough.

Detection methods

Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

Content history
Submission: Anonymous External Contributor · 2021-01-17 · CWE 4.4
Modification: CWE Content Team · MITRE · 2021-07-20 · CWE 4.5

updated References

Modification: CWE Content Team · MITRE · 2021-10-28 · CWE 4.6

updated Description

Modification: CWE Content Team · MITRE · 2022-04-28 · CWE 4.7

updated Observed_Examples, Potential_Mitigations

Modification: CWE Content Team · MITRE · 2022-10-13 · CWE 4.9

updated Observed_Examples, Relationships

Modification: CWE Content Team · MITRE · 2023-01-31 · CWE 4.10

updated Demonstrative_Examples, Observed_Examples

Modification: CWE Content Team · MITRE · 2023-04-27 · CWE 4.11

updated References, Relationships

Modification: CWE Content Team · MITRE · 2023-06-29 · CWE 4.12

updated Mapping_Notes

Modification: CWE Content Team · MITRE · 2025-12-11 · CWE 4.19

updated Detection_Factors, Weakness_Ordinalities

Modification: CWE Content Team · MITRE · 2026-04-30 · CWE 4.20

updated Background_Details, Common_Consequences, Description, Diagram, Modes_of_Introduction

Modification: CWE Content Team · MITRE · 2026-10-28 · CWE 5.0

updated Applicable_Platforms, References, Relationships, Taxonomy_Mappings

1062 vulnerabilities reference this CWE, most recent first.

GHSA-R67W-F99W-MGXJ

Vulnerability from github – Published: 2024-01-21 18:30 – Updated: 2024-01-22 21:29
VLAI
Summary
ReDoS in Embedchain
Details

The JSON loader in Embedchain before 0.1.57 allows a ReDoS (regular expression denial of service) via a long string to json.py.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "embedchain"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.1.57"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2024-23732"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-01-22T21:29:14Z",
    "nvd_published_at": "2024-01-21T17:15:44Z",
    "severity": "MODERATE"
  },
  "details": "The JSON loader in Embedchain before 0.1.57 allows a ReDoS (regular expression denial of service) via a long string to json.py.",
  "id": "GHSA-r67w-f99w-mgxj",
  "modified": "2024-01-22T21:29:14Z",
  "published": "2024-01-21T18:30:34Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-23732"
    },
    {
      "type": "WEB",
      "url": "https://github.com/embedchain/embedchain/pull/1122"
    },
    {
      "type": "WEB",
      "url": "https://github.com/embedchain/embedchain/compare/0.1.56...0.1.57"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/embedchain/PYSEC-2024-8.yaml"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [],
  "summary": "ReDoS in Embedchain"
}

GHSA-R6CH-MQF9-QC9W

Vulnerability from github – Published: 2023-02-16 20:46 – Updated: 2023-02-16 20:46
VLAI
Summary
Regular Expression Denial of Service in Headers
Details

Impact

The Headers.set() and Headers.append() methods are vulnerable to Regular Expression Denial of Service (ReDoS) attacks when untrusted values are passed into the functions. This is due to the inefficient regular expression used to normalize the values in the headerValueNormalize() utility function.

Patches

This vulnerability was patched in v5.19.1.

Workarounds

There is no workaround. Please update to an unaffected version.

References

  • https://hackerone.com/bugs?report_id=1784449

Credits

Carter Snook reported this vulnerability.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "undici"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "5.19.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-24807"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-02-16T20:46:10Z",
    "nvd_published_at": "2023-02-16T18:15:00Z",
    "severity": "HIGH"
  },
  "details": "### Impact\nThe `Headers.set()` and `Headers.append()` methods are vulnerable to Regular Expression Denial of Service (ReDoS) attacks when untrusted values are passed into the functions. This is due to the inefficient regular expression used to normalize the values in the `headerValueNormalize()` utility function.\n\n### Patches\n\nThis vulnerability was patched in v5.19.1.\n\n### Workarounds\nThere is no workaround. Please update to an unaffected version.\n\n### References\n\n* https://hackerone.com/bugs?report_id=1784449\n\n### Credits\n\nCarter Snook reported this vulnerability.\n",
  "id": "GHSA-r6ch-mqf9-qc9w",
  "modified": "2023-02-16T20:46:10Z",
  "published": "2023-02-16T20:46:10Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nodejs/undici/security/advisories/GHSA-r6ch-mqf9-qc9w"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-24807"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodejs/undici/commit/f2324e549943f0b0937b09fb1c0c16cc7c93abdf"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nodejs/undici"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nodejs/undici/releases/tag/v5.19.1"
    },
    {
      "type": "WEB",
      "url": "https://hackerone.com/bugs?report_id=1784449"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Regular Expression Denial of Service in Headers"
}

GHSA-R6H4-MM7H-8PMQ

Vulnerability from github – Published: 2025-12-16 20:46 – Updated: 2025-12-16 20:46
VLAI
Summary
PyMdown Extensions has a ReDOS bug in its Figure Capture extension
Details

Impact

This issue describes a ReDOS bug found within the figure caption extension (pymdownx.blocks.caption ).

In systems that take unchecked user content, this could cause long hangs when processing the data if a malicious payload was crafted.

Patches

This issue is patched in Release 10.16.1.

Workarounds

Some possible workarounds

If users are concerned about this vulnerability and process unknown user content without timeouts or other safeguards in place to prevent really large, malicious content being aimed at systems, the use of pymdownx.blocks.caption could be avoided until the library is updated to 10.16.1+.

References

The original issue https://github.com/facelessuser/pymdown-extensions/issues/2716.

Description

The original issue came through PyMdown Extensions' normal issue tracker instead of the typical security flow: https://github.com/facelessuser/pymdown-extensions/issues/2716. Because this came through the normal issue flow, it was handled as a normal issue. In the future, PyMdown Extensions will ensure such issues, even if prematurely made public through the normal issue flow, are redirected through the typical security process.

The regular expression pattern in question is as follows:

RE_FIG_NUM = re.compile(r'^(\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')

The POC was provided by @ShangzhiXu

import re
import time

regex_pattern = re.compile(r'^(\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')

for i in range(50, 500, 50):
    long_string = '1' * i + 'a'
    start_time = time.time()
    match = re.match(regex_pattern, long_string)
    end_time = time.time()
    print(f"long_string execution time: {end_time - start_time:.6f} s")

The issue with the above pattern is that . was used, which accepts any character when we meant to use \.. The fix was to update the pattern to:

RE_FIG_NUM = re.compile(r'^(\^)?([1-9][0-9]*(?:\.[1-9][0-9]*)*)(?= |$)')

Relevant PR with fix: https://github.com/facelessuser/pymdown-extensions/pull/2717

Version(s) & System Info

  • Operating System: Any
  • Python Version: Any
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "pymdown-extensions"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "10.16.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-68142"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-12-16T20:46:05Z",
    "nvd_published_at": "2025-12-16T18:16:16Z",
    "severity": "LOW"
  },
  "details": "### Impact\n\nThis issue describes a ReDOS bug found within the figure caption extension (`pymdownx.blocks.caption` ).\n\nIn systems that take unchecked user content, this could cause long hangs when processing the data if a malicious payload was crafted.\n\n### Patches\n\nThis issue is patched in Release [10.16.1](https://pypi.org/project/pymdown-extensions/10.16.1/).\n\n### Workarounds\n\nSome possible workarounds\n\nIf users are concerned about this vulnerability and process unknown user content without timeouts or other safeguards in place to prevent really large, malicious content being aimed at systems, the use of `pymdownx.blocks.caption` could be avoided until the library is updated to 10.16.1+.\n\n### References\n\nThe original issue https://github.com/facelessuser/pymdown-extensions/issues/2716.\n\n### Description\n\nThe original issue came through PyMdown Extensions\u0027 normal issue tracker instead of the typical security flow: https://github.com/facelessuser/pymdown-extensions/issues/2716. Because this came through the normal issue flow, it was handled as a normal issue. In the future, PyMdown Extensions will ensure such issues, even if prematurely made public through the normal issue flow, are redirected through the typical security process.\n\nThe regular expression pattern in question is as follows:\n\n```py\nRE_FIG_NUM = re.compile(r\u0027^(\\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)\u0027)\n```\n\nThe POC was provided by @ShangzhiXu\n\n```py\nimport re\nimport time\n\nregex_pattern = re.compile(r\u0027^(\\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)\u0027)\n\nfor i in range(50, 500, 50):\n    long_string = \u00271\u0027 * i + \u0027a\u0027\n    start_time = time.time()\n    match = re.match(regex_pattern, long_string)\n    end_time = time.time()\n    print(f\"long_string execution time: {end_time - start_time:.6f} s\")\n```\n\nThe issue with the above pattern is that `.` was used, which accepts any character when we meant to use `\\.`. The fix was to update the pattern to:\n\n```py\nRE_FIG_NUM = re.compile(r\u0027^(\\^)?([1-9][0-9]*(?:\\.[1-9][0-9]*)*)(?= |$)\u0027)\n```\n\nRelevant PR with fix: https://github.com/facelessuser/pymdown-extensions/pull/2717\n\n### Version(s) \u0026 System Info\n\n- Operating System: Any\n- Python Version: Any",
  "id": "GHSA-r6h4-mm7h-8pmq",
  "modified": "2025-12-16T20:46:05Z",
  "published": "2025-12-16T20:46:05Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-r6h4-mm7h-8pmq"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-68142"
    },
    {
      "type": "WEB",
      "url": "https://github.com/facelessuser/pymdown-extensions/commit/b50d15a56850ed1408a284bba81cc019c6bd72e8"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/facelessuser/pymdown-extensions"
    },
    {
      "type": "WEB",
      "url": "https://pypi.org/project/pymdown-extensions/10.16.1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U",
      "type": "CVSS_V4"
    }
  ],
  "summary": "PyMdown Extensions has a ReDOS bug in its Figure Capture extension"
}

GHSA-R7G9-XPMJ-5FCQ

Vulnerability from github – Published: 2026-05-27 18:08 – Updated: 2026-07-09 21:06
VLAI
Summary
LiquidJS Vulnerable to ReDoS via Quadratic Backtracking in `strip_html` Filter Regex
Details

Summary

The built-in strip_html filter in liquidjs uses a regex containing four lazy-quantified alternatives. When the input contains many <script, <style, or <!-- opener tokens without matching closers, the V8 regex engine performs O(N²) backtracking, blocking the Node.js event loop. A single ~350 KB request ('<script'.repeat(50000)) stalls the process for ~10 seconds; cost grows quadratically with input size. The default memoryLimit: Infinity does not bound regex CPU, and even when configured strip_html only charges str.length to the limit — the regex itself runs unbounded.

Details

The vulnerable filter is at src/filters/html.ts:45-49:

export function strip_html (this: FilterImpl, v: string) {
  const str = stringify(v)
  this.context.memoryLimit.use(str.length)
  return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, '')
}

The regex contains four lazy patterns: 1. <script[\s\S]*?<\/script> 2. <style[\s\S]*?<\/style> 3. <.*?> 4. <!--[\s\S]*?-->

For an input like '<script'.repeat(N), the engine encounters N starting < positions. At each one it must lazily expand [\s\S]*? (and .*?) all the way to end-of-input searching for a closer that never appears, then fail and backtrack. Because each of the O(N) starts performs O(N) lazy-expansion work, total work is O(N²).

Reachability: 1. strip_html is a default-registered filter (exported from src/filters/html.ts, wired up via src/filters/index.ts), invocable from any template via {{ x | strip_html }}. 2. The filter calls String.prototype.replace with the vulnerable regex directly on the caller-supplied string, with no length cap and no timeout. 3. The default memoryLimit is Infinity (src/liquid-options.ts:198); the filter only charges str.length against memory (line 47), which does not bound CPU work for regex backtracking.

This is distinct from GHSA-45rm-2893-5f49 (prototype property leak, CWE-200) and from any prior replace/strip_html issues — the mechanism here is regex backtracking CPU consumption on a different filter.

PoC

Empirical scaling confirmed against a freshly built liquidjs@10.25.7 bundle on Node 22 / Linux:

node -e "
const { Liquid } = require('liquidjs');
const e = new Liquid();
(async () => {
  for (const n of [1000, 2000, 4000, 8000, 16000]) {
    const payload = '<script'.repeat(n);
    const t0 = Date.now();
    await e.parseAndRender('{{ x | strip_html }}', { x: payload });
    console.log('n=' + n + ' inputLen=' + payload.length + ' ms=' + (Date.now() - t0));
  }
})();
"

Verified output:

n=1000  inputLen=7000   ms=5
n=2000  inputLen=14000  ms=12     (2.4x for 2x size)
n=4000  inputLen=28000  ms=46     (3.8x for 2x size)
n=8000  inputLen=56000  ms=187    (4.0x for 2x size)
n=16000 inputLen=112000 ms=737    (3.9x for 2x size)

A larger payload extrapolates straightforwardly:

node -e "
const { Liquid } = require('liquidjs');
const e = new Liquid();
(async () => {
  const payload = '<script'.repeat(50000);  // 350 KB
  const t0 = Date.now();
  await e.parseAndRender('{{ x | strip_html }}', { x: payload });
  console.log('elapsed ms:', Date.now() - t0);
})();
"
# elapsed ms: ~10000+ (Node single-threaded event loop fully blocked)

The same pathology applies to <style and <!-- openers.

Impact

  • Single-request DoS: A 350 KB request body stalls the Node.js event loop for ~10 seconds; 700 KB takes ~40 s; 1.4 MB takes ~160 s. All other requests on the process queue behind the regex.
  • Trivial amplification: Quadratic scaling means small attacker bandwidth produces large server CPU consumption. A handful of concurrent requests fully saturates the worker.
  • No authentication required: The typical use case for strip_html is sanitizing untrusted input (comments, posts, profile bios, product descriptions). Any endpoint that renders user content through strip_html is exposed.
  • memoryLimit doesn't help: Even applications that opt into memoryLimit are not protected, because (a) the regex CPU runs to completion before any output is produced, and (b) only str.length is charged, not the cost of the regex traversal.

Recommended Fix

Replace the backtracking regex with an atomic / non-overlapping pattern, and/or perform a single linear pass.

Option 1 — anchor each alternative so lazy expansion fails fast on chunked content (no [\s\S]*? over the full tail):

return str.replace(
  /<script\b[^<]*(?:<(?!\/script>)[^<]*)*<\/script>|<style\b[^<]*(?:<(?!\/style>)[^<]*)*<\/style>|<!--[^-]*(?:-(?!->)[^-]*)*-->|<[^>]*>/g,
  ''
)

This unrolls each lazy quantifier so each < is visited at most a constant number of times overall — linear total work.

Option 2 — single-pass tokenizer in plain code; iterate over the string once, tracking whether you are inside <script>, <style>, comment, or generic tag, and emit nothing for those ranges.

Either fix should be combined with charging the regex output cost honestly to memoryLimit and (defensively) capping input length up front:

export function strip_html (this: FilterImpl, v: string) {
  const str = stringify(v)
  this.context.memoryLimit.use(str.length)
  // ... linear-time strip implementation here
}
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "liquidjs"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "10.26.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-45617"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-27T18:08:19Z",
    "nvd_published_at": "2026-06-17T23:17:04Z",
    "severity": "HIGH"
  },
  "details": "## Summary\n\nThe built-in `strip_html` filter in liquidjs uses a regex containing four lazy-quantified alternatives. When the input contains many `\u003cscript`, `\u003cstyle`, or `\u003c!--` opener tokens without matching closers, the V8 regex engine performs O(N\u00b2) backtracking, blocking the Node.js event loop. A single ~350 KB request (`\u0027\u003cscript\u0027.repeat(50000)`) stalls the process for ~10 seconds; cost grows quadratically with input size. The default `memoryLimit: Infinity` does not bound regex CPU, and even when configured `strip_html` only charges `str.length` to the limit \u2014 the regex itself runs unbounded.\n\n## Details\n\nThe vulnerable filter is at `src/filters/html.ts:45-49`:\n\n```ts\nexport function strip_html (this: FilterImpl, v: string) {\n  const str = stringify(v)\n  this.context.memoryLimit.use(str.length)\n  return str.replace(/\u003cscript[\\s\\S]*?\u003c\\/script\u003e|\u003cstyle[\\s\\S]*?\u003c\\/style\u003e|\u003c.*?\u003e|\u003c!--[\\s\\S]*?--\u003e/g, \u0027\u0027)\n}\n```\n\nThe regex contains four lazy patterns:\n1. `\u003cscript[\\s\\S]*?\u003c\\/script\u003e`\n2. `\u003cstyle[\\s\\S]*?\u003c\\/style\u003e`\n3. `\u003c.*?\u003e`\n4. `\u003c!--[\\s\\S]*?--\u003e`\n\nFor an input like `\u0027\u003cscript\u0027.repeat(N)`, the engine encounters N starting `\u003c` positions. At each one it must lazily expand `[\\s\\S]*?` (and `.*?`) all the way to end-of-input searching for a closer that never appears, then fail and backtrack. Because each of the O(N) starts performs O(N) lazy-expansion work, total work is O(N\u00b2).\n\nReachability:\n1. `strip_html` is a default-registered filter (exported from `src/filters/html.ts`, wired up via `src/filters/index.ts`), invocable from any template via `{{ x | strip_html }}`.\n2. The filter calls `String.prototype.replace` with the vulnerable regex directly on the caller-supplied string, with no length cap and no timeout.\n3. The default `memoryLimit` is `Infinity` (`src/liquid-options.ts:198`); the filter only charges `str.length` against memory (line 47), which does not bound CPU work for regex backtracking.\n\nThis is distinct from `GHSA-45rm-2893-5f49` (prototype property leak, CWE-200) and from any prior `replace`/`strip_html` issues \u2014 the mechanism here is regex backtracking CPU consumption on a different filter.\n\n## PoC\n\nEmpirical scaling confirmed against a freshly built `liquidjs@10.25.7` bundle on Node 22 / Linux:\n\n```bash\nnode -e \"\nconst { Liquid } = require(\u0027liquidjs\u0027);\nconst e = new Liquid();\n(async () =\u003e {\n  for (const n of [1000, 2000, 4000, 8000, 16000]) {\n    const payload = \u0027\u003cscript\u0027.repeat(n);\n    const t0 = Date.now();\n    await e.parseAndRender(\u0027{{ x | strip_html }}\u0027, { x: payload });\n    console.log(\u0027n=\u0027 + n + \u0027 inputLen=\u0027 + payload.length + \u0027 ms=\u0027 + (Date.now() - t0));\n  }\n})();\n\"\n```\n\nVerified output:\n```\nn=1000  inputLen=7000   ms=5\nn=2000  inputLen=14000  ms=12     (2.4x for 2x size)\nn=4000  inputLen=28000  ms=46     (3.8x for 2x size)\nn=8000  inputLen=56000  ms=187    (4.0x for 2x size)\nn=16000 inputLen=112000 ms=737    (3.9x for 2x size)\n```\n\nA larger payload extrapolates straightforwardly:\n```bash\nnode -e \"\nconst { Liquid } = require(\u0027liquidjs\u0027);\nconst e = new Liquid();\n(async () =\u003e {\n  const payload = \u0027\u003cscript\u0027.repeat(50000);  // 350 KB\n  const t0 = Date.now();\n  await e.parseAndRender(\u0027{{ x | strip_html }}\u0027, { x: payload });\n  console.log(\u0027elapsed ms:\u0027, Date.now() - t0);\n})();\n\"\n# elapsed ms: ~10000+ (Node single-threaded event loop fully blocked)\n```\n\nThe same pathology applies to `\u003cstyle` and `\u003c!--` openers.\n\n## Impact\n\n- **Single-request DoS:** A 350 KB request body stalls the Node.js event loop for ~10 seconds; 700 KB takes ~40 s; 1.4 MB takes ~160 s. All other requests on the process queue behind the regex.\n- **Trivial amplification:** Quadratic scaling means small attacker bandwidth produces large server CPU consumption. A handful of concurrent requests fully saturates the worker.\n- **No authentication required:** The typical use case for `strip_html` is sanitizing untrusted input (comments, posts, profile bios, product descriptions). Any endpoint that renders user content through `strip_html` is exposed.\n- **memoryLimit doesn\u0027t help:** Even applications that opt into `memoryLimit` are not protected, because (a) the regex CPU runs to completion before any output is produced, and (b) only `str.length` is charged, not the cost of the regex traversal.\n\n## Recommended Fix\n\nReplace the backtracking regex with an atomic / non-overlapping pattern, and/or perform a single linear pass.\n\nOption 1 \u2014 anchor each alternative so lazy expansion fails fast on chunked content (no `[\\s\\S]*?` over the full tail):\n```ts\nreturn str.replace(\n  /\u003cscript\\b[^\u003c]*(?:\u003c(?!\\/script\u003e)[^\u003c]*)*\u003c\\/script\u003e|\u003cstyle\\b[^\u003c]*(?:\u003c(?!\\/style\u003e)[^\u003c]*)*\u003c\\/style\u003e|\u003c!--[^-]*(?:-(?!-\u003e)[^-]*)*--\u003e|\u003c[^\u003e]*\u003e/g,\n  \u0027\u0027\n)\n```\nThis unrolls each lazy quantifier so each `\u003c` is visited at most a constant number of times overall \u2014 linear total work.\n\nOption 2 \u2014 single-pass tokenizer in plain code; iterate over the string once, tracking whether you are inside `\u003cscript\u003e`, `\u003cstyle\u003e`, comment, or generic tag, and emit nothing for those ranges.\n\nEither fix should be combined with charging the regex output cost honestly to `memoryLimit` and (defensively) capping input length up front:\n```ts\nexport function strip_html (this: FilterImpl, v: string) {\n  const str = stringify(v)\n  this.context.memoryLimit.use(str.length)\n  // ... linear-time strip implementation here\n}\n```",
  "id": "GHSA-r7g9-xpmj-5fcq",
  "modified": "2026-07-09T21:06:36Z",
  "published": "2026-05-27T18:08:19Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/harttle/liquidjs/security/advisories/GHSA-r7g9-xpmj-5fcq"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-45617"
    },
    {
      "type": "WEB",
      "url": "https://github.com/harttle/liquidjs/commit/3616a744b9abeb425c217b340a2397d46176afb8"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/harttle/liquidjs"
    },
    {
      "type": "WEB",
      "url": "https://github.com/harttle/liquidjs/releases/tag/v10.26.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "LiquidJS Vulnerable to ReDoS via Quadratic Backtracking in `strip_html` Filter Regex"
}

GHSA-R7HM-RJVG-XX7J

Vulnerability from github – Published: 2026-11-19 22:49 – Updated: 2026-11-19 22:49
VLAI
Summary
Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request
Details

Summary

A polynomial (quadratic) regular-expression denial of service in guard-core's built-in penetration-detection patterns allows any unauthenticated remote client to freeze every endpoint of an application for seconds per request, using only the default configuration. The triggering request completes without any detection match — no ban counter increments, no rate-limit violation is recorded — so it can be repeated indefinitely. Since guard-core 3.5.0, only custom patterns are executed through the compiler's timeout-protected create_safe_matcher(); all built-in patterns run as a bare, inline pattern.search(content) directly on the asyncio event loop. guard-core ≤ 3.4.0 ran built-ins through the safe matcher (verified in the 3.4.0 wheel, _check_regex_pattern), so this is a regression introduced in 3.5.0 — and it silently undoes the protection credited to GHSA-rrf6-pxg8-684g (CVE-2025-54365) and the unbounded-quantifier remediation of GHSA-j47q-rc62-w448 (CVE-2025-53539) for every stock pattern, despite the changelog advertising "Safe regex execution with configurable timeouts to prevent ReDoS attacks."

Details

1. The pattern — guard_core/handlers/suspatterns_handler.py:519 (master 08780f1), the built-in template-injection detector:

r"\{\{\s*[^\}]+(?:system|exec|popen|eval|require|include)\s*\}\}"

On an input of { repeated N times, every one of the N−1 positions starts a \{\{ match attempt and [^\}]+ scans to end-of-string and backtracks once per position → O(N²). Note the sibling pattern at :524 (\{\%\s*[^\%]+...) is not vulnerable — its delimiter % is excluded from the character class, keeping scans bounded — which confirms the root cause is the unbounded, non-excluding [^\}]+.

2. The unprotected execution path — guard_core/handlers/suspatterns_handler.py:910-926:

if compiler:
    if category == "custom":
        safe_matcher = compiler.create_safe_matcher(pattern)   # executor + timeout
        match = safe_matcher(content)
        ...
    else:
        match = pattern.search(content)                        # ← inline, NO timeout

In enhanced mode (the default whenever a SecurityConfig is present — _supports_enhanced_config() is a duck-type attribute check a stock config always passes), all built-in patterns execute inline inside the async coroutine, blocking the event loop for the full scan. In guard-core ≤ 3.4.0, _check_regex_pattern() routed every pattern through self._compiler.create_safe_matcher(pattern.pattern) (verified in the 3.4.0 wheel, suspatterns_handler.py:565-567) or, without a compiler, through _check_pattern_with_timeout (4-worker pool + per-pattern timeout). The category == "custom" exemption appeared in 3.5.0.

3. Default reachability — penetration detection is on by default (enable_penetration_detection=True), query parameters are scanned by default (guard_core/utils.py:843-865), and the default scan window detection_max_content_length=10000 (models.py:765-770) admits the full 10,000-character payload. A run of { survives preprocessing untouched.

Measured (CPython 3.14, guard-core 3.12.0):

input detect() wall time event-loop lag (measured in-process)
{ × 2,500 0.15 s —
{ × 5,000 0.46 s —
{ × 10,000 1.85 s 2.57 s cumulative across the three calls

Clean 4× per doubling — quadratic, not exponential. Profiling all built-ins against the payload attributes 1.766 s of the 1.77 s total to this single pattern (one-line fix: bound the gap, e.g. \{\{\s*[^\}\s]{0,64}(?:system|exec|popen|eval|require|include)\s*\}\}).

Amplification: every scanned value pays the cost independently (utils.py:843-890 per query param/header; utils.py:936-977 per JSON string field). A single 256 KB JSON body (the default detection_max_body_inspect_bytes) containing ~25 string fields of {×10,000 measured 44.03 s of continuous event-loop blockage from one request, returning normally with no detection hit.

Why rate limiting doesn't help: guard-core defaults are rate_limit=10 per rate_limit_window=60 s (models.py:369-375), and the rate_limit check runs before suspicious_activity in the default pipeline. 10 × 44 s = 440 s of loop blockage per 60 s window from a single IP — single-source saturation, no distribution needed.

Framework reach: any adapter embedding guard-core on an asyncio loop — fastapi-guard, flaskapi-guard (async deployments), djapi-guard (ASGI) — shares the loop with the application, so the freeze takes down every endpoint of the host application, not just the guarded routes.

PoC

guard-core only — no framework adapter needed. Requires pip install guard-core, then python poc_guard_core_redos.py. Exit code 0 = freeze reproduced.

"""PoC: event-loop ReDoS in guard-core (>= 3.5.0, <= 3.12.0), default config.

The built-in template-injection pattern is quadratic on '{' x N, and since 3.5.0
built-in patterns execute inline (pattern.search) with NO timeout — only
`custom` patterns get the compiler's safe matcher. One detect() call with a
10,000-char value blocks the event loop ~1.8s; a 256KB JSON body with ~25 such
fields blocks it ~44s. Runs on the asyncio loop that any adapter
(fastapi-guard, flaskapi-guard, djapi-guard) shares with the app.

Run:  python poc_guard_core_redos.py
Exit code 0 = freeze reproduced (max loop lag > 1s).
"""

import asyncio
import time

from guard_core.handlers.suspatterns_handler import sus_patterns_handler
from guard_core.models import SecurityConfig

LOOP_LAGS: list[float] = []


async def _loop_lag_monitor() -> None:
    while True:
        t0 = time.monotonic()
        await asyncio.sleep(0.05)
        LOOP_LAGS.append(time.monotonic() - t0 - 0.05)


async def main() -> int:
    config = SecurityConfig(enable_redis=False)  # defaults = enhanced mode
    sus_patterns_handler.configure(config)

    monitor = asyncio.create_task(_loop_lag_monitor())
    await asyncio.sleep(0.3)  # baseline samples

    for n in (2_500, 5_000, 10_000):
        t0 = time.perf_counter()
        result = await sus_patterns_handler.detect(
            content="{" * n, ip_address="203.0.113.7", context="query_param:q"
        )
        print(f"'{{' x {n:5d}: {time.perf_counter()-t0:.2f}s  is_threat={result['is_threat']}")

    # let the starved monitor task wake and record the lag it just endured
    await asyncio.sleep(0.1)
    max_lag = max(LOOP_LAGS)
    print(f"\nmax event-loop lag during run: {max_lag:.2f}s")
    print("VERDICT:", "FROZEN" if max_lag > 1.0 else "not reproduced")

    monitor.cancel()
    return 0 if max_lag > 1.0 else 1


if __name__ == "__main__":
    raise SystemExit(asyncio.run(main()))

Observed output (Python 3.14, guard-core 3.12.0):

'{' x  2500: 0.16s  is_threat=False
'{' x  5000: 0.51s  is_threat=False
'{' x 10000: 1.91s  is_threat=False

max event-loop lag during run: 2.57s
VERDICT: FROZEN

An end-to-end proof through the fastapi-guard adapter (default config, real uvicorn server, in-process loop-lag monitor) measured 1.75 s of server-side event-loop lag from one GET request returning HTTP 200 — available on request.

Impact

Kind of vulnerability: Regular Expression Denial of Service — CWE-1333 / CWE-400. Polynomial (quadratic) runtime, O(N²), not exponential backtracking.

Who is impacted: every application embedding guard-core ≥ 3.5.0 with its default configuration (penetration detection enabled) in a single-process asyncio deployment. One unauthenticated request freezes all endpoints for ~1.8 s; one padded POST body freezes them for tens of seconds; repeated requests at only 10/min saturate the worker indefinitely. Because the payload triggers no detection match, no ban counter increments and nothing is logged as suspicious — the attack is invisible in guard-core's own telemetry.

Fix directions: (1) bound the quantifier in the template pattern (its {% sibling at :524 is already safe because [^\%]+ excludes the delimiter — excluding the delimiter, or bounding the gap, closes it); (2) route built-in patterns through the same create_safe_matcher() timeout path as custom patterns, restoring the ≤ 3.4.0 behavior that the changelog advertises.

Reporter validation request

The fix ships in guard-core 3.13.0, now on PyPI. If you reported this issue, please install 3.13.0 and confirm it is resolved. You can reply in this advisory's discussion thread or open a new issue with the result.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 3.12.0"
      },
      "package": {
        "ecosystem": "PyPI",
        "name": "guard-core"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.5.0"
            },
            {
              "fixed": "3.13.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-129302"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333",
      "CWE-400"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-19T22:49:33Z",
    "nvd_published_at": "2026-11-16T20:19:01Z",
    "severity": "HIGH"
  },
  "details": "### Summary\n\nA polynomial (quadratic) regular-expression denial of service in guard-core\u0027s built-in penetration-detection patterns allows any unauthenticated remote client to freeze **every** endpoint of an application for seconds per request, using only the default configuration. The triggering request completes without any detection match \u2014 no ban counter increments, no rate-limit violation is recorded \u2014 so it can be repeated indefinitely. Since guard-core 3.5.0, only *custom* patterns are executed through the compiler\u0027s timeout-protected `create_safe_matcher()`; all built-in patterns run as a bare, inline `pattern.search(content)` directly on the asyncio event loop. guard-core \u2264 3.4.0 ran built-ins through the safe matcher (verified in the 3.4.0 wheel, `_check_regex_pattern`), so this is a **regression introduced in 3.5.0** \u2014 and it silently undoes the protection credited to GHSA-rrf6-pxg8-684g (CVE-2025-54365) and the unbounded-quantifier remediation of GHSA-j47q-rc62-w448 (CVE-2025-53539) for every stock pattern, despite the changelog advertising \"Safe regex execution with configurable timeouts to prevent ReDoS attacks.\"\n\n### Details\n\n**1. The pattern** \u2014 `guard_core/handlers/suspatterns_handler.py:519` (master `08780f1`), the built-in template-injection detector:\n\n```python\nr\"\\{\\{\\s*[^\\}]+(?:system|exec|popen|eval|require|include)\\s*\\}\\}\"\n```\n\nOn an input of `{` repeated N times, every one of the N\u22121 positions starts a `\\{\\{` match attempt and `[^\\}]+` scans to end-of-string and backtracks once per position \u2192 O(N\u00b2). Note the sibling pattern at `:524` (`\\{\\%\\s*[^\\%]+...`) is **not** vulnerable \u2014 its delimiter `%` is excluded from the character class, keeping scans bounded \u2014 which confirms the root cause is the unbounded, non-excluding `[^\\}]+`.\n\n**2. The unprotected execution path** \u2014 `guard_core/handlers/suspatterns_handler.py:910-926`:\n\n```python\nif compiler:\n    if category == \"custom\":\n        safe_matcher = compiler.create_safe_matcher(pattern)   # executor + timeout\n        match = safe_matcher(content)\n        ...\n    else:\n        match = pattern.search(content)                        # \u2190 inline, NO timeout\n```\n\nIn enhanced mode (the default whenever a `SecurityConfig` is present \u2014 `_supports_enhanced_config()` is a duck-type attribute check a stock config always passes), all built-in patterns execute inline **inside the async coroutine**, blocking the event loop for the full scan. In guard-core \u2264 3.4.0, `_check_regex_pattern()` routed *every* pattern through `self._compiler.create_safe_matcher(pattern.pattern)` (verified in the 3.4.0 wheel, `suspatterns_handler.py:565-567`) or, without a compiler, through `_check_pattern_with_timeout` (4-worker pool + per-pattern timeout). The `category == \"custom\"` exemption appeared in 3.5.0.\n\n**3. Default reachability** \u2014 penetration detection is on by default (`enable_penetration_detection=True`), query parameters are scanned by default (`guard_core/utils.py:843-865`), and the default scan window `detection_max_content_length=10000` (`models.py:765-770`) admits the full 10,000-character payload. A run of `{` survives preprocessing untouched.\n\n**Measured** (CPython 3.14, guard-core 3.12.0):\n\n| input | detect() wall time | event-loop lag (measured in-process) |\n|---|---|---|\n| `{` \u00d7 2,500 | 0.15 s | \u2014 |\n| `{` \u00d7 5,000 | 0.46 s | \u2014 |\n| `{` \u00d7 10,000 | **1.85 s** | **2.57 s cumulative** across the three calls |\n\nClean 4\u00d7 per doubling \u2014 quadratic, not exponential. Profiling all built-ins against the payload attributes 1.766 s of the 1.77 s total to this single pattern (one-line fix: bound the gap, e.g. `\\{\\{\\s*[^\\}\\s]{0,64}(?:system|exec|popen|eval|require|include)\\s*\\}\\}`).\n\n**Amplification:** every scanned value pays the cost independently (`utils.py:843-890` per query param/header; `utils.py:936-977` per JSON string field). A single 256 KB JSON body (the default `detection_max_body_inspect_bytes`) containing ~25 string fields of `{`\u00d710,000 measured **44.03 s of continuous event-loop blockage from one request**, returning normally with no detection hit.\n\n**Why rate limiting doesn\u0027t help:** guard-core defaults are `rate_limit=10` per `rate_limit_window=60` s (`models.py:369-375`), and the `rate_limit` check runs before `suspicious_activity` in the default pipeline. 10 \u00d7 44 s = **440 s of loop blockage per 60 s window from a single IP** \u2014 single-source saturation, no distribution needed.\n\n**Framework reach:** any adapter embedding guard-core on an asyncio loop \u2014 fastapi-guard, flaskapi-guard (async deployments), djapi-guard (ASGI) \u2014 shares the loop with the application, so the freeze takes down every endpoint of the host application, not just the guarded routes.\n\n### PoC\n\n**guard-core only \u2014 no framework adapter needed.** Requires `pip install guard-core`, then `python poc_guard_core_redos.py`. Exit code 0 = freeze reproduced.\n\n```python\n\"\"\"PoC: event-loop ReDoS in guard-core (\u003e= 3.5.0, \u003c= 3.12.0), default config.\n\nThe built-in template-injection pattern is quadratic on \u0027{\u0027 x N, and since 3.5.0\nbuilt-in patterns execute inline (pattern.search) with NO timeout \u2014 only\n`custom` patterns get the compiler\u0027s safe matcher. One detect() call with a\n10,000-char value blocks the event loop ~1.8s; a 256KB JSON body with ~25 such\nfields blocks it ~44s. Runs on the asyncio loop that any adapter\n(fastapi-guard, flaskapi-guard, djapi-guard) shares with the app.\n\nRun:  python poc_guard_core_redos.py\nExit code 0 = freeze reproduced (max loop lag \u003e 1s).\n\"\"\"\n\nimport asyncio\nimport time\n\nfrom guard_core.handlers.suspatterns_handler import sus_patterns_handler\nfrom guard_core.models import SecurityConfig\n\nLOOP_LAGS: list[float] = []\n\n\nasync def _loop_lag_monitor() -\u003e None:\n    while True:\n        t0 = time.monotonic()\n        await asyncio.sleep(0.05)\n        LOOP_LAGS.append(time.monotonic() - t0 - 0.05)\n\n\nasync def main() -\u003e int:\n    config = SecurityConfig(enable_redis=False)  # defaults = enhanced mode\n    sus_patterns_handler.configure(config)\n\n    monitor = asyncio.create_task(_loop_lag_monitor())\n    await asyncio.sleep(0.3)  # baseline samples\n\n    for n in (2_500, 5_000, 10_000):\n        t0 = time.perf_counter()\n        result = await sus_patterns_handler.detect(\n            content=\"{\" * n, ip_address=\"203.0.113.7\", context=\"query_param:q\"\n        )\n        print(f\"\u0027{{\u0027 x {n:5d}: {time.perf_counter()-t0:.2f}s  is_threat={result[\u0027is_threat\u0027]}\")\n\n    # let the starved monitor task wake and record the lag it just endured\n    await asyncio.sleep(0.1)\n    max_lag = max(LOOP_LAGS)\n    print(f\"\\nmax event-loop lag during run: {max_lag:.2f}s\")\n    print(\"VERDICT:\", \"FROZEN\" if max_lag \u003e 1.0 else \"not reproduced\")\n\n    monitor.cancel()\n    return 0 if max_lag \u003e 1.0 else 1\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(asyncio.run(main()))\n```\n\n**Observed output** (Python 3.14, guard-core 3.12.0):\n\n```\n\u0027{\u0027 x  2500: 0.16s  is_threat=False\n\u0027{\u0027 x  5000: 0.51s  is_threat=False\n\u0027{\u0027 x 10000: 1.91s  is_threat=False\n\nmax event-loop lag during run: 2.57s\nVERDICT: FROZEN\n```\n\nAn end-to-end proof through the fastapi-guard adapter (default config, real uvicorn server, in-process loop-lag monitor) measured **1.75 s of server-side event-loop lag from one GET request returning HTTP 200** \u2014 available on request.\n\n### Impact\n\n**Kind of vulnerability:** Regular Expression Denial of Service \u2014 CWE-1333 / CWE-400. Polynomial (quadratic) runtime, O(N\u00b2), not exponential backtracking.\n\n**Who is impacted:** every application embedding guard-core \u2265 3.5.0 with its default configuration (penetration detection enabled) in a single-process asyncio deployment. One unauthenticated request freezes all endpoints for ~1.8 s; one padded POST body freezes them for tens of seconds; repeated requests at only 10/min saturate the worker indefinitely. Because the payload triggers no detection match, no ban counter increments and nothing is logged as suspicious \u2014 the attack is invisible in guard-core\u0027s own telemetry.\n\n**Fix directions:** (1) bound the quantifier in the template pattern (its `{%` sibling at `:524` is already safe because `[^\\%]+` excludes the delimiter \u2014 excluding the delimiter, or bounding the gap, closes it); (2) route built-in patterns through the same `create_safe_matcher()` timeout path as custom patterns, restoring the \u2264 3.4.0 behavior that the changelog advertises.\n\n\n\n## Reporter validation request\n\nThe fix ships in guard-core 3.13.0, now on PyPI. If you reported this issue, please install 3.13.0 and confirm it is resolved. You can reply in this advisory\u0027s discussion thread or open a new issue with the result.",
  "id": "GHSA-r7hm-rjvg-xx7j",
  "modified": "2026-11-19T22:49:33Z",
  "published": "2026-11-19T22:49:33Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/Guard-Core/guard-core/security/advisories/GHSA-r7hm-rjvg-xx7j"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129302"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Guard-Core/guard-core/pull/68"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Guard-Core/guard-core/commit/c07239fa1c5aa93e3f179440e79dad652977d3e4"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Guard-Core/guard-core/releases/tag/3.13.0"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/rennf93/guard-core"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request"
}

GHSA-R7MV-8VCV-GJV6

Vulnerability from github – Published: 2026-11-14 00:31 – Updated: 2026-11-14 00:31
VLAI
Details

IBM ContextForge MCP Gateway 1.0.0 through 1.0.11 is potentially vulnerable to denial of service due to uncontrolled regular expression complexity (CWE-400 / ReDoS). An authenticated user with tool-registration privileges can embed catastrophically backtracking regex patterns in a tool's JSON Schema pattern field; when ContextForge validates arguments against that schema, the validation call may consume unbounded CPU, potentially degrading gateway availability.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-94407"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-11-13T22:17:27Z",
    "severity": "MODERATE"
  },
  "details": "IBM ContextForge MCP Gateway 1.0.0 through 1.0.11 is potentially vulnerable to denial of service due to uncontrolled regular expression complexity (CWE-400 / ReDoS). An authenticated user with tool-registration privileges can embed catastrophically backtracking regex patterns in a tool\u0027s JSON Schema `pattern` field; when ContextForge validates arguments against that schema, the validation call may consume unbounded CPU, potentially degrading gateway availability.",
  "id": "GHSA-r7mv-8vcv-gjv6",
  "modified": "2026-11-14T00:31:44Z",
  "published": "2026-11-14T00:31:44Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-94407"
    },
    {
      "type": "WEB",
      "url": "https://www.ibm.com/support/pages/node/7296667"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-R7PW-R949-XVMF

Vulnerability from github – Published: 2026-11-06 15:31 – Updated: 2026-11-06 15:31
VLAI
Details

Parse Server before 8.6.115 and 9.0.0 before 9.10.7-alpha.1 validates user email address format with a regular expression whose run time grows quadratically with input length and that is applied without a length limit. An unauthenticated attacker who knows the application ID can send a sign-up request, or a logged-in user can update their own email, with a long crafted email address to block the Node.js event loop and deny service to all clients.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-123487"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-11-06T15:17:17Z",
    "severity": "HIGH"
  },
  "details": "Parse Server before 8.6.115 and 9.0.0 before 9.10.7-alpha.1 validates user email address format with a regular expression whose run time grows quadratically with input length and that is applied without a length limit. An unauthenticated attacker who knows the application ID can send a sign-up request, or a logged-in user can update their own email, with a long crafted email address to block the Node.js event loop and deny service to all clients.",
  "id": "GHSA-r7pw-r949-xvmf",
  "modified": "2026-11-06T15:31:27Z",
  "published": "2026-11-06T15:31:27Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/parse-community/parse-server/security/advisories/GHSA-9492-427f-466x"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-123487"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/parse-server-9.0.0-before-9.10.7-alpha.1-redos-via-email-validation-regex"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
      "type": "CVSS_V4"
    }
  ]
}

GHSA-R7W7-VPQ8-C5VV

Vulnerability from github – Published: 2026-11-16 22:11 – Updated: 2026-11-16 22:11
VLAI
Summary
mail-parser is vulnerable to polynomial ReDoS in email header parsing
Details

Summary

Two regular expressions used while parsing email headers backtrack polynomially on attacker-controlled input. Parsing a single small, well-formed email can consume minutes to hours of CPU, denying service to any process that parses untrusted mail.

Both are reachable from an ordinary parse_from_string(), parse_from_bytes() or parse_from_file() call — no special API, option, or malformed structure is required by the victim.

Details

1. Address-header fallback regex (src/mailparser/utils.py)

get_addresses() falls back to _ADDR_FALLBACK_RE whenever email.utils.getaddresses(strict=True) yields no usable address. The alternative ([^<,]*?)\s*<([^>]+)> overlaps a lazy quantifier with an adjacent \s* — a space matches both. Driven by finditer, which retries at every offset and rescans the remainder, matching degrades to quadratic on < padding and cubic on whitespace padding.

The fallback engages on the feature's own happy path, e.g. From: alice@example.com <bob@example.com>.

Measured (4.6.0, CPython 3.14, macOS arm64; reproduced identically on Linux and on CPython 3.9, 3.11, 3.12, 3.13):

Padding Parse time
valid address + 750 sp 0.38 s
+ 1500 sp 2.97 s
+ 3000 sp 23.4 s (×7.9/2×)
+ 6 KB sp 185 s
~100 KB sp hours

Fully RFC 5322-compliant folded headers (all lines ≤ 71 octets) trigger the same blowup, so the input passes normal MTA and library checks. ~100 KB of headers is within Postfix's default header_size_limit = 102400.

All six address headers parsed by the library (From, To, Cc, Bcc, Reply-To, Delivered-To) are affected and their cost adds up linearly.

2. Received-header clause splitter (src/mailparser/const.py)

parse_received() splits on _CLAUSE_SPLITTER, (?:^|\s+)(from|by|via|with|id|for|envelope-from)\s+. Under re.split this backtracks quadratically over any whitespace run that is not followed by a clause keyword. The pre-existing normalization collapsed only [\t\n], so literal spaces — including folded-header padding — reached the splitter intact.

Measured: 24 000 spaces in one Received: header → 22 s; ~100 KB → minutes.

Impact

Availability. A handful of small emails keeps every parsing worker of a mail gateway, ticketing system, quarantine UI, or archiving pipeline permanently busy. No confidentiality or integrity impact.

Anyone who parses email they did not author is affected — which is the library's purpose.

Patches

Fixed in 4.6.1.

  • The address fallback is now a linear scan: the header is split into comma-separated items (quote-aware, in Python), then each item is matched against a bounded angle-address <([^<>\s]+)> with the display name derived in Python, falling back to a bare-email match. Each pattern has a single non-nested quantifier over a negated character class → O(n). 2000 padding spaces: 3.5 s → <0.01 s. 256 KB padding: hours → 0.087 s. Output is preserved on every previously supported shape.
  • parse_received() collapses whitespace runs to a single space before splitting, so the splitter's \s+ only ever matches one character → O(n). The date is extracted from the raw header beforehand, so date formatting is unaffected. 24 000 spaces: 22 s → 0.003 s; 200 000 spaces: 0.004 s.

Regression tests assert linear-time behaviour for both paths.

Workarounds

None within the library. Upgrade to 4.6.1.

Users who cannot upgrade immediately should cap total header size before parsing and enforce a wall-clock timeout around each parse.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "mail-parser"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.2.0"
            },
            {
              "fixed": "4.6.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-129295"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-16T22:11:08Z",
    "nvd_published_at": "2026-11-16T18:17:30Z",
    "severity": "HIGH"
  },
  "details": "### Summary\n\nTwo regular expressions used while parsing email headers backtrack\npolynomially on attacker-controlled input. Parsing a single small, well-formed\nemail can consume minutes to hours of CPU, denying service to any process that\nparses untrusted mail.\n\nBoth are reachable from an ordinary `parse_from_string()`, `parse_from_bytes()`\nor `parse_from_file()` call \u2014 no special API, option, or malformed structure is\nrequired by the victim.\n\n### Details\n\n**1. Address-header fallback regex (`src/mailparser/utils.py`)**\n\n`get_addresses()` falls back to `_ADDR_FALLBACK_RE` whenever\n`email.utils.getaddresses(strict=True)` yields no usable address. The\nalternative `([^\u003c,]*?)\\s*\u003c([^\u003e]+)\u003e` overlaps a lazy quantifier with an adjacent\n`\\s*` \u2014 a space matches both. Driven by `finditer`, which retries at every\noffset and rescans the remainder, matching degrades to **quadratic** on `\u003c`\npadding and **cubic** on whitespace padding.\n\nThe fallback engages on the feature\u0027s own happy path, e.g.\n`From: alice@example.com \u003cbob@example.com\u003e`.\n\nMeasured (4.6.0, CPython 3.14, macOS arm64; reproduced identically on Linux and\non CPython 3.9, 3.11, 3.12, 3.13):\n\n| Padding                | Parse time         |\n| ---------------------- | ------------------ |\n| valid address + 750 sp | 0.38 s             |\n| + 1500 sp              | 2.97 s             |\n| + 3000 sp              | 23.4 s (\u00d77.9/2\u00d7)   |\n| + 6 KB sp              | 185 s              |\n| ~100 KB sp             | hours              |\n\nFully RFC 5322-compliant folded headers (all lines \u2264 71 octets) trigger the same\nblowup, so the input passes normal MTA and library checks. ~100 KB of headers is\nwithin Postfix\u0027s default `header_size_limit = 102400`.\n\nAll six address headers parsed by the library (`From`, `To`, `Cc`, `Bcc`,\n`Reply-To`, `Delivered-To`) are affected and their cost adds up linearly.\n\n**2. Received-header clause splitter (`src/mailparser/const.py`)**\n\n`parse_received()` splits on `_CLAUSE_SPLITTER`,\n`(?:^|\\s+)(from|by|via|with|id|for|envelope-from)\\s+`. Under `re.split` this\nbacktracks **quadratically** over any whitespace run that is not followed by a\nclause keyword. The pre-existing normalization collapsed only `[\\t\\n]`, so\nliteral spaces \u2014 including folded-header padding \u2014 reached the splitter intact.\n\nMeasured: 24 000 spaces in one `Received:` header \u2192 22 s; ~100 KB \u2192 minutes.\n\n### Impact\n\nAvailability. A handful of small emails keeps every parsing worker of a mail\ngateway, ticketing system, quarantine UI, or archiving pipeline permanently\nbusy. No confidentiality or integrity impact.\n\nAnyone who parses email they did not author is affected \u2014 which is the library\u0027s\npurpose.\n\n### Patches\n\nFixed in **4.6.1**.\n\n- The address fallback is now a linear scan: the header is split into\n  comma-separated items (quote-aware, in Python), then each item is matched\n  against a bounded angle-address `\u003c([^\u003c\u003e\\s]+)\u003e` with the display name derived\n  in Python, falling back to a bare-email match. Each pattern has a single\n  non-nested quantifier over a negated character class \u2192 O(n).\n  2000 padding spaces: `3.5 s \u2192 \u003c0.01 s`. 256 KB padding: `hours \u2192 0.087 s`.\n  Output is preserved on every previously supported shape.\n- `parse_received()` collapses whitespace runs to a single space before\n  splitting, so the splitter\u0027s `\\s+` only ever matches one character \u2192 O(n).\n  The date is extracted from the raw header beforehand, so date formatting is\n  unaffected. 24 000 spaces: `22 s \u2192 0.003 s`; 200 000 spaces: `0.004 s`.\n\nRegression tests assert linear-time behaviour for both paths.\n\n### Workarounds\n\nNone within the library. Upgrade to `4.6.1`.\n\nUsers who cannot upgrade immediately should cap total header size before\nparsing and enforce a wall-clock timeout around each parse.",
  "id": "GHSA-r7w7-vpq8-c5vv",
  "modified": "2026-11-16T22:11:08Z",
  "published": "2026-11-16T22:11:08Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/security/advisories/GHSA-r7w7-vpq8-c5vv"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129295"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/pull/166"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/commit/037293158cb291caa96635a54449243d32cd4d96"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/commit/5aab122f0d763991604d2c2bcc807c6bf2489464"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/commit/85e53f820d78ae7c955dafbbcd0e20989a735c2c"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/SpamScope/mail-parser"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/releases/tag/4.6.1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "mail-parser is vulnerable to polynomial ReDoS in email header parsing"
}

GHSA-R836-HH6V-RG5G

Vulnerability from github – Published: 2024-08-07 15:30 – Updated: 2025-11-04 19:51
VLAI
Summary
Django vulnerable to denial-of-service attack
Details

An issue was discovered in Django 5.0 before 5.0.8 and 4.2 before 4.2.15. The urlize and urlizetrunc template filters, and the AdminURLFieldWidget widget, are subject to a potential denial-of-service attack via certain inputs with a very large number of Unicode characters.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "Django"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "5.0"
            },
            {
              "fixed": "5.0.8"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "Django"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.2"
            },
            {
              "fixed": "4.2.15"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2024-41991"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1284",
      "CWE-130",
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-08-07T19:03:05Z",
    "nvd_published_at": "2024-08-07T15:15:56Z",
    "severity": "MODERATE"
  },
  "details": "An issue was discovered in Django 5.0 before 5.0.8 and 4.2 before 4.2.15. The urlize and urlizetrunc template filters, and the AdminURLFieldWidget widget, are subject to a potential denial-of-service attack via certain inputs with a very large number of Unicode characters.",
  "id": "GHSA-r836-hh6v-rg5g",
  "modified": "2025-11-04T19:51:04Z",
  "published": "2024-08-07T15:30:42Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-41991"
    },
    {
      "type": "WEB",
      "url": "https://github.com/django/django/commit/523da8771bce321023f490f70d71a9e973ddc927"
    },
    {
      "type": "WEB",
      "url": "https://github.com/django/django/commit/efea1ef7e2190e3f77ca0651b5458297bc0f6a9f"
    },
    {
      "type": "WEB",
      "url": "https://docs.djangoproject.com/en/dev/releases/security"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/django/django"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2024-69.yaml"
    },
    {
      "type": "WEB",
      "url": "https://groups.google.com/forum/#%21forum/django-announce"
    },
    {
      "type": "WEB",
      "url": "https://security.netapp.com/advisory/ntap-20240905-0007"
    },
    {
      "type": "WEB",
      "url": "https://www.djangoproject.com/weblog/2024/aug/06/security-releases"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Django vulnerable to denial-of-service attack"
}

GHSA-R8WQ-QRXC-HMCM

Vulnerability from github – Published: 2021-11-29 17:58 – Updated: 2021-11-26 18:26
VLAI
Summary
ReDoS in LDAP schema parser
Details

https://github.com/python-ldap/python-ldap/issues/424

Impact

The LDAP schema parser of python-ldap 3.3.1 and earlier are vulnerable to a regular expression denial-of-service attack. The issue affects clients that use ldap.schema package to parse LDAP schema definitions from an untrusted source.

Patches

The upcoming release of python-ldap 3.4.0 will contain a workaround to prevent ReDoS attacks. The schema parser refuses schema definitions with an excessive amount of backslashes.

Workarounds

As a workaround, users can check input for excessive amount of backslashes in schemas. More than a dozen backslashes per line are atypical.

References

CWE-1333

For more information

If you have any questions or comments about this advisory: * Open an issue in python-ldap tracker

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "python-ldap"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.4.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2021-11-26T18:26:27Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
  },
  "details": "https://github.com/python-ldap/python-ldap/issues/424\n\n### Impact\nThe LDAP schema parser of python-ldap 3.3.1 and earlier are vulnerable to a regular expression denial-of-service attack. The issue affects clients that use ``ldap.schema`` package to parse LDAP schema definitions from an untrusted source.\n\n### Patches\nThe upcoming release of python-ldap 3.4.0 will contain a workaround to prevent ReDoS attacks. The schema parser refuses schema definitions with an excessive amount of backslashes.\n\n### Workarounds\nAs a workaround, users can check input for excessive amount of backslashes in schemas. More than a dozen backslashes per line are atypical.\n\n### References\n[CWE-1333](https://cwe.mitre.org/data/definitions/1333.html)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [python-ldap](https://github.com/python-ldap/python-ldap) tracker\n",
  "id": "GHSA-r8wq-qrxc-hmcm",
  "modified": "2021-11-26T18:26:27Z",
  "published": "2021-11-29T17:58:59Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/python-ldap/python-ldap/security/advisories/GHSA-r8wq-qrxc-hmcm"
    },
    {
      "type": "WEB",
      "url": "https://github.com/python-ldap/python-ldap/issues/424"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/python-ldap/python-ldap"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "ReDoS in LDAP schema parser"
}

Mitigation
Architecture and Design

Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.

Mitigation
System Configuration

Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.

Mitigation
Implementation

Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.

Mitigation
Implementation

Limit the length of the input that the regular expression will process.

CAPEC-492: Regular Expression Exponential Blowup

An adversary may execute an attack on a program that uses a poor Regular Expression(Regex) implementation by choosing input that results in an extreme situation for the Regex. A typical extreme situation operates at exponential time compared to the input size. This is due to most implementations using a Nondeterministic Finite Automaton(NFA) state machine to be built by the Regex algorithm since NFA allows backtracking and thus more complex regular expressions.