CVE-2025-54365 fastapi-guard patch contains bypassable RegEx
Attackers can bypass IP and penetration detection filters in fastapi-guard by using long strings, allowing unauthorized access or malicious requests to proceed.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-54365?
CVE-2025-54365 is a high-severity vulnerability in rennf93 fastapi-guard, published on 23 Jul 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Which versions are affected by CVE-2025-54365?
3 open source packages ship an affected version, including fastapi-guard. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
fastapi-guard PyPI | From 3.0.1 | 3.0.2 |
fastapi-guard PyPI | From 3.0.1 | 3.0.2 |
fastapi-guard PyPI | From 3.0.1 | 3.0.2 |
Products include Fastapi-Guard Fastapi Guard.
How do I fix CVE-2025-54365?
Upgrade fastapi-guard to 3.0.2 or later.
Is CVE-2025-54365 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-54365 exists.
Other vulnerabilities in rennf93 fastapi-guard
Sources
Also known as GHSA-rrf6-pxg8-684g, PYSEC-2026-1360.