Skip to content

Security: Regular expression denial of service via unescaped user input#9370

Open
tuanaiseo wants to merge 1 commit intomozilla:masterfrom
tuanaiseo:contribai/fix/security/regular-expression-denial-of-service-via
Open

Security: Regular expression denial of service via unescaped user input#9370
tuanaiseo wants to merge 1 commit intomozilla:masterfrom
tuanaiseo:contribai/fix/security/regular-expression-denial-of-service-via

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The search string is split and each token is passed directly into new RegExp(filter, 'i'). A malicious user can supply catastrophic-backtracking patterns (for example nested quantifiers) that cause excessive CPU usage during filtering.

Severity: medium
File: ui/push-health/helpers.js

Solution

Treat user input as literal text by escaping regex metacharacters before building a RegExp, or avoid regex entirely and use case-insensitive substring matching (includes). Also cap input length and token count.

Changes

  • ui/push-health/helpers.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The search string is split and each token is passed directly into `new RegExp(filter, 'i')`. A malicious user can supply catastrophic-backtracking patterns (for example nested quantifiers) that cause excessive CPU usage during filtering.

Affected files: helpers.js

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant