{"id":"CVE-2026-33939","aliases":["CVE-2026-33939","GHSA-9cx6-37pm-9jff"],"related":[],"kind":"vulnerability","state":"published","title":"Handlebars.js has Denial of Service via Malformed Decorator Syntax in Template Compilation","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nWhen 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.\n\n## Description\n\nIn `lib/handlebars/compiler/javascript-compiler.js`, the code generated for a decorator invocation looks like:\n\n```javascript\nfn = lookupProperty(decorators, \"n\")(fn, props, container, options) || fn;\n```\n\nWhen `\"n\"` is not a registered decorator, `lookupProperty(decorators, \"n\")` returns `undefined`. The expression immediately attempts to call `undefined` as a function, producing:\n\n```\nTypeError: lookupProperty(...) is not a function\n```\n\nBecause the error is thrown inside the compiled template function and is not caught by the runtime, it propagates up as an unhandled exception and — when not caught by the application — crashes the Node.js process.\n\nThis inconsistency is notable: references to unregistered **helpers** produce a clean `\"Missing helper: ...\"` error, while references to unregistered **decorators** cause a hard crash.\n\n**Attack scenario:** An attacker submits `{{*n}}` as template content to any endpoint that calls `Handlebars.compile(userInput)()`. Each request crashes the server process; with process managers that auto-restart (PM2, systemd), repeated submissions create a persistent DoS.\n\n## Proof of Concept\n\n```javascript\nconst Handlebars = require('handlebars'); // Handlebars 4.7.8, Node.js v22.x\n\n// Any of these payloads crash the process\nHandlebars.compile('{{*n}}')({});\nHandlebars.compile('{{*decorator}}')({});\nHandlebars.compile('{{*constructor}}')({});\n```\n\nExpected crash output:\n```\nTypeError: lookupProperty(...) is not a function\n    at Function.eval [as decorator] (eval at compile (...javascript-compiler.js:134:36))\n```\n\n## Workarounds\n\n- **Wrap compilation and rendering in `try/catch`:**\n  ```javascript\n  try {\n    const result = Handlebars.compile(userInput)(context);\n    res.send(result);\n  } catch (err) {\n    res.status(400).send('Invalid template');\n  }\n  ```\n- **Validate template input** before passing it to `compile()`. Reject templates containing  decorator syntax (`{{*...}}`) if decorators are not used in your application.\n- **Use the pre-compilation workflow:** compile templates at build time and serve only pre-compiled  templates; do not call `compile()` at request time.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Handlebars proporciona la potencia necesaria para permitir a los usuarios construir plantillas semánticas. En las versiones 4.0.0 a 4.7.8, cuando una plantilla de Handlebars contiene sintaxis de decorador que hace referencia a un decorador no registrado (por ejemplo, ’{{n}}’), la plantilla compilada llama a ’lookupProperty(decorators, ’n’)’, lo que devuelve ’undefined’. El tiempo de ejecución invoca inmediatamente el resultado como una función, causando un “TypeError” no manejado: ’... no es una función’ que bloquea el proceso de Node.js. Cualquier aplicación que compile plantillas proporcionadas por el usuario sin envolver la llamada en un “try/catch” es vulnerable a una denegación de servicio de una sola solicitud. La versión 4.7.9 corrige el problema. Algunas soluciones alternativas están disponibles. Envuelva la compilación y la renderización en “try/catch”. Valide la entrada de la plantilla antes de pasarla a “compile()”; rechace las plantillas que contengan sintaxis de decorador (’{{*...}}’) si los decoradores no se utilizan en su aplicación. Utilice el flujo de trabajo de precompilación; compile las plantillas en tiempo de compilación y sirva solo plantillas precompiladas; no llame a “compile()” en tiempo de solicitud.","source":"nvd"}],"published":"2026-03-27T18:21:15.000Z","modified":"2026-10-26T22:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"redhat-SADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-248","CWE-754"],"affected":[{"ranges":[{"version":">= 4.0.0, < 4.7.9","status":"affected"}],"vendor":"handlebars-lang","product":"handlebars.js","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1782839279","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Cluster Observability Operator 1.5.0","package":"cluster-observability-operator/logging-console-plugin-pf4-rhel9","cpe":"cpe:/a:redhat:cluster_observability_operator:1.5::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1782840539","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Cluster Observability Operator 1.5.0","package":"cluster-observability-operator/logging-console-plugin-pf5-rhel9","cpe":"cpe:/a:redhat:cluster_observability_operator:1.5::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1782839996","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Cluster Observability Operator 1.5.0","package":"cluster-observability-operator/troubleshooting-panel-console-plugin-pf6-rhel9","cpe":"cpe:/a:redhat:cluster_observability_operator:1.5::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1776744110","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat OpenShift Dev Spaces 3.27","package":"devspaces/code-rhel9","cpe":"cpe:/a:redhat:openshift_devspaces:3.27::el9","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Cryostat 4","package":"handlebars","cpe":"cpe:/a:redhat:cryostat:4","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/elasticsearch6-rhel9","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/elasticsearch-operator-bundle","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/elasticsearch-proxy-rhel9","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/elasticsearch-rhel9-operator","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/kibana6-rhel8","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","package":"openshift-logging/logging-curator5-rhel9","cpe":"cpe:/a:redhat:logging:5","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Data Grid 8","package":"handlebars","cpe":"cpe:/a:redhat:jboss_data_grid:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 10","package":"firefox","cpe":"cpe:/o:redhat:enterprise_linux:10","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 10","package":"thunderbird","cpe":"cpe:/o:redhat:enterprise_linux:10","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 7","package":"firefox","cpe":"cpe:/o:redhat:enterprise_linux:7","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 8","package":"389-ds:1.4/389-ds-base","cpe":"cpe:/o:redhat:enterprise_linux:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 8","package":"firefox","cpe":"cpe:/o:redhat:enterprise_linux:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 8","package":"grafana","cpe":"cpe:/o:redhat:enterprise_linux:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 8","package":"mozjs60","cpe":"cpe:/o:redhat:enterprise_linux:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 8","package":"thunderbird","cpe":"cpe:/o:redhat:enterprise_linux:8","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 9","package":"firefox","cpe":"cpe:/o:redhat:enterprise_linux:9","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux 9","package":"thunderbird","cpe":"cpe:/o:redhat:enterprise_linux:9","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat OpenShift AI (RHOAI)","package":"rhoai/odh-workbench-codeserver-datascience-cpu-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Process Automation 7","package":"handlebars","cpe":"cpe:/a:redhat:jboss_enterprise_bpms_platform:7","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.7.9"}],"ecosystem":"npm","package":"handlebars","purl":"pkg:npm/handlebars","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.0.0","fixed":"4.7.9"}],"vendor":"handlebarsjs","product":"handlebars","cpe":"cpe:2.3:a:handlebarsjs:handlebars:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-9cx6-37pm-9jff","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-33939","tags":["vdb-entry","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2452508","tags":["issue-tracking","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33939.json","tags":["x-sadp-csaf-vex"],"sources":["cvelist","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2026:34342","tags":["vendor-advisory","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2026:10175","tags":["vendor-advisory","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33939","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/handlebars-lang/handlebars.js","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-03-30T18:52:18.558Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-33939","url":"https://www.cve.org/CVERecord?id=CVE-2026-33939","licence":"CVE Terms of Use","modified":"2026-09-04T12:04:44.445Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9cx6-37pm-9jff","url":"https://github.com/advisories/GHSA-9cx6-37pm-9jff","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:00.150Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-33939","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33939","licence":"Public domain","modified":"2026-10-26T22:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:17.450Z","epss":{"score":0.00879,"percentile":0.56877,"date":"2026-11-30T12:00:22.000Z"}}