# GHSA-7rx3-28cr-v5wh: Handlebars.js has a Prototype Method Access Control Gap via Missing __lookupSetter__ Blocklist Entry

> Attackers can bypass prototype access controls in Handlebars.js when a specific non-default option is enabled, potentially exposing internal object properties.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Mar 2026

## What is GHSA-7rx3-28cr-v5wh?

GHSA-7rx3-28cr-v5wh is a vulnerability in handlebars, published on 29 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

## Summary

The prototype method blocklist in `lib/handlebars/internal/proto-access.js` blocks `constructor`, `__defineGetter__`, `__defineSetter__`, and `__lookupGetter__`, but omits the symmetric `__lookupSetter__`. This omission is only exploitable when the non-default runtime option `allowProtoMethodsByDefault: true` is explicitly set — in that configuration `__lookupSetter__` becomes accessible while its counterparts remain blocked, creating an inconsistent security boundary.

`4.6.0` is the version that introduced `protoAccessControl` and the `allowProtoMethodsByDefault` runtime option.

## Description

In `lib/handlebars/internal/proto-access.js`:

```javascript
const methodWhiteList = Object.create(null);
methodWhiteList['constructor']      = false;
methodWhiteList['__defineGetter__'] = false;
methodWhiteList['__defineSetter__'] = false;
methodWhiteList['__lookupGetter__'] = false;
// __lookupSetter__ intentionally blocked in CVE-2021-23383,
// but omitted here — creating an asymmetric blocklist
```

All four legacy accessor helpers (`__defineGetter__`, `__defineSetter__`, `__lookupGetter__`, `__lookupSetter__`) were involved in the exploit chain addressed by CVE-2021-23383. Three of the four were explicitly blocked; `__lookupSetter__` was left out.

When `allowProtoMethodsByDefault: true` is set, any prototype method **not present** in `methodWhiteList` is permitted by default. Because `__lookupSetter__` is absent from the list, it passes the `checkWhiteList` check and is accessible in templates, while `__lookupGetter__` (its sibling) is correctly denied.

## Workarounds

- Do **not** set `allowProtoMethodsByDefault: true`. The default configuration is not affected.
- If `allowProtoMethodsByDefault` must be enabled, ensure templates do not reference  `__lookupSetter__` through untrusted input.

## Which versions are affected by GHSA-7rx3-28cr-v5wh?

2 open source packages ship an affected version, including handlebars.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `handlebars` | npm | From 4.6.0 | 4.7.9 |
| `handlebars` | npm | From 4.6.0 | 4.7.9 |

## How do I fix GHSA-7rx3-28cr-v5wh?

Upgrade handlebars to 4.7.9 or later.

## Is GHSA-7rx3-28cr-v5wh being exploited?

There is no known exploitation of GHSA-7rx3-28cr-v5wh in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7rx3-28cr-v5wh and fix it if it is affected.

What it is: GHSA-7rx3-28cr-v5wh is a vulnerability in handlebars, published on 29 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-7rx3-28cr-v5wh in the wild and no public exploit code.

Affected packages and fixed versions:
- handlebars (npm): affected from 4.6.0; fixed in 4.7.9
- handlebars (npm): affected from 4.6.0; fixed in 4.7.9

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-7rx3-28cr-v5wh/ (Markdown: https://insights.sbomify.com/GHSA-7rx3-28cr-v5wh/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7rx3-28cr-v5wh

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7rx3-28cr-v5wh/
Summaries are generated and may contain mistakes; the official description above is the record.
