Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSend concurrent requests to Effect application
-
ExploitScheduler batches fibers in single microtask
-
ExecutionAsyncLocalStorage context from first request applied to second request
-
ImpactAccess or modify sensitive data across request boundaries
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Concurrency control, locking
MITRE ATT&CK
1 technique across 1 tactic: Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires Node.js v22.20.0 with Effect 3.19.15, @effect/rpc 0.72.1, @effect/platform 0.94.2, Next.js 16 (App Router), @clerk/nextjs 6.x, and Vercel runtime with Fluid compute. Remote unauthenticated attacker can trigger concurrent requests to exploit AsyncLocalStorage context leakage in MixedScheduler batching. No victim interaction needed. |
| Impact | The CVSS score of 7.4 (High) with vector AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N accurately reflects significant risk despite high attack complexity. Network-based exploitation requires no privileges and achieves high confidentiality and integrity impact through authentication bypass. The AC:H (high complexity) rating accounts for the race condition requiring concurrent requests to manifest. Real-world risk is elevated because the vulnerability only manifests in production under load, making it difficult to detect during development and testing. The detailed proof-of-concept code provided demonstrates practical exploitability. GitHub advisory GHSA-38f7-945m-qr2g confirms this is a legitimate security issue acknowledged by Effect maintainers. Organizations using Effect with Next.js App Router and session-based authentication (Clerk, NextAuth, etc.) face immediate risk of cross-user data exposure and authentication bypass. The high attack complexity prevents trivial exploitation but does not eliminate risk for targeted attacks against high-value applications. No EPSS score or KEV listing is available as this is a recently disclosed 2026 vulnerability, but the combination of authentication bypass impact and available POC code warrants urgent attention. |
| Exploit ScenarioDerived | An attacker sends multiple concurrent authenticated requests to a Next.js application using Effect RPC handlers with Clerk authentication. Due to the scheduler race condition, request B's fiber continuation executes while request A's AsyncLocalStorage context is active, causing auth() to return request A's userId. The attacker's request B now operates with request A's authentication session, bypassing authorization checks and potentially accessing or modifying another user's data. The proof-of-concept code demonstrates this occurs reliably under production concurrency patterns, particularly on Vercel's Fluid compute runtime. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 20, 2026
Node.js applications using Effect library versions 3.19.15 and earlier with @effect/rpc 0.72.1 and @effect/platform 0.94.2 are vulnerable to context confusion due to improper AsyncLocalStorage handling in the MixedScheduler, allowing attackers to access sensitive data from other concurrent requests through race conditions. An attacker can exploit the batching mechanism to read or modify context belonging to different requests processed in the same microtask cycle, potentially leading to data leakage between users in multi-tenant environments. No patch is currently available.
Earlier versions of this analysis (1)
A race condition vulnerability in the Effect TypeScript library's MixedScheduler causes AsyncLocalStorage (ALS) context to be shared across concurrent requests, allowing authentication and authorization bypass. Affects Effect version 3.19.15 and related packages (@effect/rpc 0.72.1, @effect/platform 0.94.2) when used with Next.js App Router and authentication frameworks like Clerk that rely on ALS for request isolation. The vulnerability enables one user's request to read another user's authentication session, cookies, and headers under concurrent load. A detailed proof-of-concept demonstrates the issue reproducing consistently in production environments using Vercel's Fluid compute runtime.
RemediationAI
Implement the documented workaround immediately by capturing ALS-dependent values (auth sessions, cookies, headers) before entering the Effect runtime and passing them via Effect's Context system rather than relying on AsyncLocalStorage. Specifically, call auth() and similar ALS-dependent APIs in the Next.js route handler outside the Effect fiber, then inject values into request headers or use toWebHandler's context parameter. Modify RPC handlers to read authentication data from HttpServerRequest headers instead of calling auth() within Effect generators. Monitor the GitHub advisory at https://github.com/Effect-TS/effect/security/advisories/GHSA-38f7-945m-qr2g for patches. The report proposes three potential fixes from Effect maintainers: using AsyncLocalStorage.snapshot() in the scheduler (Node.js 20.5+), capturing ALS at runFork with per-fiber restoration, or providing formal context injection APIs. Until a patched version is released, the header-based workaround is the only viable mitigation and must be applied to all RPC handlers that perform authentication or access request-scoped data.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerability stems from Effect's MixedScheduler batching mechanism (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization). Effect is a TypeScript framework for building resilient applications using algebraic effects and fiber-based concurrency. The scheduler drains all accumulated fiber continuations in a single microtask or timer callback, causing them to execute within the same Node.js AsyncLocalStorage context. This breaks ALS-based request isolation that Next.js 16 App Router, Clerk authentication, and OpenTelemetry tracing rely upon. When fiber A triggers the scheduler's drain cycle, fiber B's continuations execute in fiber A's ALS context rather than their own. The affected package is identified as pkg:npm/effect. Unlike traditional thread-local storage, Effect's Context system does not propagate Node.js ALS contexts across fiber boundaries, creating a fundamental impedance mismatch between Effect's concurrency model and the Node.js ecosystem's reliance on ALS for request scoping.
Know when Node.js gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
Lifecycle Timeline
2DescriptionGitHub Advisory
Versions
effect: 3.19.15@effect/rpc: 0.72.1@effect/platform: 0.94.2- Node.js: v22.20.0
- Vercel runtime with Fluid compute
- Next.js: 16 (App Router)
@clerk/nextjs: 6.x
Root cause
Effect's MixedScheduler batches fiber continuations and drains them inside a single microtask or timer callback. The AsyncLocalStorage context active during that callback belongs to whichever request first triggered the scheduler's drain cycle - not the request that owns the fiber being resumed.
Detailed mechanism
1. Scheduler batching (effect/src/Scheduler.ts, MixedScheduler)
// MixedScheduler.starve() - called once when first task is scheduled
private starve(depth = 0) {
if (depth >= this.maxNextTickBeforeTimer) {
setTimeout(() => this.starveInternal(0), 0) // timer queue
} else {
Promise.resolve(void 0).then(() => this.starveInternal(depth + 1)) // microtask queue
}
}
// MixedScheduler.starveInternal() - drains ALL accumulated tasks in one call
private starveInternal(depth: number) {
const tasks = this.tasks.buckets
this.tasks.buckets = []
for (const [_, toRun] of tasks) {
for (let i = 0; i < toRun.length; i++) {
toRun[i]() // ← Every fiber continuation runs in the SAME ALS context
}
}
// ...
}scheduleTask only calls starve() when running is false. Subsequent tasks accumulate in this.tasks until starveInternal drains them all. The Promise.then() (or setTimeout) callback inherits the ALS context from whichever call site created it - i.e., whichever request's fiber first set running = true.
Result: Under concurrent load, fiber continuations from Request A and Request B execute inside the same starveInternal call, sharing a single ALS context. If Request A triggered starve(), then Request B's fiber reads Request A's ALS context.
2. toWebHandlerRuntime does not propagate ALS (@effect/platform/src/HttpApp.ts:211-240)
export const toWebHandlerRuntime = <R>(runtime: Runtime.Runtime<R>) => {
const httpRuntime: Types.Mutable<Runtime.Runtime<R>> = Runtime.make(runtime)
const run = Runtime.runFork(httpRuntime)
return <E>(self: Default<E, R | Scope.Scope>, middleware?) => {
return (request: Request, context?): Promise<Response> =>
new Promise((resolve) => {
// Per-request Effect context is correctly set via contextMap:
const contextMap = new Map<string, any>(runtime.context.unsafeMap)
const httpServerRequest = ServerRequest.fromWeb(request)
contextMap.set(ServerRequest.HttpServerRequest.key, httpServerRequest)
httpRuntime.context = Context.unsafeMake(contextMap)
// But the fiber is forked without any ALS propagation:
const fiber = run(httpApp as any) // ← ALS context is NOT captured or restored
})
}
}Effect's own Context (containing HttpServerRequest) is correctly set per-request. But the Node.js ALS context - which frameworks like Next.js, Clerk, and OpenTelemetry rely on - is not captured at fork time or restored when the fiber's continuations execute.
3. The dangerous pattern this enables
// RPC handler - runs inside an Effect fiber
const handler = Effect.gen(function*() {
// This calls auth() from @clerk/nextjs/server, which reads from ALS
const { userId } = yield* Effect.tryPromise({
try: async () => auth(), // ← may read WRONG user's session
catch: () => new UnauthorizedError({ message: "Auth failed" })
})
return yield* repository.getUser(userId)
})The async () => auth() thunk executes when the fiber continuation is scheduled by MixedScheduler. At that point, the ALS context belongs to an arbitrary concurrent request.
Reproduction scenario
Timeline (two concurrent requests to the same toWebHandler endpoint):
T0: Request A arrives → POST handler → webHandler(requestA)
→ Promise executor runs synchronously
→ httpRuntime.context set to A's context
→ fiber A forked, runs first ops synchronously
→ fiber A yields (e.g., at Effect.tryPromise boundary)
→ scheduler.scheduleTask(fiberA_continuation)
→ running=false → starve() called → Promise.resolve().then(drain)
↑ ALS context captured = Request A's context
T1: Request B arrives → POST handler → webHandler(requestB)
→ Promise executor runs synchronously
→ httpRuntime.context set to B's context
→ fiber B forked, runs first ops synchronously
→ fiber B yields
→ scheduler.scheduleTask(fiberB_continuation)
→ running=true → task queued, no new starve()
T2: Microtask fires → starveInternal() runs
→ Drains fiberA_continuation → auth() reads ALS → gets A's context ✓
→ Drains fiberB_continuation → auth() reads ALS → gets A's context ✗ ← WRONG USERMinimal reproduction
import { AsyncLocalStorage } from "node:async_hooks"
import { Effect, Layer } from "effect"
import { RpcServer, RpcSerialization, Rpc, RpcGroup } from "@effect/rpc"
import { HttpServer } from "@effect/platform"
import * as S from "effect/Schema"
// Simulate a framework's ALS (like Next.js / Clerk)
const requestStore = new AsyncLocalStorage<{ userId: string }>()
class GetUser extends Rpc.make("GetUser", {
success: S.Struct({ userId: S.String, alsUserId: S.String }),
failure: S.Never,
payload: {}
}) {}
const MyRpc = RpcGroup.make("MyRpc").add(GetUser)
const MyRpcLive = MyRpc.toLayer(
RpcGroup.toHandlers(MyRpc, {
GetUser: () =>
Effect.gen(function*() {
// Simulate calling an ALS-dependent API inside an Effect fiber
const alsResult = yield* Effect.tryPromise({
try: async () => {
const store = requestStore.getStore()
return store?.userId ?? "NONE"
},
catch: () => { throw new Error("impossible") }
})
return { userId: "from-effect-context", alsUserId: alsResult }
})
})
)
const RpcLayer = MyRpcLive.pipe(
Layer.provideMerge(RpcSerialization.layerJson),
Layer.provideMerge(HttpServer.layerContext)
)
const { handler } = RpcServer.toWebHandler(MyRpc, { layer: RpcLayer })
// Simulate two concurrent requests with different ALS contexts
async function main() {
const results = await Promise.all([
requestStore.run({ userId: "user-A" }, () => handler(makeRpcRequest("GetUser"))),
requestStore.run({ userId: "user-B" }, () => handler(makeRpcRequest("GetUser"))),
])
// Parse responses and check if alsUserId matches the expected user
// Under the bug: both responses may show "user-A" (or one shows the other's)
for (const res of results) {
console.log(await res.json())
}
}Impact
| Symptom | Severity |
|---|---|
auth() returns wrong user's session | Critical - authentication bypass |
cookies() / headers() from Next.js read wrong request | High - data leakage |
| OpenTelemetry trace context crosses requests | Medium - incorrect traces |
| Works locally, fails in production | Hard to diagnose - only manifests under concurrent load |
Workaround
Capture ALS-dependent values before entering the Effect runtime and pass them via Effect's own context system:
// In the route handler - OUTSIDE the Effect fiber (ALS is correct here)
export const POST = async (request: Request) => {
const { userId } = await auth() // ← Safe: still in Next.js ALS context
// Inject into request headers or use the `context` parameter
const headers = new Headers(request.headers)
headers.set("x-clerk-auth-user-id", userId ?? "")
const enrichedRequest = new Request(request.url, {
method: request.method,
headers,
body: request.body,
duplex: "half" as any,
})
return webHandler(enrichedRequest)
}
// In Effect handlers - read from HttpServerRequest headers instead of calling auth()
const getAuthenticatedUserId = Effect.gen(function*() {
const req = yield* HttpServerRequest.HttpServerRequest
const userId = req.headers["x-clerk-auth-user-id"]
if (!userId) return yield* Effect.fail(new UnauthorizedError({ message: "Auth required" }))
return userId
})Suggested fix (for Effect maintainers)
Option A: Propagate ALS context through the scheduler
Capture the AsyncLocalStorage snapshot when a fiber continuation is scheduled, and restore it when the continuation executes:
// In MixedScheduler or the fiber runtime
import { AsyncLocalStorage } from "node:async_hooks"
scheduleTask(task: Task, priority: number) {
// Capture current ALS context
const snapshot = AsyncLocalStorage.snapshot()
this.tasks.scheduleTask(() => snapshot(task), priority)
// ...
}AsyncLocalStorage.snapshot() (Node.js 20.5+) returns a function that, when called, restores the ALS context from the point of capture. This ensures each fiber continuation runs with its originating request's ALS context.
Trade-off: Adds one closure allocation per scheduled task. Could be opt-in via a FiberRef or scheduler option.
Option B: Capture ALS at runFork and restore per fiber step
When Runtime.runFork is called, capture the ALS snapshot and associate it with the fiber. Before each fiber step (in the fiber runtime's evaluateEffect loop), restore the snapshot.
Trade-off: More invasive but provides correct ALS propagation for the fiber's entire lifetime, including across flatMap chains and Effect.tryPromise thunks.
Option C: Document the limitation and provide a context injection API
If ALS propagation is intentionally not supported, document this prominently and provide a first-class API for toWebHandler to accept per-request context. The existing context?: Context.Context<never> parameter on the handler function partially addresses this, but it requires callers to know about the issue and manually extract values before entering Effect.
Related
- Node.js
AsyncLocalStoragedocs: https://nodejs.org/api/async_context.html AsyncLocalStorage.snapshot(): https://nodejs.org/api/async_context.html#static-method-asynclocalstoragesnapshot- Next.js uses ALS for
cookies(),headers(),auth()in App Router - Similar issue pattern in other fiber-based runtimes (e.g., ZIO has
FiberRefpropagation for this)
POC replica of my setup
// Create web handler from Effect RPC
// sharedMemoMap ensures all RPC routes share the same connection pool
const { handler: webHandler, dispose } = RpcServer.toWebHandler(DemoRpc, {
layer: RpcLayer,
memoMap: sharedMemoMap,
});
/**
* POST /api/rpc/demo
*/
export const POST = async (request: Request) => {
return webHandler(request);
};
registerDispose(dispose);Used util functions
/**
* Creates a dispose registry that collects dispose callbacks and runs them
* when `runAll` is invoked. Handles both sync and async dispose functions,
* catching errors to prevent one failing dispose from breaking others.
*
* @internal Exported for testing - use `registerDispose` in application code.
*/
export const makeDisposeRegistry = () => {
const disposeFns: Array<() => void | Promise<void>> = []
const runAll = () => {
for (const fn of disposeFns) {
try {
const result = fn()
if (result && typeof result.then === "function") {
result.then(undefined, (err: unknown) => console.error("Dispose error:", err))
}
} catch (err) {
console.error("Dispose error:", err)
}
}
}
const register = (dispose: () => void | Promise<void>) => {
disposeFns.push(dispose)
}
return { register, runAll }
}
export const registerDispose: (dispose: () => void | Promise<void>) => void = globalValue(
Symbol.for("@global/RegisterDispose"),
() => {
const registry = makeDisposeRegistry()
if (typeof process !== "undefined") {
process.once("beforeExit", registry.runAll)
}
return registry.register
}
)The actual effect that was run within the RPC context that the bug was found
export const getAuthenticatedUserId: Effect.Effect<string, UnauthorizedError> =
Effect.gen(function*() {
const authResult = yield* Effect.tryPromise({
try: async () => auth(),
catch: () =>
new UnauthorizedError({
message: "Failed to get auth session"
})
})
if (!authResult.userId) {
return yield* Effect.fail(
new UnauthorizedError({
message: "Authentication required"
})
)
}
return authResult.userId
})Blast Radius
ecosystem impact- 528 npm packages depend on effect (68 direct, 463 indirect)
Ecosystem-wide dependent count for version 3.20.0.
Executive ViewAI
A critical race condition in the Effect TypeScript library can cause authentication bypass, allowing attackers to access other users' sessions, authentication tokens, and sensitive data during concurrent requests. Organizations using Effect 3.19.15 with Next.js and authentication systems like Clerk face immediate risk of unauthorized data access and potential compliance violations.
Implement request isolation at the application layer by avoiding shared AsyncLocalStorage across concurrent operations; disable or reduce concurrent request processing on affected infrastructure; implement strict input validation and output encoding; add enhanced logging and anomaly detection for cross-user data access patterns; deploy Web Application Firewall rules to detect authentication bypass attempts; consider isolating affected applications to single-request-at-a-time processing until patched; segregate network access to reduce blast radius of compromised sessions.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.
Race conditions occur when multiple concurrent requests exploit the brief time gap between checking a condition and acting upon it (TOCTOU - Time of Check, Time of Use).
Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation
A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour
Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t
Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete
Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc
An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi
Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin
A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond
EUVD-2026-13818
GHSA-38f7-945m-qr2g
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB