Security Resilience

CVE-2026-33938

RCE in Handlebarsjs Handlebars 4.0.0 – 4.7.9

Published
27 March 2026
Modified
26 October 2026
Patch / advisory
CVSS Score v3.1 8.1
Click a component to see what it means
Raw vectorCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0098 61th percentile
Risk Priority 61 floored blend · peak EPSS

CVSS and EPSS are reproduced from their sources (NVD, FIRST EPSS). EPSS, Forum of Incident Response and Security Teams (FIRST), epss.first.org. Risk Priority is our own derived reading, not an NVD score.

Summary

CVE-2026-33938 is a high-severity Code Injection (CWE-94) vulnerability in Handlebarsjs Handlebars. Its CVSS base score is 8.1 (High).

Operationally, exploitation aligns with the MITRE ATT&CK technique Exploitation for Privilege Escalation (T1068); ranked in the top 39% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.

The strongest mitigations our analysis identified map to SA-11 (Developer Testing and Evaluation) and SI-10 (Information Input Validation) — see the control section below for these in your framework.

Deeper analysis AI-assisted summary

Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.

CVE-2026-33938 is a high-severity vulnerability (CVSS 3.1 score of 8.1) affecting Handlebars.js, a templating engine for building semantic templates, in versions 4.0.0 through 4.7.8. The issue stems from the `@partial-block` special variable being stored in the template data context, making it reachable and mutable from within a template via helpers that accept arbitrary objects. An attacker can overwrite `@partial-block` with a crafted Handlebars Abstract Syntax Tree (AST), and a subsequent invocation of `{{> @partial-block}}` will compile and execute that AST, resulting in arbitrary JavaScript code execution on the server. The vulnerability is associated with CWE-94 (improper control of code generation) and CWE-843 (access of resource using incompatible type).

Exploitation requires network access with no privileges or user interaction (AV:N/AC:H/PR:N/UI:N/S:U), but high attack complexity due to the need for untrusted input to influence templates or context data, combined with helpers that permit arbitrary writes to the context. Attackers can leverage this in scenarios where custom or third-party helpers (e.g., from packages like `handlebars-helpers`) process user-controlled data, enabling remote code execution with high impact on confidentiality, integrity, and availability.

The vulnerability is fixed in Handlebars version 4.7.9, as detailed in the project's security advisory (GHSA-3mfm-83xf-c92r) and release notes. Mitigation workarounds include using the runtime-only build (`require('handlebars/runtime')`), which lacks the vulnerable `compile()` method; auditing registered helpers to ensure they treat context data as read-only and do not write arbitrary values; and avoiding third-party helpers in environments with untrusted template or context input. Relevant patches and details are available in the fix commit and release tag on the Handlebars GitHub repository.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the `@partial-block` special variable is stored in the template data context and is reachable and mutable from within a template via helpers that accept…

more

arbitrary objects. When a helper overwrites `@partial-block` with a crafted Handlebars AST, a subsequent invocation of `{{> @partial-block}}` compiles and executes that AST, enabling arbitrary JavaScript execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. First, use the runtime-only build (`require('handlebars/runtime')`). The `compile()` method is absent, eliminating the vulnerable fallback path. Second, audit registered helpers for any that write arbitrary values to context objects. Helpers should treat context data as read-only. Third, avoid registering helpers from third-party packages (such as `handlebars-helpers`) in contexts where templates or context data can be influenced by untrusted input.

CWE(s)

Related Threats

MITRE ATT&CK Enterprise Techniques

MITRE ATT&CK v20.0

T1068 Exploitation for Privilege Escalation Privilege Escalation
Adversaries may exploit software vulnerabilities in an attempt to elevate privileges.
T1189 Drive-by Compromise Initial Access
Adversaries may gain access to a system through a user visiting a website over the normal course of browsing.
T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
T1203 Exploitation for Client Execution Execution
Adversaries may exploit software vulnerabilities in client applications to execute code.
T1210 Exploitation of Remote Services Lateral Movement
Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network.
T1499 Endpoint Denial of Service Impact
Adversaries may perform Endpoint Denial of Service (DoS) attacks to degrade or block the availability of services to users.
Derived from this CVE’s CWE(s) via the direct CWE→ATT&CK cross-walk.

CVEs Like This One

CVE-2026-33940Same product: Handlebarsjs Handlebars
CVE-2026-33937Same product: Handlebarsjs Handlebars
CVE-2026-33941Same product: Handlebarsjs Handlebars
CVE-2026-44728Shared CWE-843, CWE-94
CVE-2026-106446Shared CWE-843, CWE-94
CVE-2024-7520Shared CWE-843, CWE-94
CVE-2025-29806Shared CWE-843, CWE-94
CVE-2026-55771Shared CWE-843, CWE-94
CVE-2026-83531Shared CWE-917, CWE-94
CVE-2023-42658Shared CWE-917, CWE-94

Affected Assets

handlebarsjs
handlebars
4.0.0 — 4.7.9

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)

—

Detect
Catch it (NIST detect / respond)

—

Harden
Shrink the surface (DISA STIG)

—

Validate
Prove the fix (OWASP ASVS)
  • V1.5.2
  • V15.3.5
  • V1.1.2
  • V1.3.2

Mitigating Controls (NIST 800-53 r5)

Our mappings, made for this CVE.

Developer testing and evaluation finds code paths that accept and execute externally influenced strings.

Input validation directly stops untrusted data from being used to construct executable code without neutralization.

Least privilege limits the damage an injected code fragment can perform once executed.

Requiring documented secure development standards and tools enforces use of safe code-generation APIs and escaping.

Engineering principles can require use of type-safe languages, static typing, and runtime type checks that structurally avoid allocating one type and accessing another.

Memory-protection controls limit the blast radius when a type-confusion access occurs but do not stop the flaw itself.

Mitigating Controls (NIST CSF 2.0)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→CSF cross-walk — links open the control.

PR.PS-06 mostly match
blocks

PR.PS-06's SDLC practices directly target injection flaws via secure coding and testing (mostly), yet as a single broad outcome it leaves many code-generation specifics unaddressed (partial).

Mitigating Controls (ISO/IEC 27001:2022 Annex A)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→ISO cross-walk — links open the control.

finds

A.8.29's programme of code review, static analysis, dynamic testing and penetration testing is the complete pre-production discovery set for code injection: eval/dynamic-execution sinks are visible to SAST, code review catches them, and penetration testing reaches the externally exploitable instances, with no nameable remainder.

prevents

Training technical teams in secure coding practices (per A.6.3's education and training guidance) helps developers avoid constructing code from untrusted input without neutralization, but the effect is a minority one because the clause mandates a general awareness/training practice rather than a specific secure-coding mechanism, and developers remain fallible.

removes

A.8.19 governs the installation and update process for operational software, ensuring only approved, tested code is deployed and unsupported components are removed, but it does not inspect or alter the internal type-safety logic of that code, so a type confusion defect already present in the source is not removed by the installation control.

prevents

Banning unapproved code samples and unauthenticated web services, combined with secure-coding standards and SAST, prevents the dynamic generation or inclusion of attacker-supplied code.

prevents

A.8.30 carries its effect through the secure-development practices its contract requires of the supplier (8.25 to 8.29), so it reduces ordinary software weaknesses like code injection in delivered code the way those practices do, at `partial` -- the effect depends on the supplier's faithful implementation of those practices, which is fallible, and the clause sits at its declared ceiling of `partial` on this verb.

finds

A.8.8's reach is DISCLOSURE — it sees only instances that carry a vendor-published flaw in third-party components. CWE-94 (code injection) does surface as CVEs in some libraries and frameworks, so A.8.8 finds that minority; the bulk of code injection lives in first-party code (eval(), dynamic code generation in the organization's own application), which A.8.8 does not reach — that is the job of SAST/DAST under A.8.29.

References