Read the docs
TI-2026-66460 Aliases GHSA-442j-39wm-28r2

Handlebars.js has a Property Access Validation Bypass in container.lookup

Priority LOW 38CWE-367Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
—
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub.

Summary

## 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): ```javascript 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).

Why it matters now

Fix Fixed handlebars (npm): 4.7.9

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—handlebars (npm)4.0.0 to before 4.7.94.7.9Patch availableGHSA-442j-39wm-28r2
  • handlebars (npm) Vendor— Affected 4.0.0 to before 4.7.9 Fixed in 4.7.9 Patch available GHSA-442j-39wm-28r2

Remediation

  • Fix · GHSA-442j-39wm-28r2 handlebars (npm) Fixed in 4.7.9 Advisory →

Timeline

  1. 2026-10-03 Threatist record created from GHSA-442j-39wm-28r2

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences