OpenConext / OpenConext/Stepup-RA

inefficient regular expression

Open
#408 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Imported low-prio ra
Dominant language
PHP
Stars
2
Forks
2
Avg merge
8d 23h
Merged PRs (30d)
3

Description

This issue is imported from pivotal - Originaly created at Nov 6, 2023 by Peter Havekes

The RA application’s client-side areas operate with an inefficient
regular expression, which may ultimately lead to a client-side Denial-of-Service
(ReDoS). The general composition, in combination with the presence of non-greedy
quantifiers and multiple wildcards within the matchWord regular expression, was
deemed subpar due to backtracking, thus resulting in exponential complexity. This
renders the process vulnerable in the event a larger set of matched characters are
handled. As a consequence, the application could be forced into performing excessive
calculations, which will overload the running process.

Affected file:

Stepup-RA/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/
regex.js

Affected code:

export var matchWord = /[0-9]['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF
uFDF0-\uFFEF]+|[\u0600-\u06FF/]+(\s
?[\u0600-\u06FF]+){1,2}/i;

Solution

Limit the length of the matching strings

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Stepup-RA/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/regex.js and inspect the matchWord regular expression. Limit the length of matching strings as described, ensuring the expression no longer permits excessive backtracking on large inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.