GHSL-2020-310: ReDoS (Regular Expression Denial of Service) in Rocket Chat - CVE-2021-32832
Two regular expressions in Rocket.Chat were vulnerable to ReDoS, causing exponential backtracking on crafted input. An attacker could potentially cause a denial of service by supplying malicious input that triggers the inefficient regex evaluation.
Originally disclosed on GitHub Security Lab
The project contains one or more regular expressions that are vulnerable to ReDoS (Regular Expression Denial of Service)
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the regular expressions contain ambiguous or overlapping clauses that allow exponential backtracking on crafted input.
Impact
This issue may lead to a denial of service, though the feasibility of exploiting it in the application was not confirmed.
What the attacker needed
Ability to supply input to the vulnerable regex
The fix
The regular expressions should be fixed by removing ambiguity and overlap, as the maintainers did in the published fix.
How it was found
- Identify the vulnerable regular expression in api.js.
- Craft an input string that triggers exponential backtracking.
- Run the regular expression against the input, causing a long evaluation time.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A regular expression is a pattern used to match text. Some patterns can be tricked into taking a very long time to process certain inputs, which can slow down or crash a service. This is called a regular expression denial of service (ReDoS).
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.