{"vuln_id":"CVE-2025-54365","aliases":[],"description":"fastapi-guard is a security library for FastAPI that provides middleware to control IPs, log requests, detect penetration attempts and more. In version 3.0.1, the regular expression patched to mitigate the ReDoS vulnerability by limiting the length of string fails to catch inputs that exceed this limit. This type of patch fails to detect cases in which the string representing the attributes of a <script> tag exceeds 100 characters. As a result, most of the regex patterns present in version 3.0.1 can be bypassed. This is fixed in version 3.0.2.","published_at":"2025-07-23T23:15:24.050000Z","modified_at":"2026-06-17T09:39:55.910000Z","first_seen_at":"2026-11-21T19:15:19.382466Z","severity":"high","severity_source":"nvd","cvss_score":7.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N/E:P/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","cwe":["CWE-20","CWE-185","CWE-1333"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00871,"epss_percentile":0.59728,"nvd_status":"Analyzed","enriched_at":"2026-11-22T18:07:25.984629Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2025-54365"},"matched_alias":null,"items":[{"id":10713,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-r7hm-rjvg-xx7j: Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request","summary":"Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request\n\n### Summary\n\nA 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.\"\n\n### Details\n\n**1. The pattern** — `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−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 `[^\\}]+`.\n\n**2. The unprotected execution path** — `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)                        # ← inline, NO timeout\n```\n\nIn 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.\n\n**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 windo\n\nAffected: PyPI:guard-core\n\nFixed in: 3.13.0\n\nReferences:\nhttps://github.com/Guard-Core/guard-core/security/advisories/GHSA-r7hm-rjvg-xx7j\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-129302\nhttps://github.com/Guard-Core/guard-core/pull/68\nhttps://github.com/Guard-Core/guard-core/commit/c07239fa1c5aa93e3f179440e79dad652977d3e4\nhttps://github.com/Guard-Core/guard-core/releases/tag/3.13.0\nhttps://github.com/rennf93/guard-core","url":"https://osv.dev/vulnerability/GHSA-r7hm-rjvg-xx7j","published_at":"2026-11-19T22:49:33Z","updated_at":"2026-11-19T23:00:36.653178Z","fetched_at":"2026-11-21T19:15:55.946124Z","severity":"high","cvss_score":7.8,"epss":0.00871,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"guard-core","vuln_id":"CVE-2026-129302","vuln_ids":["CVE-2025-53539","CVE-2025-54365","CVE-2026-129302","GHSA-J47Q-RC62-W448","GHSA-R7HM-RJVG-XX7J","GHSA-RRF6-PXG8-684G"],"tags":["osv","pypi","fix-available"],"cluster_id":2167,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10713","html":"https://vulnwatch.ve1ve2.com/item/10713"}},{"id":2370,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-r7hm-rjvg-xx7j / CVE-2026-129302: Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request","summary":"Guard Core: Quadratic ReDoS in built-in detection pattern freezes the event loop with a single request\n\n### Summary\n\nA 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.\"\n\n### Details\n\n**1. The pattern** — `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−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 `[^\\}]+`.\n\n**2. The unprotected execution path** — `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)                        # ← inline, NO timeout\n```\n\nIn 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.\n\n**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 windo\n\nAffected packages: pip:guard-core\nPatched: guard-core 3.13.0","url":"https://github.com/advisories/GHSA-r7hm-rjvg-xx7j","published_at":"2026-11-19T22:49:33Z","updated_at":"2026-11-19T22:49:34Z","fetched_at":"2026-11-21T19:15:18.416785Z","severity":"high","cvss_score":7.8,"epss":0.00871,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"guard-core","vuln_id":"CVE-2026-129302","vuln_ids":["CVE-2025-53539","CVE-2025-54365","CVE-2026-129302","GHSA-J47Q-RC62-W448","GHSA-R7HM-RJVG-XX7J","GHSA-RRF6-PXG8-684G"],"tags":["ghsa","pip","CWE-400","CWE-1333"],"cluster_id":2167,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2370","html":"https://vulnwatch.ve1ve2.com/item/2370"}}]}