GHSL-2020-309: Regular Expression Denial of Service in Fast-csv - CVE-2020-26256
The fast-csv library contains a regular expression vulnerable to catastrophic backtracking, allowing an attacker to cause a denial of service by supplying a crafted input string. An attacker could exploit this to make the server unresponsive.
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
Impact
This issue may lead to a denial of service.
What the attacker needed
Server uses fast-csv to parse untrusted input
The fix
The vulnerability was fixed by updating the regular expression to remove ambiguity, as indicated by the fix commit.
How it was found
- Install fast-csv using npm.
- Create a JavaScript file that requires fast-csv and creates a readable stream with a crafted string.
- Pipe the stream to csv.parse with options ignoreEmpty and delimiter set to tab.
- Run the file with node, causing the regular expression to hang.
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 become extremely slow when given a specially crafted input, causing the program to hang. This is called a regular expression denial of service (ReDoS). In this case, an attacker could send a malicious CSV file to a server using fast-csv, making the server unresponsive.
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.