Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. handlebars
  4. ›
  5. CVE-2026-33941

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

March 27, 2026 (updated March 30, 2026)

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.

References

  • github.com/advisories/GHSA-xjpj-3mr7-gcpf
  • github.com/handlebars-lang/handlebars.js
  • github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2
  • github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9
  • github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-xjpj-3mr7-gcpf
  • nvd.nist.gov/vuln/detail/CVE-2026-33941

Code Behaviors & Features

Detect and mitigate CVE-2026-33941 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 4.0.0 before 4.7.9

Fixed versions

  • 4.7.9

Solution

Upgrade to version 4.7.9 or above.

Impact 8.2 HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-116: Improper Encoding or Escaping of Output
  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

npm/handlebars/CVE-2026-33941.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 09 May 2026 12:19:39 +0000.