GHSL-2021-026: ReDoS in NodeRedis - CVE-2021-29469
A regular expression in NodeRedis's monitor mode is vulnerable to catastrophic backtracking, causing exponential runtime when processing a crafted string. An attacker who can control input to the monitor could cause a denial of service by making the process hang.
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 expression contains overlapping or ambiguous clauses that allow exponential backtracking when matching certain inputs.
Impact
This issue may lead to a denial of service.
What the attacker needed
NodeRedis monitor mode enabled; attacker can control input to monitor
The fix
The regular expression should be rewritten to remove ambiguity and overlap, as shown in the examples.
How it was found
- Download and build Redis from source.
- Start the Redis server.
- Install the NodeRedis package.
- Run a Node.js script that creates a Redis client, enables monitor mode, and sets a key to a long crafted string.
- Observe that the subsequent get call hangs and never completes.
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 written in a way that makes them very slow when given a specially crafted input, because the computer tries many possible ways to match. This is called a regular expression denial of service (ReDoS), and it can freeze a program so it stops responding.
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.