Skip to content
OpenAdvisories

Description

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, `Handlebars.compile()` accepts a pre-parsed AST object in addition to a template string. The `value` field of a `NumberLiteral` AST node is emitted directly into the generated JavaScript without quoting or sanitization. An attacker who can supply a crafted AST to `compile()` can therefore inject and execute arbitrary JavaScript, leading to Remote Code Execution on the server. Version 4.7.9 fixes the issue. Some workarounds are available. Validate input type before calling `Handlebars.compile()`; ensure the argument is always a `string`, never a plain object or JSON-deserialized value. Use the Handlebars runtime-only build (`handlebars/runtime`) on the server if templates are pre-compiled at build time; `compile()` will be unavailable.

Affected products

VendorProductAffectedFixed
handlebars-lang handlebars.js >= 4.0.0, < 4.7.9 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 node-handlebars 3:4.7.9-1 —
Debian 13 node-handlebars No fix yet —
Debian 12 node-handlebars No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 node-handlebars No fix yet —
Ubuntu 26.04 LTS node-handlebars No fix yet —
Ubuntu 25.10 node-handlebars No fix yet —
Ubuntu 24.04 LTS node-handlebars No fix yet —
Ubuntu 22.04 LTS node-handlebars No fix yet —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 20.04 LTS node-handlebars No fix yet —
Ubuntu 18.04 LTS node-handlebars No fix yet —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling jupyter-base-notebook 7.6.3-r2 —
Wolfi rolling lerna 9.0.7-r2 —
Wolfi rolling opensearch-dashboards-3 3.5.0-r12 —
Wolfi rolling prism 5.14.3-r13 —
Wolfi rolling py3.10-jupyterlab +3 4.6.1-r1 —
Wolfi rolling rancher-api-ui 1.2.3-r8 —
Wolfi rolling ts-patch 4.0.1-r0 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 4 repositories

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
npm handlebars >= 4.0.0, < 4.7.9 4.7.9 GHSA-2w6w-674q-4c4q

Advisories 3

References