Improper Encoding or Escaping of Output Affecting org.webjars.npm:handlebars package, versions [,4.7.9)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.29% (21st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-ORGWEBJARSNPM-15807041
  • published31 Mar 2026
  • disclosed27 Mar 2026
  • creditGyde04

Introduced: 27 Mar 2026

CVE-2026-33941  (opens in a new tab)
CWE-116  (opens in a new tab)
CWE-79  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade org.webjars.npm:handlebars to version 4.7.9 or higher.

Overview

org.webjars.npm:handlebars is an extension to the Mustache templating language.

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output through the CLI precompiler in lib/precompiler.js. An attacker can execute arbitrary JavaScript in the generated bundle by supplying crafted template filenames or CLI options such as --namespace, --commonjs, --handlebarPath, or --map. The issue affects the precompiler output path used by bin/handlebars / lib/precompiler.js, where untrusted names and option values were concatenated into emitted JavaScript without escaping.

**Workarounds**

  • Validate template filenames and CLI option values before invoking the precompiler and reject values containing JavaScript string-escaping or statement-breaking characters.
  • Use a fixed, trusted namespace string rather than passing it from the command line in automated pipelines.
  • Run the precompiler in a sandboxed environment with limited write access.

CVSS Base Scores

version 4.0
version 3.1