Skip to content

Add tests and mitigations for ReDoS attacks #2

Description

@justinfagnani

Because of backtracking in the matching algorithm, URLPatternList is likely susceptible to ReDoS (Regex Denial-of-Service) attacks where malicious URLs trigger catastrophic backtracking in vulnerably URL patterns. These problems might also exist in the underlying VM's regex implementation that evaluates regex groups, though those might be harder to guard.

Because we do our own pattern parsing and evaluation (except regex groups), we have some flexibility in how to handle this:

  • Set a backtracking limit within our own matching, enforced across all backtracking locations.
  • Ban regex groups completely, or add an option to
  • Statically analyze and allow only a subset of regex groups

URLPattern itself may also have ReDoS vulnerabilities. It would be best if our mitigations matched what implementors do.

We should:

  • Try to find and test vulnerable patterns
  • Research modern mitigations
  • Research any mitigations in URLPattern, or file an issue on the spec
  • Implement and ship

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions