Skip to content
CVE-2026-106446

Handlebars AST Type Confusion JavaScript Injection (CVE-2026-106446)

Initial Access Execution Last updated:

Detects exploitation and presence of CVE-2026-106446, a critical (CVSS 9.8) JavaScript injection vulnerability in the Handlebars npm package (>= 4.0.0, <= 4.7.9). The flaw is an AST type-confusion bug in the compile() path that bypasses the earlier fix for CVE-2026-33937, allowing an attacker who controls template source to craft a Handlebars template whose abstract syntax tree is misinterpreted during code generation, resulting in arbitrary JavaScript execution inside the server-side Node.js process (CWE-94/CWE-843). Exploitation typically appears as anomalous template compilation driven by untrusted input, spawning of child processes from Node services, outbound connections from template-rendering workers, or the presence of vulnerable handlebars versions in installed dependencies. A PoC is public via GHSA-8r5x-fm3f-whwj. Remediation is upgrade to handlebars 4.7.10 or later.

Vulnerability Intelligence

Public PoC

What is CVE-2026-106446 Handlebars AST Type Confusion JavaScript Injection (CVE-2026-106446)?

Handlebars AST Type Confusion JavaScript Injection (CVE-2026-106446) (CVE-2026-106446) maps to the Initial Access and Execution tactics — the adversary is trying to get into your network in MITRE ATT&CK.

This page provides production-ready detection logic for Handlebars AST Type Confusion JavaScript Injection (CVE-2026-106446), covering the data sources and telemetry it touches: Microsoft Defender for Endpoint, DeviceProcessEvents. The queries below are rated high severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Initial Access Execution
Microsoft Sentinel / Defender
kusto
// df00tech DF00-6b9dc2ea5a · https://df00tech.com/detections/CVE-2026-106446 · licence: https://df00tech.com/detections/licence
// Detect Node.js / Handlebars template-rendering processes spawning child processes (post-exploitation of SSTI/code injection)
let renderProcs = dynamic(["node", "node.exe", "npm", "npm.cmd"]);
let suspiciousChildren = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "bash", "sh", "wscript.exe", "cscript.exe", "certutil.exe", "curl", "wget"]);
DeviceProcessEvents
| where InitiatingProcessFileName in~ (renderProcs)
| where FileName in~ (suspiciousChildren)
| where InitiatingProcessCommandLine has_any ("handlebars", "template", "render", "compile", "view")
   or ProcessCommandLine has_any ("child_process", "exec", "spawn", "/bin/sh", "base64")
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, InitiatingProcessParentFileName
| order by Timestamp desc

Flags Node.js template-rendering processes (which commonly load Handlebars) spawning shell, scripting or LOLBin child processes — the primary post-exploitation signal for server-side template/code injection via CVE-2026-106446.

high severity medium confidence

Data Sources

Microsoft Defender for Endpoint DeviceProcessEvents

Required Tables

DeviceProcessEvents

False Positives

  • Legitimate Node.js build tooling or CI runners that spawn shell commands during template precompilation
  • Server-side rendering frameworks that legitimately shell out to image/PDF generation utilities
  • Developer workstations running npm scripts that invoke shells during local development
  • Monitoring or deployment agents written in Node that intentionally spawn child processes

Query fingerprint DF00-6b9dc2ea5a · licence

Sigma logsource & community rules

The detection logic for Handlebars AST Type Confusion JavaScript Injection (CVE-2026-106446) (CVE-2026-106446) above is provided in a vendor-neutral form so you can deploy it on any SIEM. The same logic is shipped here as native KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the following logsource:

logsource:
  category: process_creation
  product: windows

Browse the community-maintained Sigma rules for this technique:


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Install vulnerable Handlebars version

    Expected signal: npm install process events and a node_modules/handlebars directory with version 4.7.9 visible to software-inventory/SCA tooling.

  2. Test 2 Simulate template-injection command execution via Node child_process

    Expected signal: A node process spawning /bin/sh executing 'id', captured by auditd/EDR as a process-creation event.

  3. Test 3 Simulate Handlebars compile of attacker-controlled template

    Expected signal: node process loading the handlebars module, invoking compile(), and spawning a shell child writing a marker file.


Response Playbook

Triage

  1. Confirm whether the host runs a Node.js service that compiles Handlebars templates from untrusted input (user-supplied templates, CMS fields, email/report generators). Identify the exact service and listening port.
  2. Enumerate the installed handlebars version: run `npm ls handlebars` (and inspect nested node_modules) across the affected application; flag any version >= 4.0.0 and <= 4.7.9 as vulnerable.
  3. Review the detected child-process chain: determine the full command line of the shell/LOLBin spawned under the node parent and whether it corresponds to legitimate application behavior or attacker commands.
  4. Correlate the process event with inbound HTTP requests to the rendering endpoint around the same timestamp to identify the attacker-controlled template payload.

Containment

  1. Isolate the affected host or rendering worker from the network if attacker-controlled child-process execution is confirmed.
  2. Disable or rate-limit the template-rendering endpoint, or deploy a WAF rule blocking Handlebars control characters/payload patterns in untrusted template inputs until patched.
  3. Roll the Node service credentials, session secrets and any API keys reachable from the compromised process.

Evidence Collection

  1. Capture the full process tree, command lines, and environment of the node parent and all spawned children from EDR/Sysmon/auditd.
  2. Preserve application and web-server access logs showing the request that delivered the malicious template, including request body and source IP.
  3. Snapshot the node_modules/handlebars directory and package-lock.json to record the exact vulnerable version and dependency path.

Escalation Criteria

  • ! Escalate to incident response if a child process executed attacker-controlled commands (reverse shell, data staging, credential access) rather than benign application activity.
  • ! Escalate if the vulnerable service is internet-facing and processes untrusted template input, given the CVSS 9.8 unauthenticated RCE exposure.
  • ! Escalate if evidence of lateral movement, persistence, or outbound C2 from the rendering host is observed following the template-injection event.

Investigation Guide

Forensic Artifacts

  • > node_modules/handlebars/package.json version field and package-lock.json dependency tree
  • > Process-creation records (Sysmon EID 1 / auditd execve) showing node spawning shell children
  • > Web/application access logs containing the malicious template payload
  • > Node application stdout/stderr and any crash or exception logs around the compile() call

Tuning Guidance

Baseline which Node services on each host legitimately spawn child processes (build/CI runners, PDF/image generators) and exclude those specific parent command lines or hosts. Prioritize alerts where the node parent command line references template/handlebars/render and where the child executes encoded, piped, or network-fetch commands. On developer and CI hosts, consider raising the threshold or scoping the rule to production application tiers only.


Hunting Queries

Hunts for any Node.js process spawning interactive shells across the environment to surface Handlebars (and other SSTI) exploitation beyond the alerting window.

Hunting — KQL
kql
// df00tech DF00-6b9dc2ea5a · https://df00tech.com/detections/CVE-2026-106446 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where InitiatingProcessFileName in~ ("node","node.exe") | where FileName in~ ("sh","bash","cmd.exe","powershell.exe","pwsh.exe") | summarize count() by DeviceName, InitiatingProcessCommandLine, ProcessCommandLine, bin(Timestamp, 1h)
Hunting — SPL
spl
``` df00tech DF00-6b9dc2ea5a · https://df00tech.com/detections/CVE-2026-106446 · licence: https://df00tech.com/detections/licence ```
index=* sourcetype=*sysmon* parent_process="*node*" (process_name="sh" OR process_name="bash" OR process_name="powershell.exe" OR process_name="cmd.exe") | stats count by host, parent_process, process, user

Atomic Red Team Tests

Test 1 Install vulnerable Handlebars version
linux

Installs a vulnerable handlebars release (<= 4.7.9) to validate SCA/version-based detection of CVE-2026-106446.

Command

bash
mkdir -p /tmp/hb-cve && cd /tmp/hb-cve && npm init -y >/dev/null 2>&1 && npm install [email protected] >/dev/null 2>&1 && node -e "console.log('handlebars', require('/tmp/hb-cve/node_modules/handlebars/package.json').version)"

Cleanup

bash
rm -rf /tmp/hb-cve

Expected Telemetry

npm install process events and a node_modules/handlebars directory with version 4.7.9 visible to software-inventory/SCA tooling.

Expected Detection

SCA or version-inventory rule flags handlebars 4.7.9 as within the affected range >= 4.0.0, <= 4.7.9.

Test 2 Simulate template-injection command execution via Node child_process
linux

Simulates the post-injection behavior where a compiled Handlebars template triggers arbitrary JavaScript that shells out, producing the node-parent -> shell-child signal.

Command

bash
node -e "require('child_process').execSync('id > /tmp/hb_cve_poc.txt')"

Cleanup

bash
rm -f /tmp/hb_cve_poc.txt

Expected Telemetry

A node process spawning /bin/sh executing 'id', captured by auditd/EDR as a process-creation event.

Expected Detection

The EQL/KQL/Sysmon rules fire on node spawning a shell child executing a system command.

Test 3 Simulate Handlebars compile of attacker-controlled template
linux

Compiles a template string through Handlebars to exercise the compile() code path targeted by the AST type-confusion, optionally chained to command execution in a lab.

Command

bash
cd /tmp/hb-cve 2>/dev/null || (mkdir -p /tmp/hb-cve && cd /tmp/hb-cve && npm init -y >/dev/null 2>&1 && npm install [email protected] >/dev/null 2>&1); node -e "const H=require('/tmp/hb-cve/node_modules/handlebars'); const t=H.compile('{{this}}'); console.log(t({this:'compiled'})); require('child_process').execSync('echo hb-compile-poc > /tmp/hb_compile_poc.txt')"

Cleanup

bash
rm -f /tmp/hb_compile_poc.txt; rm -rf /tmp/hb-cve

Expected Telemetry

node process loading the handlebars module, invoking compile(), and spawning a shell child writing a marker file.

Expected Detection

Process-chain detections flag the node->shell spawn; SCA flags the vulnerable handlebars version loaded by the process.

Related Detections

Blog posts about this detection

Browse by tactic

Full ATT&CK matrix Search all detections