CVE-2026-106446: Handlebars: JavaScript Injection via AST Type Confusion in compile (Program.blockParams)

Published Oct 6, 2026
·
Updated

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.

Affected Software

1 affected component
npm/handlebars>=4.0.0<4.7.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Handlebars to a version that resolves this vulnerability.

    Fixed in 4.7.10

Event History

Oct 6, 2026
CVE Published
via MITRE·07:41 PM
Data Sourced
via MITRE·07:41 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which applications are actually exposed to this issue?

Applications are affected only if they pass attacker-controlled pre-parsed AST objects to Handlebars.compile() or Handlebars.precompile(). Applications that pass only template strings are not affected.

2

What does an attacker need to achieve code execution?

The attacker must be able to supply an object in place of a template string. They can use unchecked AST fields, including Program.blockParams.length, a non-PathExpression parameter depth, a non-string StringLiteral.value, or a non-string PathExpression.original, to cause JavaScript to be emitted.

3

When does the injected code execute?

Code execution occurs in the server process when generated output from compile() renders. For precompile(), execution occurs wherever the generated output is loaded.

4

What version fixes the issue?

Upgrade Handlebars to version 4.7.10. The affected range is from 4.0.0 until 4.7.10.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203