Skip to content
8.1 High

CVE-2026-33940 Handlebars provides the power necessary to let users build semantic templates

Description

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, a crafted object placed in the template context can bypass all conditional guards in `resolvePartial()` and cause `invokePartial()` to return `undefined`. The Handlebars runtime then treats the unresolved partial as a source that needs to be compiled, passing the crafted object to `env.compile()`. Because the object is a valid Handlebars AST containing injected code, the generated JavaScript executes arbitrary commands on the server. The attack requires the adversary to control a value that can be returned by a dynamic partial lookup. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). Without `compile()`, the fallback compilation path in `invokePartial` is unreachable. Second, sanitize context data before rendering: Ensure no value in the context is a non-primitive object that could be passed to a dynamic partial. Third, avoid dynamic partial lookups (`{{> (lookup ...)}}`) when context data is user-controlled.

Affected products and versions

Product Affected versions Fixed in
handlebars.js 4.0 4.0.0 → < 4.7.9 4.7.9
Red Hat OpenShift Dev Spaces 3.27 1776744110 earliest → < 1776744110 1776744110
Logging Subsystem for Red Hat OpenShift Versions not published
Red Hat Enterprise Linux 10 Versions not published
Red Hat Enterprise Linux 8 Versions not published
Red Hat Enterprise Linux 9 Versions not published
Cryostat 4 Versions not published
Red Hat Data Grid 8 Versions not published
Red Hat Enterprise Linux 7 Versions not published
Show the 4 other branches
Product Affected versions Fixed in
Red Hat OpenShift AI (RHOAI) Versions not published
Red Hat Process Automation 7 Versions not published
Cluster Observability Operator 1.5.0 1782839996 earliest → < 1782839996 1782839996
Cluster Observability Operator 1.5.2 1782839996 earliest → < 1782839996 1782839996

References

Timeline

  1. Published
  2. Last modified
The 9 CVEs of handlebars.js →
Track this CVE