# Handlebars.js property access validation bypass in container.lookup

Source: https://junglewise.ai/threats/handlebars-js-property-access-validation-bypass-in-container-lookup-25bcfec0  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-03-29. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: low · CVSS 3.1 · Published 2026-03-29

Handlebars.js is a popular template engine used to render dynamic HTML pages. When the compatibility mode option is enabled, a security check designed to prevent unauthorized access to sensitive object properties can be bypassed, potentially allowing an attacker to access data that should be restricted through template expressions.

Technologies: [handlebars (npm)](https://junglewise.ai/threats/technologies/npm-handlebars). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Low severity, with a CVSS score of 3.1, published 29 March 2026.

**Which products and versions are affected?** handlebars (npm) SEMVER:introduced=4.0.0,fixed=4.7.9.

**Is there a fix for This vulnerability?** Yes. handlebars (npm): upgrade to 4.7.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run handlebars (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- handlebars (npm): upgrade to 4.7.9 or later

  ```sh
  npm install handlebars@4.7.9
  ```


## Technical details

The vulnerability is a TOCTOU race condition (CWE-367) in lib/handlebars/runtime.js where container.lookup() calls container.lookupProperty() as a gate to check whether a property access is allowed, but then discards the validated result and performs an independent, unguarded property access (depths[i][name]). The lookupProperty() function enforces hasOwnProperty checks and resultIsAllowed() prototype-access controls, but these are bypassed by the second access. The vulnerability only affects code compiled with the {compat: true} option, which activates depthiedLookup in the JavaScript compiler. An attacker can exploit this by crafting template expressions that access restricted properties when untrusted data is passed to the template context. The fix is to return the validated result from lookupProperty() directly instead of performing a second raw access. Versions 4.0.0 through 4.7.8 are affected; patched in 4.7.9.

## Affected products

- Handlebars handlebars 4.0.0 to 4.7.8

## Timeline

- 2026-03-29: disclosed: Advisory GHSA-442j-39wm-28r2 published
- 2026-03-26: patched: Security fix committed and released in v4.7.9

## References

- [https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-442j-39wm-28r2](https://github.com/handlebars-lang/handlebars.js/security/advisories/GHSA-442j-39wm-28r2)
- [https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2](https://github.com/handlebars-lang/handlebars.js/commit/68d8df5a88e0a26fe9e6084c5c6aaebe67b07da2)
- [https://github.com/handlebars-lang/handlebars.js](https://github.com/handlebars-lang/handlebars.js)
- [https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9](https://github.com/handlebars-lang/handlebars.js/releases/tag/v4.7.9)

## Related threats

- [Handlebars AST validation bypass in compile and precompile](https://junglewise.ai/threats/cve-2026-106446-handlebars-provides-the-power-necessary-to-let-users-build)
- [Handlebars prototype pollution RCE via constructor bypass](https://junglewise.ai/threats/cve-2026-106445-handlebars-provides-the-power-necessary-to-let-users-build)
- [Handlebars precompile script injection in generated code](https://junglewise.ai/threats/cve-2026-106444-handlebars-provides-the-power-necessary-to-let-users-build)
- [Handlebars.js prototype method access control gap via missing __lookupSetter__](https://junglewise.ai/threats/handlebars-js-prototype-method-access-control-gap-via-missing-f97c2407)
- [Handlebars handlebars.js code injection in CLI precompiler](https://junglewise.ai/threats/cve-2026-33941-handlebars-handlebars-js-code-injection-in-cli-precompiler)
