CVE-2025-53539
Python vulnerability analysis and mitigation

Overview

FastAPI Guard is a security library for FastAPI that provides middleware to control IPs, log requests, and detect penetration attempts. A vulnerability was discovered in versions up to 3.0.0 where the penetration attempts detection feature uses inefficient regex patterns to scan incoming requests, leading to polynomial complexity backtracks when handling specially crafted inputs. The vulnerability was disclosed on July 7, 2025 and assigned CVE-2025-53539 (NVD, GitHub Advisory).

Technical details

The vulnerability stems from unbounded regex quantifiers in the penetration detection patterns that can cause polynomial complexity backtracking. When processing specially crafted inputs, these inefficient patterns can trigger excessive CPU usage. The vulnerability has been assigned CWE-1333 (Inefficient Regular Expression Complexity) and received a CVSS v4.0 score of 6.9 MEDIUM with vector 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 (Miggo).

Impact

Since penetration detection is enabled by default, services using fastapi-guard middleware without explicitly disabling this feature are vulnerable to Denial of Service (DoS) attacks. An attacker can trigger high CPU usage and make a service unresponsive for hours by sending a single request in size of KBs. Single-threaded uvicorn workers cannot handle any other concurrent requests during the processing of malicious input (GitHub Advisory).

Exploitability

The vulnerability is easily exploitable by sending specially crafted HTTP requests. A proof of concept demonstrates that a payload using nested HTML-like structures with repeated patterns can cause processing times to increase dramatically - from 3.7 seconds with input size 50 to over 15 minutes with input size 200, showing O(n^5) complexity (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been fixed in version 3.0.1 by replacing unbounded regex quantifiers with bounded ones to prevent catastrophic backtracking. For users unable to upgrade immediately, a workaround is available by explicitly setting enable_penetration_detection=False in the middleware configuration (GitHub Commit).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-48039CRITICAL9.1
  • Python logoPython
  • meta-ads-mcp
NoYesAug 07, 2026
CVE-2026-48169HIGH8.8
  • Python logoPython
  • praisonai-platform
NoYesAug 07, 2026
GHSA-wvpp-8hx9-p66jHIGH8.8
  • Python logoPython
  • gitpython
NoYesAug 07, 2026
CVE-2026-71870MEDIUM4.8
  • Python logoPython
  • pypdf2
NoYesAug 07, 2026
CVE-2026-71852MEDIUM4.8
  • Python logoPython
  • pypdf
NoYesAug 07, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management