|1 via 1 paths|
Find, fix and prevent vulnerabilities in your code.
- Vulnerable module: highlight.js
- Introduced through: firstname.lastname@example.org
Introduced through: @email@example.com › firstname.lastname@example.orgRemediation: Upgrade to @email@example.com.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via Exponential and Polynomial catastrophic backtracking in multiple language highlighting.
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe string must start with the letter 'A'
(B|C+)+The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the
+matches one or more times). The
+at the end of this section states that we can look for one or more matches of this section.
DFinally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as
It most cases, it doesn't take very long for a regex engine to find a match:
From there, the number of steps the engine must use to validate a string just continues to grow.
|String||Number of C's||Number of steps|
highlight.js to version 10.4.1 or higher.