Inefficient Regular Expression Complexity in nth-check
High severity
GitHub Reviewed
Published
Sep 20, 2021
to the GitHub Advisory Database
•
Updated Nov 29, 2023
Description
Published by the National Vulnerability Database
Sep 17, 2021
Reviewed
Sep 20, 2021
Published to the GitHub Advisory Database
Sep 20, 2021
Last updated
Nov 29, 2023
There is a Regular Expression Denial of Service (ReDoS) vulnerability in nth-check that causes a denial of service when parsing crafted invalid CSS nth-checks.
The ReDoS vulnerabilities of the regex are mainly due to the sub-pattern
\s*(?:([+-]?)\s*(\d+))?
with quantified overlapping adjacency and can be exploited with the following code.Proof of Concept
The Output
References