@angular/router
Affected
- introduced
22.0.0, fixed22.2.1(semver)
Fixed versions
22.2.1
Fix
- Fixed version
22.2.1npm install @angular/[email protected]
Advisory
Also known as: CVE-2026-111751
@angular/router: Denial of Service via RouterLink Query Parameter Retention in Server-Side Rendering (SSR)
A denial of service (DoS) vulnerability was identified in @angular/router when Server-Side Rendering (SSR) is enabled on Node.js (V8) and RouterLink directives are rendered with queryParamsHandling: 'merge' or 'preserve', configured either per link or globally via defaultQueryParamsHandling.
Starting in v21.2.0 (angular/angular#66181), RouterLink internals were refactored to use signals, introducing a computed signal (_urlTree) that cached the returned UrlTree instance on the directive. Because each rendered link maintains an active RouterLink instance for the entire duration of the request lifecycle, the computed signal permanently pinned the UrlTree and its associated query parameter dictionary in the heap until the SSR response completed.
When query parameter handling is set to 'merge' or 'preserve', each link copies the incoming request's query parameters into its own UrlTree. During SSR, memory consumption scales multiplicatively:
$$\text{Heap Retention} \approx (\text{Number of affected links}) \times (\text{Size of parsed query parameter map})$$
Because parsed JavaScript objects and property dictionaries require substantially more heap space than the raw query string—particularly when property names trigger dense array allocations under V8 property-storage heuristics—an attacker can supply oversized query strings to amplify heap consumption by orders of magnitude per in-flight request.
Impact
Successful exploitation allows an unauthenticated remote attacker to exhaust the Node.js old-space heap with modest concurrent request volume, terminating the SSR worker with an unrecoverable JavaScript heap out of memory fatal crash.
Attack Preconditions & Vulnerable Configurations
An application is affected only if all of the following conditions are met:
RouterLink elements rendered during SSR use queryParamsHandling: 'merge' or 'preserve', either bound explicitly on links or configured application-wide via withRouterConfig({ defaultQueryParamsHandling: 'merge' }).large_client_header_buffers limit rejects 16 KB request lines unless explicitly increased).Exploit Payload Example
An attacker issues concurrent HTTP requests containing dense query parameters to an SSR page that renders multiple merged links:
GET /products?0&17&34&51&68&85&...&48042 HTTP/1.1
Host: example.com
Patches
The issue is resolved by removing persistent UrlTree retention from RouterLink (angular/angular#70953). RouterLink now tracks route dependencies directly in reactiveHref and discards intermediate UrlTree instances immediately after computing the serialized href string. The urlTree getter and click handlers compute UrlTree instances on demand.
As a result, intermediate query parameter maps are short-lived allocations collected during young-generation GC scavenges rather than remaining pinned in the heap for the lifetime of the request, restoring the memory profile of Angular 21.1 and earlier.
Patched versions:
22.2.121.2.25Versions prior to 21.2.0 (including Angular 20.x LTS and 21.1.x) do not retain UrlTree instances in RouterLink and are not vulnerable to this issue.
Workarounds & Mitigations
If you cannot immediately upgrade to a patched version, apply one or more of the following mitigations:
defaultQueryParamsHandling: 'merge' (or 'preserve') from global configuration. Explicitly bind only the specific query parameters each link requires (e.g., [queryParams]="{ filter: filter() }"). Even on patched versions, this practice prevents unnecessary request-derived parameter propagation into generated DOM markup.Alternatively, reject oversized query strings in Node.js before Angular SSR handles the request:
// server.ts (before Angular SSR handler)
app.use((req, res, next) => {
const queryIndex = req.url.indexOf('?');
if (queryIndex !== -1 && req.url.length - queryIndex > 2048) {
res.status(414).send('URI Too Long');
return;
}
next();
});
--max-old-space-size (e.g., to 2048 MB or 4096 MB) increases the memory headroom and the concurrency threshold required to exhaust memory, though it does not fully eliminate vulnerability under sustained traffic.High Basis: The source's own band: HIGH
22.0.0, fixed 22.2.1 (semver)22.2.1
22.2.1npm install @angular/[email protected]21.2.0, fixed 21.2.25 (semver)21.2.25
21.2.25npm install @angular/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0