# GHSA-W34W-96HF-98HJ: Code Injection in Generated Server Manifests via Unescaped Route Paths in @angular/build

- Database: GitHub
- Severity: CVSS 7.7 (High)
- Published: 2026-10-28
- Modified: 2026-10-28

## Affected versions

- @angular/build (npm): from 22.0.0, fixed in 22.2.5
- @angular/build (npm): from 21.0.0, fixed in 21.2.29
- @angular/build (npm): from 20.0.0, fixed in 20.3.42
- @angular/build (npm): through 19.2.27

## Description

A Code Injection vulnerability exists in the server manifest generation logic (`generateAngularServerAppManifest` and `generateAngularServerAppEngineManifest`) of `@angular/build`. When prerendering (SSG) is used alongside server-side rendering (`outputMode: "server"`), route-derived asset paths and configuration values were interpolated directly into single-quoted string literals inside the generated executable ECMAScript modules (`angular-app-manifest.mjs` and `angular-app-engine-manifest.mjs`) without escaping.

The vulnerability occurs during build-time manifest generation:

1. A parameterized prerendered route (e.g., `product/:slug`) resolves its parameter values via `getPrerenderParams()`, which commonly fetches dynamic identifiers or slugs from an external API, CMS, or database.
2. The resolved route path is used to derive the prerendered output file path (`file.path`) and chunk path (`jsChunkFilePath`).
3. `generateAngularServerAppManifest` interpolates `file.path` and `jsChunkFilePath` directly into `angular-app-manifest.mjs` using template literals (`'${key}': ${value}` and `import('./${jsChunkFilePath}')`) instead of serializing them as valid JavaScript string literals.
4. If an external data source returns a parameter value containing a single quote (`'`) and crafted JavaScript syntax, it breaks out of the string literal in `angular-app-manifest.mjs`.
5. When the Node.js SSR server loads `angular-app-manifest.mjs` to handle incoming requests, the injected JavaScript code is executed in the server process.

### Impact

- **Remote Code Execution (RCE):** If `getPrerenderParams()` (or `routesFile`) incorporates untrusted or externally controlled route parameters (such as slugs from a CMS or third-party API) during the build of an application with `outputMode: "server"`, an attacker who can control a route parameter value can inject arbitrary JavaScript into `angular-app-manifest.mjs`, resulting in arbitrary code execution on the Node.js SSR server when the manifest is imported.
- **Denial of Service (DoS):** Benign route parameters containing apostrophes (e.g., `customer's-choice`) produce syntactically invalid JavaScript in `angular-app-manifest.mjs`, causing SSR requests to fail with HTTP 500.

### Attack Preconditions

- The application uses `@angular/build:application` with server output enabled (`outputMode: "server"`).
- The application prerenders parameterized routes via `getPrerenderParams()` (or `routesFile`).
- The parameter values returned during the build originate from an untrusted or externally modifiable source (such as a CMS, database, or external API) and are not sanitized or restricted before being returned from `getPrerenderParams()`.

### Affected Versions

- `>= 22.0.0, < 22.2.5`
- `>= 21.0.0, < 21.2.29`
- `>= 20.0.0, < 20.3.42`
- `<= 19.2.27`

### Patches

- `22.2.5`
- `21.2.29`
- `20.3.42`

> Versions `<= 19.2.27` have reached End of Support / LTS expiration and will not be patched.

### Workarounds

Until a patch is applied, validate or URL-encode dynamic route parameters returned by `getPrerenderParams()` so that they cannot contain single quotes (`'`), backslashes (`\`), or line terminators:

```ts
getPrerenderParams: async () => {
  const items = await fetchItemsFromApi();
  return items
    .filter((item) => /^[a-zA-Z0-9-_]+$/.test(item.slug))
    .map((item) => ({ slug: item.slug }));
}
```

## References

- https://github.com/angular/angular-cli/security/advisories/GHSA-w34w-96hf-98hj

Page: https://cve.now/GHSA-W34W-96HF-98HJ

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
