Nov 19, 2026·10 min read·0 visits
Effect versions prior to 3.22.1 compile Schema.TemplateLiteral string spans into overlapping lazy wildcard regular expressions ([\s\S]*?). Supplying repeated delimiter characters without the expected suffix triggers polynomial O(N^k) backtracking, blocking the JavaScript event loop and causing a remote denial of service.
CVE-2026-121707 is a high-severity Regular Expression Denial of Service (ReDoS) vulnerability in the Effect TypeScript library prior to version 3.22.1. When evaluating untrusted input against Schema.TemplateLiteral definitions containing multiple string spans, the dynamically compiled regular expression exhibits polynomial backtracking complexity. Because JavaScript runtimes execute on a single-threaded event loop, processing specially crafted non-matching strings causes synchronous CPU starvation and complete application unresponsiveness.
Effect (effect on npm) is a core TypeScript framework providing functional programming primitives, concurrency management, and runtime data validation via its built-in Schema module. Within the Schema subsystem, Schema.TemplateLiteral allows developers to validate that runtime string values conform to TypeScript template literal types, such as ${string}.${string}.json or user-${string}@${string}. These schema definitions are frequently deployed at application boundaries to validate incoming HTTP parameters, headers, and RPC payloads.
In Effect versions prior to 3.22.1, the runtime evaluation of Schema.TemplateLiteral relies on dynamically synthesized regular expressions generated by AST.getTemplateLiteralRegExp. When a template literal schema incorporates two or more unconstrained Schema.String spans separated by literal delimiters, the compiler translates each string span into an overlapping lazy wildcard pattern ([\s\S]*?). This construction violates regular expression safety principles by allowing adjacent quantified groups to match the exact same character set as the intervening delimiters.
Classified under CWE-1333 (Inefficient Regular Expression Complexity), this flaw exposes applications to Regular Expression Denial of Service (ReDoS). When an unauthenticated remote client submits a string packed with repeated delimiter characters that ultimately fails validation at the end of the input, the underlying ECMAScript regular expression engine enters a polynomial backtracking state.
Because server-side JavaScript environments—including Node.js, Deno, and Bun—execute application logic and regular expression evaluation synchronously on a single-threaded event loop, this CPU-bound backtracking stalls the entire process. Downstream modules that rely on Schema.decodeUnknown, Schema.is, @effect/rpc, or HttpApi cannot process concurrent connections until the regular expression evaluation terminates.
The root cause of CVE-2026-121707 lies in how the Effect Schema Abstract Syntax Tree (AST) compiler translates TemplateLiteral nodes into regular expression patterns and how ParseResult.ts executes them. A TemplateLiteral AST node consists of a static head string followed by an array of spans, where each span contains a type (such as StringKeyword or NumberKeyword) and a trailing static literal delimiter.
Inside SchemaAST.ts, the constant STRING_KEYWORD_PATTERN is defined as [\s\S]*?. While [\s\S] is intended to match any character including newlines, and the lazy quantifier *? instructs the engine to match as few characters as possible, the character class remains completely unconstrained. Specifically, [\s\S] matches the exact characters used in the static literal delimiters separating the spans.
Consider a schema defined as Schema.TemplateLiteral(Schema.String, ".", Schema.String, ".", Schema.String, ".json"). Prior to version 3.22.1, AST.getTemplateLiteralRegExp compiles this AST into the following anchored regular expression:
^([\s\S]*?)\.([\s\S]*?)\.([\s\S]*?)\.json$When the regular expression engine evaluates a valid string, the lazy quantifiers expand minimally until they encounter the next . delimiter, completing in linear time. However, when the engine evaluates a non-matching string composed of $N$ repeated . characters without the terminating .json suffix, catastrophic polynomial backtracking occurs:
([\s\S]*?)\. consumes zero characters and matches the very first . delimiter.([\s\S]*?)\. consumes zero characters and matches the second . delimiter.([\s\S]*?)\.json$ scans to the end of the string looking for .json. Upon reaching the end of the input and failing to find the suffix, the engine backtracks.. character and attempts the third group again. Once the second group exhausts all remaining . characters, the first group expands by one . character, and the second and third groups repeat their full traversal.For a template literal containing $k$ StringKeyword spans, the engine must evaluate $\binom{N}{k}$ ways to partition the $N$ delimiter characters across the $k$ wildcard groups before declaring a match failure. This yields an asymptotic time complexity of $O(N^k)$. With two string spans, complexity is quadratic ($O(N^2)$); with three string spans, complexity becomes cubic ($O(N^3)$).
The vulnerability was resolved in commit 3cc3c6e1a64cbdc360e9d28e44f3ec3ce0ece6e3 (Pull Request #6761) within packages/effect/src/ParseResult.ts. In the unpatched codebase, the parser generator function go handled the TemplateLiteral AST case by unconditionally compiling the AST into a regular expression and testing the input string against it:
// Vulnerable implementation in packages/effect/src/ParseResult.ts (< 3.22.1)
case "TemplateLiteral": {
const regex = AST.getTemplateLiteralRegExp(ast)
return fromRefinement(ast, (u): u is any => Predicate.isString(u) && regex.test(u))
}To eliminate backtracking without altering the semantics of string template literals, the patch introduces a fast-path check. When every span within the TemplateLiteral AST node is a pure StringKeyword, the parser bypasses AST.getTemplateLiteralRegExp(ast) entirely and instead constructs a deterministic linear-time ($O(N)$) matcher using native string indexing functions:
// Patched implementation in packages/effect/src/ParseResult.ts (>= 3.22.1)
case "TemplateLiteral": {
// Check if all dynamic spans in the template literal are simple StringKeywords
if (ast.spans.every((span) => AST.isStringKeyword(span.type))) {
return fromRefinement(ast, (u): u is any => {
// Verify input is a string and matches the static prefix (head)
if (!Predicate.isString(u) || !u.startsWith(ast.head)) {
return false
}
let position = ast.head.length
// Greedily locate each intermediate literal delimiter in sequential order
for (let i = 0; i < ast.spans.length - 1; i++) {
const literal = ast.spans[i].literal
const index = u.indexOf(literal, position)
if (index === -1) {
return false
}
// Advance cursor past the matched delimiter without ever backtracking
position = index + literal.length
}
// Verify the final suffix literal matches and does not overlap with prior delimiters
const literal = ast.spans[ast.spans.length - 1].literal
return u.endsWith(literal) && u.length - literal.length >= position
})
}
const regex = AST.getTemplateLiteralRegExp(ast)
return fromRefinement(ast, (u): u is any => Predicate.isString(u) && regex.test(u))
}The linear matcher operates on a strict mathematical invariant: because an unconstrained StringKeyword span can match any substring (including delimiter characters), a template literal match exists if and only if the static delimiters appear in sequence from left to right and the final delimiter aligns with the end of the string. If an earlier delimiter match leaves enough room for subsequent delimiters, taking the first available occurrence (u.indexOf(literal, position)) is always optimal. Backtracking to a later occurrence of an intermediate delimiter only reduces the remaining string available for subsequent spans and can never turn a failed match into a successful one.
> [!NOTE]
> Fix Completeness Assessment: The patch completely eliminates ReDoS for TemplateLiteral schemas composed strictly of Schema.String (StringKeyword) spans. However, the condition ast.spans.every((span) => AST.isStringKeyword(span.type)) falls back to AST.getTemplateLiteralRegExp(ast) if a TemplateLiteral mixes multiple Schema.String spans with at least one Schema.Number (NumberKeyword) span (e.g., Schema.TemplateLiteral(Schema.String, ".", Schema.String, ".", Schema.Number)). In that hybrid case, the regular expression compiler is still invoked, and developers should remain cautious when mixing multiple unconstrained string spans with numeric spans in a single template literal.
Exploiting CVE-2026-121707 requires no authentication or specialized privileges if an application exposes an endpoint that validates user-controlled fields against a vulnerable Schema.TemplateLiteral definition. Common attack vectors include REST API query parameters, JSON request body properties validated by HttpApi, or RPC message envelopes processed via @effect/rpc.
To trigger the vulnerability, an attacker identifies a field validated by a multi-span template literal and discovers or infers the delimiter character (such as ., -, /, or :). The attacker then transmits a payload consisting of thousands of repeated delimiter characters while omitting or corrupting the expected trailing literal suffix so that the regular expression is forced to exhaust the entire backtracking search space before returning false.
The following proof-of-concept demonstrates the CPU exhaustion against a 3-span template literal schema on effect < 3.22.1:
import * as S from "effect/Schema"
// Define a template literal schema with three String spans: "${string}.${string}.${string}.json"
const VulnerableSchema = S.TemplateLiteral(
S.String,
".",
S.String,
".",
S.String,
".json"
)
const decode = S.decodeUnknownEither(VulnerableSchema)
// Construct an 8,000-byte payload of repeated delimiter characters lacking the ".json" suffix
// For 3 spans, the regex engine performs ~ (8000^3) / 6 = ~8.53 x 10^10 operations
const payload = ".".repeat(8_000)
console.log("Evaluating payload...")
const startTime = Date.now()
const result = decode(payload)
const duration = Date.now() - startTime
console.log(`Validation completed in ${duration}ms (Result: ${result._tag})`)When executed on a vulnerable version of effect (< 3.22.1), the 8,000-byte payload causes the V8 regular expression engine to evaluate roughly $8.5 \times 10^{10}$ backtracking steps, freezing the Node.js thread for tens of seconds or minutes on a single 8 KB HTTP request. When executed on effect >= 3.22.1, the linear indexOf loop traverses the 8,000 characters once and rejects the input in less than 1 millisecond.
CVE-2026-121707 carries a CVSS v4.0 base score of 8.7 (High) (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N). The vulnerability is remotely exploitable over the network (AV:N) with low attack complexity (AC:L), requires no special attack preconditions (AT:N), and demands neither user privileges (PR:N) nor user interaction (UI:N).
The primary security impact is a high-severity loss of service availability (VA:H), while confidentiality (VC:N) and integrity (VI:N) remain unaffected. Because JavaScript runtimes multiplex thousands of concurrent client connections onto a single operating system thread via the event loop, blocking that thread with synchronous regular expression backtracking halts the entire server instance. Health check probes fail, active WebSocket or HTTP connections time out, and container orchestrators (such as Kubernetes) may repeatedly restart the unresponsive worker pods.
Furthermore, the asymmetric amplification factor of cubic ($O(N^3)$) or quartic ($O(N^4)$) backtracking means an attacker does not need high bandwidth to sustain a denial-of-service condition. Sending a handful of compact HTTP requests (each carrying a 10 KB to 50 KB string field) per minute is sufficient to saturate 100% of a worker thread's CPU capacity indefinitely.
According to threat intelligence metrics, the Exploit Prediction Scoring System (EPSS) score for CVE-2026-121707 is 0.00301 (23.30th percentile), and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The relatively low EPSS score reflects the fact that exploitation cannot be performed via generic blind scanning; an attacker must target a specific application parameter backed by a multi-span Schema.TemplateLiteral schema.
The definitive remediation for CVE-2026-121707 is to upgrade the effect package to version 3.22.1 or later. Version 3.22.1 replaces the regular expression evaluation for pure string template literals with the deterministic linear-time string matcher. Development teams should update their package manifests and regenerate their lockfiles:
# Using npm
npm install effect@^3.22.1
# Using pnpm
pnpm update effect
# Using yarn
yarn upgrade effectAfter upgrading, verify that no older transitive copies of effect remain in package-lock.json, pnpm-lock.yaml, or yarn.lock by running npm ls effect or pnpm why effect. In monorepo environments or applications using @effect/rpc and @effect/platform, ensure that all workspace packages resolve to the single patched effect@3.22.1 installation.
For environments where an immediate dependency upgrade cannot be deployed, two code-level workarounds can neutralize the polynomial backtracking risk:
Schema.maxLength) before or around the template literal evaluation, or enforce tight payload size constraints at the API gateway. Bounding $N$ to a small value (e.g., 128 characters) caps the maximum number of backtracking permutations.TemplateLiteral with Restricted Schema.pattern: Instead of using Schema.TemplateLiteral with Schema.String, define an explicit regular expression via Schema.String.pipe(Schema.pattern(...)) using negated character classes that exclude the delimiter. For example, replace ^([\s\S]*?)\.([\s\S]*?)\.([\s\S]*?)\.json$ with ^([^.]+)\.([^.]+)\.([^.]+)\.json$, which guarantees zero ambiguity between span characters and delimiters.CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
effect Effect-TS | < 3.22.1 | 3.22.1 |
| Attribute | Detail |
|---|---|
| CVE / GHSA ID | CVE-2026-121707 / GHSA-7589-6fvf-x4pw |
| Weakness Class | CWE-1333: Inefficient Regular Expression Complexity (ReDoS) |
| CVSS v4.0 Score | 8.7 HIGH (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N) |
| EPSS Score | 0.301% (23.30th Percentile) |
| Affected Package | effect < 3.22.1 (npm) |
| Patched Version | effect >= 3.22.1 |
| Primary Impact | Single-Threaded JavaScript Event Loop Starvation / Denial of Service |
| CISA KEV Status | Not Listed |
The software uses a regular expression that can be made to run in polynomial or exponential time when evaluated against specific crafted inputs, leading to resource exhaustion or denial of service.
CVE-2026-75518 is an incorrect authorization and privilege assignment vulnerability in the DOMShell Model Context Protocol (MCP) server (@apireno/domshell) prior to version 2.0.8. The server classified the domshell_eval tool and the eval command as read-tier operations, permitting their execution without the --allow-write flag. Because the eval command dispatches through the same Chrome DevTools Protocol (CDP) Runtime.evaluate pipeline as the write-tier js command without enabling the throwOnSideEffect constraint, callers restricted to read-only sessions can execute state-mutating JavaScript in the browser context while host user interfaces and audit logs record the activity as read-only.
CVE-2026-63411 (GHSA-xwcw-j52r-34x4) is a remote code execution vulnerability in the Jane PHP code generation framework (janephp/janephp), specifically affecting the jane-php/open-api-3 component prior to version 7.12.0. The generator constructs PHP docblocks using unsanitized parameter names and descriptions extracted directly from OpenAPI specifications. By embedding the comment closing sequence (*/) followed by valid PHP syntax inside an OpenAPI description or parameter name, an attacker can break out of the PHPDoc context and inject executable code directly into the generated class body. When the consuming application instantiates the generated client or endpoint class, an injected __construct() method executes arbitrary PHP code under the privileges of the host runtime.
CVE-2026-63413 is a code injection vulnerability in the Jane PHP OpenAPI 3 SDK generator (jane-php/open-api-3) prior to version 7.12.0. The vulnerability occurs because the generator interpolates OpenAPI header and query parameter names directly into generated PHPDoc comment blocks without sanitizing comment closing delimiters (*/). An attacker who supplies or modifies an OpenAPI specification can break out of the docblock context and inject arbitrary PHP methods, such as a class constructor, into the generated Client or Endpoint class body. When the consuming application instantiates the generated SDK, the injected code executes with the privileges of the host PHP process.
CVE-2026-63412 is a code injection vulnerability in the Jane PHP library suite (affecting jane-php/open-api-3, jane-php/open-api-2, jane-php/open-api-31, and jane-php/json-schema) prior to version 7.12.0. The flaw occurs during the automated generation of PHP client SDKs and data models from OpenAPI specifications. While Jane uses an Abstract Syntax Tree (AST) for safe generation of standard PHP tokens, it constructs PHPDoc comments via raw string interpolation without neutralizing multi-line comment closing delimiters (*/). An attacker who provides or modifies an OpenAPI specification can inject a closing comment sequence inside a query parameter name, escaping the docblock context and writing arbitrary PHP code directly into the class body of generated endpoints or clients. When the consuming application instantiates the generated class, injected methods such as __construct() execute automatically, resulting in remote code execution.
CVE-2026-58214 is an incorrect authorization vulnerability (CWE-863) in the MQTT bridge implementation of NATS Server. The vulnerability results from an incomplete fix for CVE-2026-33217 within the subscription processing routine in server/mqtt.go. Because internal delivery subscriptions bypass standard account-level allow-list validation in canSubscribe, the MQTT session manager relies on explicit prefix filtering in processSubs to prevent clients from subscribing to internal broker subjects. Affected versions fail to validate incoming MQTT subscription filters against the internal QoS 2 PubRel delivery prefix ($MQTT.deliver.pubrel.), allowing authenticated MQTT clients to subscribe to internal operational subjects and monitor QoS 2 protocol metadata across all sessions within the same NATS account.
CVE-2026-69155 (GHSA-x277-3wcg-g9r2) is a stored cross-site scripting (XSS) vulnerability in Atomic Server versions 0.30.0 prior to 0.40.3. The vulnerability resides in the HTTP file-download handler (server/src/handlers/download.rs), which serves user-uploaded files with an inline Content-Disposition and attacker-controlled MIME types such as text/html or image/svg+xml. Because the endpoint lacks X-Content-Type-Options: nosniff and Content-Security-Policy restrictions, an authenticated user with upload privileges can store malicious JavaScript that executes within a victim's browser in the primary application origin. Executing code in this context grants access to non-HttpOnly session cookies and unencrypted Ed25519 cryptographic private keys stored in IndexedDB, leading to full account takeover.