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
    • 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-23369

CVE-2021-23369: Handlebars RCE Vulnerability

CVE-2021-23369 is a remote code execution vulnerability in Handlebars that allows attackers to execute arbitrary code when compiling untrusted templates. This post covers the technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-23369 Overview

The Handlebars templating library before version 4.7.7 contains a Remote Code Execution (RCE) vulnerability that can be triggered when specific compiling options are used to process templates from untrusted sources. Handlebars is a widely-used JavaScript templating engine commonly found in Node.js applications, making this vulnerability particularly impactful for web applications that allow user-controlled template content.

Critical Impact

Attackers can achieve Remote Code Execution on the server by crafting malicious Handlebars templates when certain compilation options are enabled. This could lead to complete system compromise, data theft, and lateral movement within the network.

Affected Products

  • Handlebarsjs Handlebars versions before 4.7.7
  • WebJars distributions of Handlebars (org.webjars packages)
  • WebJars NPM and Bower distributions of Handlebars

Discovery Timeline

  • 2021-04-12 - CVE-2021-23369 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-23369

Vulnerability Analysis

This vulnerability allows attackers to execute arbitrary code on the server when Handlebars compiles templates originating from untrusted sources with certain compilation options enabled. The core issue lies in how Handlebars handles property lookups and name escaping during template compilation.

The vulnerability specifically manifests in two areas: the runtime property lookup mechanism and the JavaScript compiler's handling of property names in compatibility mode. When templates from untrusted sources are compiled with specific options, an attacker can manipulate template expressions to escape the intended sandboxing and execute arbitrary JavaScript code on the server.

Applications that accept user-provided Handlebars templates and compile them server-side are at significant risk. This includes content management systems, email templating services, and dynamic report generation systems that allow custom template definitions.

Root Cause

The root cause of CVE-2021-23369 stems from insufficient input validation and improper property access controls in the Handlebars template compilation process. The runtime module directly accessed object properties without proper validation through the lookupProperty function, and the JavaScript compiler failed to properly escape property names when generating code in compatibility mode.

Attack Vector

This vulnerability is exploitable over the network without requiring authentication or user interaction. An attacker can exploit this by submitting a specially crafted Handlebars template to an application that compiles templates from untrusted sources. The malicious template can abuse the property lookup mechanism or inject code through improperly escaped property names during compilation.

The following patch demonstrates the security fix applied to the runtime property lookup:

javascript
           loc: loc
         });
       }
-      return obj[name];
+      return container.lookupProperty(obj, name);
     },
     lookupProperty: function(parent, propertyName) {
       let result = parent[propertyName];

Source: GitHub Commit b6d3de7

The fix ensures that all property accesses go through the lookupProperty function which includes proper prototype property access checks in strict mode.

Additionally, the JavaScript compiler was patched to properly escape property names:

javascript
     return this.internalNameLookup(parent, name);
   },
   depthedLookup: function(name) {
-    return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
+    return [
+      this.aliasable('container.lookup'),
+      '(depths, ',
+      JSON.stringify(name),
+      ')'
+    ];
   },

   compilerInfo: function() {

Source: GitHub Commit f058970

This change uses JSON.stringify to properly escape property names, preventing injection attacks through maliciously crafted property name strings.

Detection Methods for CVE-2021-23369

Indicators of Compromise

  • Unexpected process spawning from Node.js application servers
  • Unusual outbound network connections from application servers
  • Server-side file system modifications not initiated by legitimate application functions
  • Presence of suspicious Handlebars templates containing prototype pollution attempts or constructor access patterns

Detection Strategies

  • Monitor application logs for template compilation errors or unusual template syntax
  • Implement Software Composition Analysis (SCA) to identify vulnerable Handlebars versions in dependencies
  • Use runtime application self-protection (RASP) to detect code injection attempts
  • Scan package.json and package-lock.json files for Handlebars versions below 4.7.7

Monitoring Recommendations

  • Enable verbose logging for template compilation operations in production environments
  • Monitor for unusual patterns in user-submitted content that may indicate template injection attempts
  • Track CPU and memory usage anomalies that could indicate code execution exploitation
  • Implement integrity monitoring for application files and configurations

How to Mitigate CVE-2021-23369

Immediate Actions Required

  • Upgrade Handlebars to version 4.7.7 or later immediately
  • Audit applications for any user-controlled template compilation
  • Implement strict template source validation to prevent untrusted template compilation
  • Consider using precompiled templates only to eliminate runtime compilation attack surface

Patch Information

The vulnerability has been addressed in Handlebars version 4.7.7. Security patches are available through the official Handlebars GitHub repository. Organizations should update their dependencies through npm by running the appropriate package manager commands. The fixes are documented in the GitHub Commit b6d3de7 and GitHub Commit f058970. Additional guidance is available from the NetApp Security Advisory.

Workarounds

  • Disable compilation of templates from untrusted sources entirely
  • Implement strict Content Security Policy (CSP) to limit code execution capabilities
  • Run Node.js applications with minimal privileges and in isolated environments
  • Use template sandboxing or validation layers before compilation
bash
# Update Handlebars to patched version
npm update handlebars@4.7.7

# Verify installed version
npm list handlebars

# Audit dependencies 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
  • TypeRCE

  • Vendor/TechHandlebarsjs

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability1.81%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • NVD-CWE-noinfo
  • Technical References
  • NetApp Security Advisory

  • Snyk Vulnerability SNYK-JAVA-ORGWEBJARS-1074950

  • Snyk Vulnerability SNYK-JAVA-ORGWEBJARSBOWER-1074951

  • Snyk Vulnerability SNYK-JAVA-ORGWEBJARSNPM-1074952

  • Snyk Vulnerability SNYK-JS-HANDLEBARS-1056767
  • Vendor Resources
  • GitHub Commit Update 1

  • GitHub Commit Update 2
  • Related CVEs
  • CVE-2026-33938: Handlebarsjs Handlebars RCE Vulnerability

  • CVE-2026-33940: Handlebars Template Engine RCE Vulnerability

  • CVE-2026-33937: Handlebars Template Engine RCE Vulnerability

  • CVE-2026-33941: Handlebarsjs Handlebars XSS 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