CVE-2026-33939: CWE-754: Improper Check for Unusual or Exceptional Conditions in handlebars-lang handlebars.js
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, when a Handlebars template contains decorator syntax referencing an unregistered decorator (e.g. `{{*n}}`), the compiled template calls `lookupProperty(decorators, "n")`, which returns `undefined`. The runtime then immediately invokes the result as a function, causing an unhandled `TypeError: ... is not a function` that crashes the Node.js process. Any application that compiles user-supplied templates without wrapping the call in a `try/catch` is vulnerable to a single-request Denial of Service. Version 4.7.9 fixes the issue. Some workarounds are available. Wrap compilation and rendering in `try/catch`. Validate template input before passing it to `compile()`; reject templates containing decorator syntax (`{{*...}}`) if decorators are not used in your application. Use the pre-compilation workflow; compile templates at build time and serve only pre-compiled templates; do not call `compile()` at request time.
AI Analysis
Technical Summary
In Handlebars.js versions 4.0.0 through 4.7.8, when a template includes decorator syntax referencing an unregistered decorator (e.g., {{*n}}), the compiled template calls lookupProperty(decorators, "n"), which returns undefined. The runtime then attempts to invoke this undefined value as a function, causing an unhandled TypeError that crashes the Node.js process. This vulnerability allows an attacker to cause a denial of service by submitting a malicious template that triggers the crash. The issue is fixed in version 4.7.9. Mitigations include wrapping compilation and rendering calls in try/catch blocks, validating templates to reject decorator syntax if decorators are not used, or using a pre-compilation workflow to avoid runtime compilation of user-supplied templates.
Potential Impact
The vulnerability causes a denial of service by crashing the Node.js process when an unregistered decorator is invoked in a template. This impacts availability of applications that compile user-supplied Handlebars templates without proper error handling. There is no impact on confidentiality or integrity reported. The CVSS 3.1 score is 7.5 (High), reflecting network attack vector, low complexity, no privileges required, no user interaction, and impact limited to availability.
Mitigation Recommendations
A fix is available in Handlebars.js version 4.7.9. Users should upgrade to this version to resolve the vulnerability. Until upgrading, applications should wrap template compilation and rendering calls in try/catch blocks to handle potential exceptions. Additionally, validate templates before compilation to reject those containing decorator syntax if decorators are not used. Alternatively, use a pre-compilation workflow to compile templates at build time and serve only pre-compiled templates, avoiding runtime compilation of user-supplied templates.
CVE-2026-33939: CWE-754: Improper Check for Unusual or Exceptional Conditions in handlebars-lang handlebars.js
Description
Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, when a Handlebars template contains decorator syntax referencing an unregistered decorator (e.g. `{{*n}}`), the compiled template calls `lookupProperty(decorators, "n")`, which returns `undefined`. The runtime then immediately invokes the result as a function, causing an unhandled `TypeError: ... is not a function` that crashes the Node.js process. Any application that compiles user-supplied templates without wrapping the call in a `try/catch` is vulnerable to a single-request Denial of Service. Version 4.7.9 fixes the issue. Some workarounds are available. Wrap compilation and rendering in `try/catch`. Validate template input before passing it to `compile()`; reject templates containing decorator syntax (`{{*...}}`) if decorators are not used in your application. Use the pre-compilation workflow; compile templates at build time and serve only pre-compiled templates; do not call `compile()` at request time.
CVSS v3.1
Score 7.5high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In Handlebars.js versions 4.0.0 through 4.7.8, when a template includes decorator syntax referencing an unregistered decorator (e.g., {{*n}}), the compiled template calls lookupProperty(decorators, "n"), which returns undefined. The runtime then attempts to invoke this undefined value as a function, causing an unhandled TypeError that crashes the Node.js process. This vulnerability allows an attacker to cause a denial of service by submitting a malicious template that triggers the crash. The issue is fixed in version 4.7.9. Mitigations include wrapping compilation and rendering calls in try/catch blocks, validating templates to reject decorator syntax if decorators are not used, or using a pre-compilation workflow to avoid runtime compilation of user-supplied templates.
Potential Impact
The vulnerability causes a denial of service by crashing the Node.js process when an unregistered decorator is invoked in a template. This impacts availability of applications that compile user-supplied Handlebars templates without proper error handling. There is no impact on confidentiality or integrity reported. The CVSS 3.1 score is 7.5 (High), reflecting network attack vector, low complexity, no privileges required, no user interaction, and impact limited to availability.
Mitigation Recommendations
A fix is available in Handlebars.js version 4.7.9. Users should upgrade to this version to resolve the vulnerability. Until upgrading, applications should wrap template compilation and rendering calls in try/catch blocks to handle potential exceptions. Additionally, validate templates before compilation to reject those containing decorator syntax if decorators are not used. Alternatively, use a pre-compilation workflow to compile templates at build time and serve only pre-compiled templates, avoiding runtime compilation of user-supplied templates.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-24T19:50:52.103Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-33939","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:10175","vendor":"Red Hat"}]
Threat ID: 69c6f6ca3c064ed76ff81b9f
Added to database: 03/27/2026, 21:29:46 UTC
Last enriched: 07/17/2026, 08:54:08 UTC
Last updated: 07/31/2026, 19:22:58 UTC
Views: 98
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.