Regular Expression Denial of Service (ReDoS) in node-postcss - CVE-2021-23382

node-postcss Updated 02 Oct 2025

Summary

26/04/2021
N/A
Yes i
High
7.5

CVE-2021-23382: 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. Affects node-postcss across 2 version ranges.

< 2b1d04c867995e55124e0a165b7c6622c1735956 < 8.2.1+~cs5.3.23-7

Fixed in 8.2.1+~cs5.3.23-7. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

node-postcss is a widely used tool in the web development ecosystem that allows developers to transform CSS with JavaScript plugins. It is known for its flexibility and extensibility, enabling a variety of functionalities such as autoprefixing, minification, and linting. However, prior to version 8.2.13, node-postcss contained vulnerabilities that could be exploited through its regular expressions, specifically in the handling of source maps.

Vulnerability Detail

The vulnerability identified as CVE-2021-23382 is a Regular Expression Denial of Service (ReDoS) that affects the node-postcss package versions before 8.2.13. This vulnerability arises from the use of inefficient regular expressions in the functions getAnnotationURL() and loadAnnotation() within the lib/previous-map.js file. The regex patterns can lead to excessive backtracking, causing the application to hang or crash when processing specially crafted input. This can result in service downtime and degraded performance, impacting users and applications relying on node-postcss for CSS processing.

How To Fix

Minimum fixed version

8.2.1+~cs5.3.23-7

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-postcss

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, consider implementing input validation to sanitize any user-provided CSS before processing it with node-postcss. This can help mitigate the risk of triggering the vulnerable regex patterns.

Conclusion

CVE-2021-23382 is a significant vulnerability in the node-postcss package that can lead to Denial of Service attacks through inefficient regular expressions. Users are strongly advised to upgrade to version 8.2.13 or later to mitigate this risk. Additionally, utilizing tools like Vulert can help in monitoring and managing open-source vulnerabilities effectively.

See every vulnerability recorded for node-postcss →

Share this vulnerability

FAQ

CVE-2021-23382 is a vulnerability in the node-postcss package that allows for Regular Expression Denial of Service (ReDoS), potentially causing application downtime.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Simply upload your manifest file like package-lock.json to check for vulnerabilities.

Exploiting this vulnerability can lead to service outages and degraded performance, affecting users and applications that rely on node-postcss.

Yes, implementing input validation to sanitize user-provided CSS can help reduce the risk of triggering the vulnerable regex patterns.

The CVSS score for CVE-2021-23382 is 7.5, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for node-postcss.

How To Fix

Minimum fixed version

8.2.1+~cs5.3.23-7

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-postcss

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback