# CVE-2026-33941: Handlebars.js has JavaScript Injection in CLI Precompiler via Unescaped Names and Options

- Severity: High 8.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.33%, higher than 28% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-03-27T18:22:10.000Z
- Modified: 2026-10-26T22:10:00.163Z
- Also known as: GHSA-xjpj-3mr7-gcpf
- Weaknesses: CWE-79, CWE-94, CWE-116
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## Description

Handlebars provides the power necessary to let users build semantic templates. In versions 4.0.0 through 4.7.8, the Handlebars CLI precompiler (`bin/handlebars` / `lib/precompiler.js`) concatenates user-controlled strings — template file names and several CLI options — directly into the JavaScript it emits, without any escaping or sanitization. An attacker who can influence template filenames or CLI arguments can inject arbitrary JavaScript that executes when the generated bundle is loaded in Node.js or a browser. Version 4.7.9 fixes the issue. Some workarounds are available. First, validate all CLI inputs before invoking the precompiler. Reject filenames and option values  that contain characters with JavaScript string-escaping significance (`"`, `'`, `;`, etc.). Second, use a fixed, trusted namespace string passed via a configuration file rather than  command-line arguments in automated pipelines. Third, run the precompiler in a sandboxed environment (container with no write access to sensitive  paths) to limit the impact of successful exploitation. Fourth, audit template filenames in any repository or package that is consumed by an automated  build pipeline.

(As written by CVE List.)

## Affected

- handlebars-lang handlebars.js: >= 4.0.0, < 4.7.9
- cluster-observability-operator/logging-console-plugin-pf4-rhel9: no versions given (not affected: from 1782839279 before *)
- cluster-observability-operator/logging-console-plugin-pf5-rhel9: no versions given (not affected: from 1782840539 before *)
- cluster-observability-operator/troubleshooting-panel-console-plugin-pf6-rhel9: no versions given (not affected: from 1782839996 before *)
- devspaces/code-rhel9: no versions given (not affected: from 1776744110 before *)
- handlebars: no versions given
- openshift-logging/elasticsearch6-rhel9: no versions given
- openshift-logging/elasticsearch-operator-bundle: no versions given
- openshift-logging/elasticsearch-proxy-rhel9: no versions given
- openshift-logging/elasticsearch-rhel9-operator: no versions given
- openshift-logging/kibana6-rhel8: no versions given
- openshift-logging/logging-curator5-rhel9: no versions given
- rhdh/rhdh-hub-rhel9: no versions given
- firefox: no versions given
- thunderbird: no versions given
- 389-ds:1.4/389-ds-base: no versions given
- grafana: no versions given
- mozjs60: no versions given
- rhoai/odh-workbench-codeserver-datascience-cpu-py312-rhel9: no versions given
- handlebars (npm): from 4.0.0 before 4.7.9
- handlebarsjs handlebars: from 4.0.0 before 4.7.9

## Every score

- GitHub_M: CVSS:3.1 8.3 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H`
- redhat-SADP: CVSS:3.1 8.2 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.2 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H`
- NVD: CVSS:3.1 8.2 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H`

## References

- <https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xjpj-3mr7-gcpf> (exploit, vendor-advisory, web)
- <https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2> (patch, web)
- <https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9> (release-notes, web)
- <https://access.redhat.com/security/cve/CVE-2026-33941> (vdb-entry)
- <https://bugzilla.redhat.com/show_bug.cgi?id=2452524> (issue-tracking)
- <https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33941.json>
- <https://access.redhat.com/errata/RHSA-2026:34342> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:10175> (vendor-advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-33941> (advisory)
- <https://github.com/handlebars-lang/handlebars.js> (package)

## Sources

- CVE List: [CVE-2026-33941](https://www.cve.org/CVERecord?id=CVE-2026-33941), CVE Terms of Use, modified 2026-09-11
- GitHub Advisory Database: [GHSA-xjpj-3mr7-gcpf](https://github.com/advisories/GHSA-xjpj-3mr7-gcpf), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-33941](https://nvd.nist.gov/vuln/detail/CVE-2026-33941), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-33941 · Whole record: https://cve.day/CVE-2026-33941.json · Rebuilt by cve.day 2026-11-25T22:59:17.452Z
