GitHub Advisoryadvisory · PyPI
GHSA-wjmf-p669-5m5p Protego has exponential backtracking ReDoS in robots.txt URL wildcard matching
HIGH
Official page ↗
- Aliases
- CVE-2026-55520
- Ecosystem
- PyPI
- Packages
- Protego
- Severity
- High
- CVSS vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- Weaknesses
- CWE-1333, CWE-400
- Reviewed
- 2026-08-28
Affected packages
• PyPI Protego: < 0.6.2 → fixed in 0.6.2
Description
Problem description
Protego constructs regular expressions to match URLs against `robots.txt` `Allow:` and `Disallow:` directives, see `protego._urlpattern._URLPattern._prepare_pattern_for_regex()`. Every `*` in the directive value is translated into a lazy `.*?` regex piece, thus a specially crafted directive value with many asterisks may produce a regex that freezes the parser due to exponential backtracking.
Impact
Parsing a specially crafted `robots.txt` with `protego.Protego.parse()` and then trying to match an URL with `protego.Protego.can_fetch()` results in the latter call not returning for a period dependent on the length of the URL.
Proof of concept
```python
from protego import Protego
robotstxt = f"""
User-agent: *
Disallow: /{"*1" * 12}*Z
"""
rp = Protego.parse(robotstxt)
url = "/" + "1" * 60
rp.can_fetch(url, "mybot") # freezes
```
Related
Alias · CVE (1)
- CVE-2026-55520 Protego is a pure-Python robots.txt parser with support for modern conventions. vulnerability