# GHSA-8982-G8XM-3X5H: Prototype pollution in normalizeQueryParams allows unauthenticated process-wide state changes (cross-user data exposure, DoS)

- Database: GitHub
- Severity: high (stated by ghsa, no CVSS score)
- Published: 2026-10-12
- Modified: 2026-10-14

## Affected versions

- @mastra/server (npm): from 1.62.0, through 1.76.0-alpha.6
- @mastra/deployer (npm): through 1.75.0

## Description

**Affected versions (verified):** `@mastra/server` 1.62.0, 1.75.0 (current `latest`) and 1.76.0-alpha.6; `@mastra/deployer` 1.75.0 still calls `normalizeQueryParams(request.queries())` in `getParams` and uses the same `parseFormData`. Earlier versions not checked.

## Summary

`normalizeQueryParams` (`@mastra/server`, `dist/server/server-adapter/index.js`)
groups bracket-notation query keys (`parent[child]=value`) into a plain object
literal:

```js
const bracketGroups = {};
// ...
if (!bracketGroups[parent]) bracketGroups[parent] = {};
bracketGroups[parent][child] = strValue;
```

For `parent = "__proto__"`, `bracketGroups["__proto__"]` resolves to
`Object.prototype`, so `?__proto__[foo]=bar` sets `Object.prototype.foo = "bar"`
for the whole Node process. For `parent = "toString"` (or `hasOwnProperty`,
`valueOf`, …) it resolves to the shared built-in function, so
`?toString[call]=x` makes `Object.prototype.toString.call` a string until the
process restarts.

`@mastra/deployer`'s `getParams` calls `normalizeQueryParams(request.queries())`
for every registered route, after `checkRouteAuth` but regardless of the result
for routes with `requiresAuth: false`. Framework-public routes such as
`GET /api/auth/me` therefore allow this without credentials, and Mastra skips
user server middleware on those routes, so an application cannot filter it.

## Impact

- Process-wide state change from a single unauthenticated request.
- Zod object schemas read inherited properties, so a polluted key (for example
  `include` on `GET /api/memory/threads/:threadId/messages`) is parsed into the
  input of later, unrelated requests from other users.
- `?toString[call]=x` / `?hasOwnProperty[call]=x` break any code path that uses
  `Object.prototype.toString.call(...)` or `hasOwnProperty.call(...)` (denial of
  service until restart).

Related, lower impact: `parseFormData` in `@mastra/deployer`
(`dist/server/index.js`) assigns `result[key] = …` on a plain object, so a
multipart field named `__proto__` replaces the request body's prototype.

## Reproduction

```bash
curl -s "http://localhost:4111/api/auth/me?__proto__%5Bpolluted%5D=yes" >/dev/null
# in the server process afterwards: ({}).polluted === "yes"
```

## Suggested fix

Build both objects without a prototype (or use a `Map`), e.g.

```js
const queryParams = Object.create(null);
const bracketGroups = Object.create(null);
// ...
if (!bracketGroups[parent]) bracketGroups[parent] = Object.create(null);
```

and skip `__proto__` in `parseFormData` (or build `result` with
`Object.create(null)`). Optionally reject keys with a `__proto__`,
`constructor` or `prototype` segment outright.

We currently carry this as a local patch (bun `patchedDependencies`).


Reported by Sjoerd Tiemensma (TwoFeetUp). The reproduction above was run only against our own local instance; no third-party systems were tested. Happy to share our patch and regression tests.

## References

- https://github.com/mastra-ai/mastra/security/advisories/GHSA-8982-g8xm-3x5h

Page: https://cve.now/GHSA-8982-G8XM-3X5H

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
