LiveActive security incident?Get immediate response
CVE Record

CVE-2026-33940: Handlebars.js has JavaScript Injection via AST Type Confusion when passing an object as dynamic partial

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.

HighCVSS 8.1Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Handlebars.js can be tricked into compiling attacker-shaped data as template code. In vulnerable versions, this can lead to server-side JavaScript execution if an attacker controls data used in a dynamic partial lookup. The issue is fixed in 4.7.9.

Executive priority

Treat this as urgent for internet-facing or multi-tenant services that render Handlebars templates with user-controlled data. Prioritize upgrade or vendor-fixed packages, then validate whether dynamic partials are present.

Technical view

Versions 4.0.0 through 4.7.8 can mishandle a crafted object during dynamic partial resolution. Guard bypass in resolvePartial() can make invokePartial() return undefined, causing fallback compilation through env.compile(). If the object is a valid Handlebars AST containing injected code, generated JavaScript can execute on the server.

Likely exposure

Exposure is most likely in applications using handlebars.js >=4.0.0 and <4.7.9 that render templates where user-controlled context can influence dynamic partial lookup. Runtime-only deployments are less exposed because the compile() fallback is unavailable. The bundle does not identify affected products beyond handlebars.js and referenced Red Hat advisories.

Exploitation context

The source bundle says exploitation requires attacker control over a value returned by dynamic partial lookup. CVSS lists network attack vector, high attack complexity, no privileges, and no user interaction. KEV is false, and the provided sources do not state active exploitation.

Researcher notes

Key condition is not merely using Handlebars; attacker-controlled non-primitive objects must be able to flow into dynamic partial resolution. The public bundle names workarounds but does not provide broad exploit telemetry or confirm active exploitation.

Mitigation direction

  • Upgrade handlebars.js to 4.7.9 or later.
  • Use require('handlebars/runtime') where runtime-only rendering is feasible.
  • Sanitize rendering context before templates are rendered.
  • Avoid dynamic partial lookups when context data is user-controlled.
  • Review Red Hat errata if using affected Red Hat packages.

Validation and detection

  • Inventory direct and transitive handlebars.js versions in deployed applications.
  • Review templates for dynamic partial lookup usage.
  • Trace whether user-controlled context can reach dynamic partial values.
  • Confirm production uses 4.7.9 or a vendor-fixed package.
  • Verify runtime-only builds do not expose compile() fallback paths.
Prepared
Confidence
high
Sources
10

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-843: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cwe · medium confidence lookup

CWE-94: Code execution behavior lookup

Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2026-33940 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
8.1 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

2CVSS vectors
5Timeline events
2ADP providers
9Source links

SSVC decision data

CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: pocAutomatable: noTechnical Impact: total

CVSS vector scores

2 official scores

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
8.1CVSS 3.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H2.25.9GitHub_M
8.1CVSS 3.1HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H2.25.9redhat-SADP

Vulnerability scoring details

Base CVSS 3.1 score

8.1High
CVSS 3.1 vector shape for CVE-2026-33940Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. ADP timelineredhat-SADP

    Made public.

  3. CVE publishedCVE Program

    The CVE record was published.

  4. ADP timelineredhat-SADP

    Reported to Red Hat.

  5. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

ADP provider summaries

CISA-ADPCISA ADP Vulnrichment
other:ssvc
redhat-SADPhandlebars.js: Handlebars.js: Arbitrary code execution via crafted template context
other:Red Hat severity ratingcvssV3_1
  • 2026-03-27T22:02:42.813Z: Reported to Red Hat.
  • 2026-03-27T21:11:10.719Z: Made public.

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
handlebars-langhandlebars.js>= 4.0.0, < 4.7.9Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-843 · source CWE mapping

Access of Resource Using Incompatible Type ('Type Confusion')

Access of Resource Using Incompatible Type ('Type Confusion') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.

CWE-94 · source CWE mapping

Improper Control of Generation of Code ('Code Injection')

Improper Control of Generation of Code ('Code Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.