GHSA-wjmf-p669-5m5p

Suggest an improvement
Source
https://github.com/advisories/GHSA-wjmf-p669-5m5p
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-wjmf-p669-5m5p/GHSA-wjmf-p669-5m5p.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-wjmf-p669-5m5p
Aliases
Published
2026-08-28T18:43:02Z
Modified
2026-09-10T12:25:43Z
Severity
  • 7.1 (High) CVSS_V4 - 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 CVSS Calculator
Summary
Protego has exponential backtracking ReDoS in robots.txt URL wildcard matching
Details

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

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
Database specific
{
    "cwe_ids": [
        "CWE-1333",
        "CWE-400"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-08-28T18:43:02Z",
    "nvd_published_at": null,
    "severity": "HIGH"
}
References

Affected packages

PyPI / protego

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
0.6.2

Affected versions

0.*
0.1.dev0
0.1
0.1.12
0.1.14
0.1.15
0.1.16
0.2.0
0.2.1
0.3.0
0.3.1
0.4.0
0.5.0
0.6.0
0.6.1

Database specific

last_known_affected_version_range
"<= 0.6.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-wjmf-p669-5m5p/GHSA-wjmf-p669-5m5p.json"