# SvelteKit XSS via cache-control header in prerendered pages

Source: https://junglewise.ai/threats/duplicate-advisory-sveltekit-before-3-0-0-xss-via-cache-control-header-5731f4e1  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-10-21. Updated: 2026-10-23  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 4.7 · Published 2026-10-21

SvelteKit is a framework for building web applications. When prerendering pages, SvelteKit inserts cache-control header values without escaping them into meta tags. An attacker who can control this header value during the build process can inject malicious HTML or JavaScript that executes in users' browsers.

Technologies: [@sveltejs/kit (npm)](https://junglewise.ai/threats/technologies/sveltejs-kit). Vendors: [npm](https://junglewise.ai/threats/vendors/npm), [Svelte](https://junglewise.ai/threats/vendors/svelte).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 4.7, published 21 October 2026.

**Which products and versions are affected?** @sveltejs/kit (npm) < 3.0.0, SEMVER:introduced=0; Svelte @Sveltejs/Kit < 3.0.0.

**Is there a fix for This vulnerability?** Yes: fixed in @sveltejs/kit 3.0.0. Until then: Avoid forwarding untrusted cache-control header values with setHeaders on prerendered pages; use a fixed, trusted cache policy instead. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network.

**Am I affected?** Check whether you run @sveltejs/kit (npm) or Svelte @Sveltejs/Kit at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- Fixed in @sveltejs/kit 3.0.0

Avoid forwarding untrusted cache-control header values with setHeaders on prerendered pages; use a fixed, trusted cache policy instead.

## Technical details

SvelteKit before 3.0.0 fails to escape cache-control header values when inserting them into &lt;meta http-equiv="cache-control"&gt; tags in prerendered pages. An attacker with the ability to influence the header value at prerender time (e.g., via setHeaders with untrusted input) can break out of the content attribute and inject arbitrary HTML/JavaScript. The vulnerability requires the application to use setHeaders with untrusted cache-control values on prerendered pages.

## Affected products

- Svelte @sveltejs/kit < 3.0.0

## Timeline

- 2026-10-05: disclosed
- 2026-10-05: patched: Fixed in version 3.0.0

## References

- [https://github.com/sveltejs/kit/security/advisories/GHSA-27mw-82g8-phjj](https://github.com/sveltejs/kit/security/advisories/GHSA-27mw-82g8-phjj)

## Related threats

- [SvelteKit open redirect in enhanced form actions](https://junglewise.ai/threats/duplicate-advisory-sveltekit-before-3-0-0-open-redirect-via-enhanced-9a8dcd94)
- [SvelteKit cross-site scripting in prerendered pages](https://junglewise.ai/threats/cve-2026-114061-sveltekit-sveltejs-kit-before-3-0-0-contains-a-cross-site)
- [SvelteKit open redirect in enhanced form actions](https://junglewise.ai/threats/cve-2026-114060-sveltekit-sveltejs-kit-before-3-0-0-contains-an-open-redirect)
- [SvelteKit CPU exhaustion in remote form deserialization](https://junglewise.ai/threats/cve-2026-82261-sveltekit-cpu-exhaustion-in-remote-form-deserialization)
- [SvelteKit memory exhaustion in remote form deserialization](https://junglewise.ai/threats/cve-2026-82260-sveltekit-memory-exhaustion-in-remote-form-deserialization)
