# Cache keyed by unvalidated identifier

Per-client keys built from raw client-supplied strings (IP text, JSON-RPC id, storage name) without canonicalization or scoping

_Area: Web business logic and race conditions. Seen in 2 disclosed reports; latest 2026-05-15. Updated 2026-11-29._

## How it works
A cache, rate-limit counter, or response-routing map is keyed by a value the client controls, taken as-is. The broken assumption is that one client maps to one key. When the key is a raw string, the client can produce many distinct strings for the same identity (IPv6 prefix rotation, alternate address encodings) or collide with another client's key (predictable JSON-RPC ids). Either way the key space no longer matches the population it was meant to isolate, so limits, isolation, or persistence guarantees silently fail [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md)[E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md).

## Where it shows up
- Rate-limit keys string-concatenated from `x-forwarded-for` or a raw IP string [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md)
- IPv6 handling with no /64 (or /56) prefix normalization, and no canonical form for one address [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md)
- Request-id→stream/response maps keyed by client-generated, incrementing JSON-RPC ids [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md)
- Transport or server instances shared across sessions, with a single `this._transport` overwritten per connect [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md)
- Storage-clearing or privacy lists that enumerate some client storage APIs but not all (cookies/localStorage/sessionStorage but not Cache API) [E3](https://bugbountylibrary.com/r/h1%3A1668815.md)

## How to review
Find every map/counter keyed by client input and ask: can two requests from one client yield different keys, or two clients yield the same key? The invariant: the key must be a canonical, scoped function of a verified identity, not raw client text. Check that IPs are parsed and normalized (IPv4-mapped, mixed forms) and grouped by prefix for IPv6 [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md); that request ids are server-scoped or namespaced per session, and transports are not shared across clients [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md); that any "clear all storage" list covers every API the platform exposes [E3](https://bugbountylibrary.com/r/h1%3A1668815.md).

## How finders spotted it
- Noticed the rate-limit key was built from raw textual IP, then reasoned that IPv6 prefix allocations and multiple valid textual forms of one address expand the key space far beyond the client population [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md)
- Reasoned about the transport's requestId→stream map and the single `this._transport` reference, noting SDK clients count ids from 0 so concurrent clients collide [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md)
- Code review of CookieControl.js against iOS 15's newly added `window.caches` showed the storage-clearing list was incomplete [E3](https://bugbountylibrary.com/r/h1%3A1668815.md)

## Variants seen
- Rate limiter keyed on raw IPv6 text, bypassable by prefix rotation or re-encoding [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md)
- Shared transport/server with client-controlled JSON-RPC ids causing cross-client response and notification leaks [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md)
- Privacy control that omits one persistent storage API, allowing cross-session tracking [E3](https://bugbountylibrary.com/r/h1%3A1668815.md)

## Impact and severity
Bypass of auth rate limits enables brute force and abuse [E1](https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md); cross-client data leak routes one client's responses and notifications to another [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md); persistent tracking survives Shields across sessions [E3](https://bugbountylibrary.com/r/h1%3A1668815.md). Impact rises with how far the key space diverges from the real client set and whether the keyed data is another user's.

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **better-auth (npm)** < 1.4.17, fixed in 1.4.17: Better Auth: Rate limiter keys IPv6 addresses individually and is bypassable via prefix rotation (CVE-2026-45364). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md. Fix: https://github.com/better-auth/better-auth/commit/43e719bcc0c223c7079fa0c611a9cf7ea1188254
- **@modelcontextprotocol/sdk (npm)** >= 1.10.0, <= 1.25.3, fixed in 1.26.0: @modelcontextprotocol/sdk has cross-client data leak via shared server/transport instance reuse (CVE-2026-25536). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md

## Evidence
- E1: https://bugbountylibrary.com/r/ghsa%3AGHSA-p6v2-xcpg-h6xw.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-345p-7cg4-v4c7.md
- E3: https://bugbountylibrary.com/r/h1%3A1668815.md
