GHSA-442J-39WM-28R2

GHSA-442J-39WM-28R2 is a low-severity security vulnerability in handlebars (npm), affecting versions >= 4.0.0, <= 4.7.8. It is fixed in 4.7.9.

Summary

In lib/handlebars/runtime.js, the container.lookup() function uses container.lookupProperty() as a gate check to enforce prototype-access controls, but then discards the validated result and performs a second, unguarded property access (depths[i][name]). This Time-of-Check Time-of-Use (TOCTOU) pattern means the security check and the actual read are decoupled, and the raw access bypasses any sanitization that lookupProperty may perform.

Only relevant when the compat compile option is enabled ({compat: true}), which activates depthedLookup in lib/handlebars/compiler/javascript-compiler.js.

Description

The vulnerable code in lib/handlebars/runtime.js (lines 137–144):

lookup: function (depths, name) {
  const len = depths.length;
  for (let i = 0; i < len; i++) {
    let result = depths[i] && container.lookupProperty(depths[i], name);
    if (result != null) {
      return depths[i][name];  // BUG: should be `return result;`
    }
  }
},

container.lookupProperty() (lines 119–136) enforces hasOwnProperty checks and resultIsAllowed() prototype-access controls. However, container.lookup() only uses lookupProperty as a boolean gate, if the gate passes (result != null), it then performs an independent, raw depths[i][name] access that circumvents any transformation or wrapped value that lookupProperty may have returned.

Workarounds

  • Avoid enabling { compat: true } when rendering templates that include untrusted data.
  • Ensure context data objects are plain JSON (no Proxies, no getter-based accessor properties).

Impact

GHSA-442J-39WM-28R2 has a CVSS score of 3.7 (Low). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.7.9); upgrading removes the vulnerable code path.

Affected versions

handlebars (>= 4.0.0, <= 4.7.8)

Security releases

handlebars → 4.7.9 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Upgrade handlebars to 4.7.9 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-442J-39WM-28R2? GHSA-442J-39WM-28R2 is a low-severity security vulnerability in handlebars (npm), affecting versions >= 4.0.0, <= 4.7.8. It is fixed in 4.7.9.
  2. How severe is GHSA-442J-39WM-28R2? GHSA-442J-39WM-28R2 has a CVSS score of 3.7 (Low). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of handlebars are affected by GHSA-442J-39WM-28R2? handlebars (npm) versions >= 4.0.0, <= 4.7.8 is affected.
  4. Is there a fix for GHSA-442J-39WM-28R2? Yes. GHSA-442J-39WM-28R2 is fixed in 4.7.9. Upgrade to this version or later.
  5. Is GHSA-442J-39WM-28R2 exploitable, and should I be worried? Whether GHSA-442J-39WM-28R2 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-442J-39WM-28R2 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-442J-39WM-28R2? Upgrade handlebars to 4.7.9 or later.

Other vulnerabilities in handlebars

CVE-2026-33940CVE-2026-33939CVE-2026-33938CVE-2026-33937CVE-2026-33916

Stop the waste.
Protect your environment with Kodem.