The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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
    • 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-2022-25858

CVE-2022-25858: Terser Regular Expression DoS Vulnerability

CVE-2022-25858 is a Regular Expression Denial of Service (ReDoS) vulnerability in Terser caused by insecure regex patterns. This article covers the technical details, affected versions, security impact, and mitigation strategies.

Published: February 17, 2026

CVE-2022-25858 Overview

CVE-2022-25858 is a Regular Expression Denial of Service (ReDoS) vulnerability affecting Terser, a popular JavaScript minifier and compressor widely used in modern web development toolchains. The vulnerability exists due to insecure usage of regular expressions within the package, which can be exploited to cause catastrophic backtracking and resource exhaustion when processing maliciously crafted input.

Critical Impact

This vulnerability enables attackers to cause denial of service conditions in build systems, CI/CD pipelines, and any application utilizing vulnerable Terser versions for JavaScript minification, potentially disrupting development workflows and production deployments.

Affected Products

  • Terser versions before 4.8.1 (Node.js package)
  • Terser versions from 5.0.0 and before 5.14.2 (Node.js package)
  • WebJars npm package containing vulnerable Terser versions (Java ecosystem)

Discovery Timeline

  • July 15, 2022 - CVE-2022-25858 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2022-25858

Vulnerability Analysis

The vulnerability resides in Terser's regular expression handling within the compression and evaluation modules. Terser processes regular expressions from JavaScript source code during minification, and certain patterns can trigger exponential time complexity due to catastrophic backtracking in the regex engine.

When Terser encounters specially crafted regular expression patterns in the source code being minified, the regex evaluation can enter a state where the backtracking algorithm explores an exponentially growing number of possible matches. This algorithmic complexity attack consumes excessive CPU resources, effectively freezing the minification process and potentially impacting the entire build system or server.

The vulnerability is classified under CWE-1333 (Inefficient Regular Expression Complexity), which describes scenarios where regex patterns can be exploited to cause denial of service through computational resource exhaustion.

Root Cause

The root cause lies in the lib/compress/evaluate.js and related compression modules where regular expressions from user-supplied JavaScript code are processed without adequate safeguards against ReDoS-prone patterns. The original implementation lacked validation to determine whether a regex pattern could safely be evaluated without risking denial of service.

Attack Vector

An attacker can exploit this vulnerability by supplying JavaScript source code containing malicious regular expression patterns to any application or build process that uses vulnerable Terser versions. Attack scenarios include:

  1. Supply chain attacks: Injecting malicious code into npm packages that get processed by Terser during bundling
  2. Direct targeting: Submitting crafted JavaScript to web applications that perform server-side minification
  3. CI/CD disruption: Including ReDoS-triggering patterns in repositories that use Terser in their build pipelines
javascript
// Security patch introducing regexp_is_safe validation
// Source: https://github.com/terser/terser/commit/d8cc5691be980d663c29cc4d5ce67e852d597012

// Subset of regexps that is not going to cause regexp based DDOS
// https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
const re_safe_regexp = /^[\\/|\0\s\w^$.[[\]()]*$/;

/** Check if the regexp is safe for Terser to create without risking a RegExp DOS */
export const regexp_is_safe = (source) => re_safe_regexp.test(source);

Detection Methods for CVE-2022-25858

Indicators of Compromise

  • Abnormally high CPU utilization during JavaScript build or minification processes
  • Build pipeline timeouts or hangs specifically during Terser minification steps
  • Node.js processes consuming excessive memory or CPU when processing JavaScript files
  • Unusual patterns in source code submissions containing complex nested regex patterns

Detection Strategies

  • Implement software composition analysis (SCA) to identify vulnerable Terser versions in package.json and package-lock.json files
  • Monitor build system resource utilization for anomalies during minification tasks
  • Use dependency scanning tools to flag Terser versions below 4.8.1 or between 5.0.0 and 5.14.2
  • Deploy runtime monitoring for Node.js processes executing Terser to detect prolonged CPU spikes

Monitoring Recommendations

  • Configure alerts for build job durations exceeding normal thresholds
  • Implement CPU usage monitoring on build servers and CI/CD runners
  • Enable dependency vulnerability scanning in your package management workflow
  • Monitor npm audit outputs for known vulnerabilities in project dependencies

How to Mitigate CVE-2022-25858

Immediate Actions Required

  • Update Terser to version 4.8.1 or later for the 4.x branch
  • Update Terser to version 5.14.2 or later for the 5.x branch
  • Audit all projects using Terser and verify the installed version
  • Review transitive dependencies that may include vulnerable Terser versions

Patch Information

The Terser maintainers addressed this vulnerability by introducing a regexp_is_safe function that validates regular expression patterns before processing. The fix ensures only a safe subset of regex patterns are evaluated, preventing ReDoS-prone expressions from being processed.

Security patches are available in the following commits:

  • Version 5.x fix
  • Version 4.x backport fix

For additional vulnerability details, see the Snyk JavaScript Vulnerability Report and Snyk Java Vulnerability Report.

Workarounds

  • Implement build timeouts to prevent indefinite resource consumption if immediate patching is not possible
  • Restrict input sources to trusted JavaScript code until the upgrade is applied
  • Consider pre-validating JavaScript source files for complex regex patterns before minification
  • Use resource limits (CPU, memory) on build processes as a defensive measure
bash
# Update Terser to patched versions
npm update terser@latest

# Or specify minimum safe versions in package.json
npm install terser@">=4.8.1 <5.0.0 || >=5.14.2"

# Audit for vulnerabilities
npm audit

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

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechTerser

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability3.56%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-1333
  • Technical References
  • GitHub Terser Code Reference
  • Vendor Resources
  • GitHub Terser Commit Log

  • GitHub Terser Commit Log

  • Snyk Java Vulnerability Report

  • Snyk JavaScript Vulnerability Report
  • Latest CVEs
  • CVE-2025-70797: LimeSurvey XSS Vulnerability

  • CVE-2025-30650: Juniper Junos OS Auth Bypass Vulnerability

  • CVE-2026-35471: Goshs Path Traversal Vulnerability

  • CVE-2026-35393: Goshs Path Traversal 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