IT SBIT Services
Schneeberger
DEEN
CVE tracker

Handlebars.js: JavaScript injection via AST type confusion in compile()

CVE-2026-106446Critical 9.8

← All vulnerabilities

Summary

Handlebars.js versions 4.0.0 up to 4.7.9 accept pre-parsed AST objects in compile() and precompile() but validate only some AST values. An attacker who can supply an AST object instead of a template string can inject JavaScript that the compiler writes into generated code, leading to code execution in the server process. Applications that pass only template strings are not affected.

Affected

  • handlebars.js from 4.0.0 up to and including 4.7.9
  • Affected only if the application passes non-string AST objects to compile() or precompile()
  • Check transitive dependencies in lock files; the range reported by one downstream audit starts at 3.0.0, which could not be confirmed

Fixed in

  • handlebars.js 4.7.10 (released 5 October 2026)
  • Precompiled templates must also be rebuilt with the fixed version

Workaround

  • Allow only template strings to reach compile() and precompile() and reject all other input
  • If templates are precompiled at build time, use the runtime-only build (handlebars/runtime) so that compile() is not available on the server
  • These measures are interim only; patching is the complete fix

Exploitation

  • CISA SSVC assessment: exploitation status 'poc', automatable: yes, technical impact: total
  • No confirmed in-the-wild exploitation found; CISA KEV status unknown
  • EPSS: 0.0064
  • Exploitation requires that an application passes attacker-controlled objects, for example JSON from a request body, into the template compiler

Our recommendation

  • Inventory all package-lock.json, yarn.lock and pnpm-lock.yaml files for handlebars below 4.7.10, including transitive and build-time dependencies
  • Upgrade to 4.7.10 or later, including precompiled templates
  • Review code paths that pass request data to compile() or precompile() and enforce string-only input until the upgrade is done
  • Monitor the vendor advisory and CISA KEV for changes

Public exploits

PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.

Research sources

Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 30 Oct 2026, 21:03.

Original description (NVD)

Handlebars provides the power necessary to let users build semantic templates. From 4.0.0 until 4.7.10, Handlebars.compile() and Handlebars.precompile() accept pre-parsed AST objects while validating only selected PathExpression, NumberLiteral, and BooleanLiteral values. This issue bypasses the AST validation introduced in version 4.7.9 for CVE-2026-33937. An attacker who can supply an object instead of a template string can place JavaScript expressions in unchecked values such as Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original. The compiler emits those values into generated JavaScript, causing code execution in the server process when compile output renders or wherever precompile output is loaded. Applications that pass only template strings are not affected. This issue is fixed in version 4.7.10.

NVD references (5)

Sources

The tracker combines official, freely usable data sources – updated continuously:

This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.

Affected? We can help.

We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.