# Per-request state on shared singleton

Per-request identity, session or tenant state stored on a shared singleton field or thread-local, then read by a later call or concurrent request

_Area: Web access control and IDOR. Seen in 3 disclosed reports; latest 2026-10-19. Updated 2026-11-21._

## How it works

A component that is supposed to be per-request (identity, session, tenant, auth token) is stored somewhere shared: a singleton's instance field, a thread-local context, or a DI provider scoped to the whole application. The code that reads it assumes "whatever is in this slot is mine." That assumption breaks in two ways. Sequentially, a later call on the same thread or batch inherits state a previous call wrote. Concurrently, two requests interleave and overwrite each other's slot, so one request reads the other's identity. Either way the reader trusts state it did not set.

## Where it shows up

- Singleton- or application-scoped providers that hold a field typed as request context, user, session or token [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md)
- Thread-local or context-store writes performed inside a method that is reachable before authentication [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md)
- RPC frameworks that batch multiple method calls onto one thread or execution context [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md)
- Wrapper plugins that re-implement a framework's request lifecycle instead of delegating to it, dropping async_hooks-based isolation [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md)
- `@ExecutionContext`-style injection into a provider whose scope is not per-request [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md)
- Pre-auth allowlists containing methods that internally call state-mutating helpers [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md)

## How to review

The invariant: any state that carries identity, role or tenant must be scoped to exactly one request and must never be readable by a request that did not write it. Check the scope annotation on every provider that injects request context; a singleton holding a context field fails. Check whether the framework's own isolation (async_hooks, request scope) is actually in the path, or whether a wrapper bypasses it [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md). For batched RPC, list every pre-auth-whitelisted method and trace whether it writes session, user or tenant state into a shared slot; if it does, any later call in the same batch runs with that state [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md). Confirm the auth check reads from the request, not from a shared field.

## How finders spotted it

- Noticed the DWR endpoint accepted batched multi-call requests, saw a pre-auth-whitelisted method internally set a core user session on the thread-local context store, then tested a privileged method in the same batch [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md)
- Noticed the framework's async_hooks context fix was bypassed when mounted through a wrapper plugin rather than the native integration; built a two-field resolver with a delay to expose interleaving [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md)
- Noticed context mixing when parallel requests hit the same service, and escalated because the context carries auth tokens [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md)

## Variants seen

- Sequential inheritance within one batched RPC call on a shared thread [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md)
- Concurrent bleed through a wrapper that drops async_hooks isolation [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md)
- Concurrent bleed through a singleton DI provider caching injected context on an instance field [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md)

## Impact and severity

E1 chained the bypass into arbitrary workflow execution, database credential dump and a webshell, reaching remote code execution as Local Service [E1](https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md). E2 and E3 leak execution context and auth tokens between users, breaking tenant and user isolation [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md)[E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md). Severity rises with what the shared slot carries: a full session or core user makes it an authentication bypass; a token makes it cross-user data access.

## 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.
- **Eptura Archibus** (DWR endpoint) fixed in 2025.02: Authentication Bypass, Remote Code Execution, and Database Read in Eptura Archibus (CVE-2026-107186, CVE-2026-107187). Report: https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md
- **@envelop/graphql-modules (npm)** < 9.1.0, fixed in 9.1.0: @envelop/graphql-modules has a Race Condition vulnerability. Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md. Fix: https://github.com/graphql-hive/envelop/commit/ab49fa259a51d976c437e084114e070b99720ba9
- **graphql-modules (npm)** >= 2.2.1, < 2.4.1, fixed in 2.4.1: GraphQL Modules has a Race Condition issue (CVE-2026-23735). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md. Fix: https://github.com/graphql-hive/graphql-modules/pull/2521

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-authentication-bypass-remote-code-execution-and-database-read-in-eptura-archibus-fixed.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-h3hw-29fv-2x75.md
- E3: https://bugbountylibrary.com/r/ghsa%3AGHSA-53wg-r69p-v3r7.md
