Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-23368

CVE-2021-23368: Postcss Regular Expression DoS Vulnerability

CVE-2021-23368 is a Regular Expression Denial of Service (ReDoS) vulnerability in Postcss that occurs during source map parsing. This article covers the technical details, affected versions, and mitigation strategies.

Published: February 25, 2026

CVE-2021-23368 Overview

CVE-2021-23368 is a Regular Expression Denial of Service (ReDoS) vulnerability affecting the PostCSS package, a widely-used CSS transformation tool in Node.js ecosystems. The vulnerability exists in versions 7.0.0 and before 8.2.10, where maliciously crafted source map input can trigger catastrophic backtracking in regular expressions during source map parsing, leading to application unavailability.

Critical Impact

Applications using vulnerable PostCSS versions can be rendered unresponsive when processing maliciously crafted CSS with specially constructed source map annotations, causing denial of service conditions in build pipelines and web applications.

Affected Products

  • PostCSS versions >= 7.0.0 and < 8.2.10 (Node.js)
  • Applications and build tools using vulnerable PostCSS as a dependency
  • Java applications using org.webjars.npm:postcss with vulnerable versions

Discovery Timeline

  • April 12, 2021 - CVE-2021-23368 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2021-23368

Vulnerability Analysis

The vulnerability resides in the source map parsing functionality of PostCSS, specifically in the lib/previous-map.js file. The vulnerable code uses regular expressions with patterns that can cause exponential time complexity when processing certain input strings. When parsing CSS source map annotations, the regex pattern used to match sourceMappingURL comments contains a greedy quantifier combined with whitespace matching (\s*) that creates overlapping match possibilities.

The ReDoS condition occurs because the regex engine attempts multiple matching paths when confronted with input designed to maximize backtracking. This algorithmic complexity attack allows an attacker to consume excessive CPU resources by providing a relatively small malicious input string.

Root Cause

The root cause lies in the unsafe regular expression patterns used in two functions within lib/previous-map.js:

  1. The loadAnnotation() function used the pattern /\/\*\s*# sourceMappingURL=.*\s*\*\//gm where the .* followed by \s* creates ambiguity in matching whitespace before the closing */.

  2. The getAnnotationURL() function used a similar problematic pattern /\/\*\s*# sourceMappingURL=(.*)\s*\*\// with the same vulnerable structure.

The combination of greedy quantifiers (.*) followed by optional whitespace (\s*) allows malicious input to force the regex engine into catastrophic backtracking behavior.

Attack Vector

An attacker can exploit this vulnerability by providing CSS input containing specially crafted source map annotation comments. The attack is network-accessible since PostCSS commonly processes user-provided or externally-sourced CSS files in web applications, build systems, and CI/CD pipelines.

The attack requires no authentication or user interaction - simply submitting malicious CSS to an application that processes it with a vulnerable PostCSS version is sufficient to trigger the denial of service condition.

javascript
// Vulnerable code pattern (before fix)
// Source: https://github.com/postcss/postcss/commit/8682b1e4e328432ba692bed52326e84439cec9e4
   }
 
   loadAnnotation(css) {
-    let annotations = css.match(/\/\*\s*# sourceMappingURL=.*\s*\*\//gm)
+    let annotations = css.match(/\/\*\s*# sourceMappingURL=.*\*\//gm)
 
     if (annotations && annotations.length > 0) {
       // Locate the last sourceMappingURL to avoid picking up
javascript
// Additional fix in getAnnotationURL()
// Source: https://github.com/postcss/postcss/commit/b6f3e4d5a8d7504d553267f80384373af3a3dec5
   }
 
   getAnnotationURL(sourceMapString) {
-    return sourceMapString
-      .match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//)[1]
-      .trim()
+    return sourceMapString.match(/\/\*\s*# sourceMappingURL=(.*)\*\//)[1].trim()
   }
 
   loadAnnotation(css) {

Detection Methods for CVE-2021-23368

Indicators of Compromise

  • Abnormally high CPU utilization during CSS processing or build operations
  • Application timeouts or unresponsiveness when processing CSS files
  • Build pipeline failures with timeout errors in PostCSS-related tasks
  • Unusual process hang states in Node.js applications handling CSS

Detection Strategies

  • Monitor application performance metrics for CPU spikes correlated with CSS processing activities
  • Implement dependency scanning to identify PostCSS versions between 7.0.0 and 8.2.10 in package.json and package-lock.json files
  • Use software composition analysis (SCA) tools to audit both direct and transitive dependencies for vulnerable PostCSS versions
  • Review build logs for timeout patterns associated with CSS transformation tasks

Monitoring Recommendations

  • Configure alerting for abnormal CPU consumption patterns in build and application servers
  • Implement request timeout monitoring for endpoints that process user-supplied CSS
  • Track PostCSS processing duration metrics to detect performance anomalies
  • Set up dependency vulnerability scanning in CI/CD pipelines to catch vulnerable package versions

How to Mitigate CVE-2021-23368

Immediate Actions Required

  • Upgrade PostCSS to version 8.2.10 or later to receive the security fix
  • Audit package.json and package-lock.json for direct and transitive PostCSS dependencies
  • Run npm audit or yarn audit to identify vulnerable dependency chains
  • Consider implementing request timeouts as a defense-in-depth measure for CSS processing endpoints

Patch Information

The vulnerability has been patched in PostCSS version 8.2.10. The fix removes the problematic \s* pattern before the closing comment delimiter, eliminating the regex backtracking issue. Detailed patch information is available in the GitHub PostCSS Commit Update and GitHub PostCSS Commit Change. Additional vulnerability details are documented in the Snyk JS Vulnerability Report and Snyk Java Vulnerability Report.

Workarounds

  • Implement input size limits on CSS files processed by the application to reduce ReDoS impact
  • Configure processing timeouts for CSS transformation operations to prevent indefinite hangs
  • Isolate CSS processing in worker threads or separate processes to prevent main application blocking
  • Validate and sanitize CSS input before processing, particularly source map annotations
bash
# Configuration example
# Update PostCSS to patched version
npm update postcss@latest

# Or specify minimum safe version
npm install postcss@">=8.2.10"

# Audit dependencies for vulnerable packages
npm audit
npm audit fix

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechPostcss

  • SeverityMEDIUM

  • CVSS Score5.3

  • EPSS Probability0.30%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • NVD-CWE-noinfo
  • Technical References
  • Apache MyFaces Development Thread

  • Apache MyFaces Development Discussion

  • Apache MyFaces Commit Discussion

  • Apache MyFaces Commit Update

  • Apache MyFaces Development Thread

  • Apache MyFaces Commit Update
  • Vendor Resources
  • GitHub PostCSS Commit Update

  • GitHub PostCSS Commit Change

  • Snyk Java Vulnerability Report

  • Snyk JS Vulnerability Report
  • Latest CVEs
  • CVE-2026-40322: SiYuan Knowledge Management RCE Vulnerability

  • CVE-2026-40318: SiYuan Path Traversal Vulnerability

  • CVE-2026-40259: SiYuan Auth Bypass Vulnerability

  • CVE-2026-40255: AdonisJS HTTP Server CSRF Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English