# GHSA-h5jc-78hr-3pc9: Sveltia CMS: Stored XSS in Markdown/RichText preview via unsandboxed same-origin iframe

> Stored XSS in Sveltia CMS allows attackers with content access to execute scripts in the CMS context via unsandboxed iframes in Markdown previews.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 19 Jun 2026

## What is GHSA-h5jc-78hr-3pc9?

GHSA-h5jc-78hr-3pc9 is a cross-site scripting vulnerability in @sveltia/cms, published on 19 Jun 2026. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

### Impact

A stored cross-site scripting (XSS) vulnerability affected the Markdown/RichText field preview renderer in Sveltia CMS.

The DOMPurify sanitization configuration used for Markdown previews explicitly permitted `iframe` elements without enforcing a `sandbox` attribute or restricting iframe sources. Sanitized Markdown output was then inserted into the CMS preview DOM as raw HTML. Because no sandboxing or source validation was applied, a Markdown field containing an `iframe` whose src pointed to a same-origin uploaded or publicly accessible HTML asset would render an unsandboxed iframe. JavaScript in the framed document could then access the parent CMS window via the browser’s same-origin policy, allowing it to read and write the parent window’s state, DOM, and browser storage, and to trigger actions in the CMS context.

The practical impact is limited in currently supported Sveltia CMS usage because the CMS is intended for a single developer or a small trusted team, and [open authoring](https://sveltiacms.app/en/docs/workflows/open) / untrusted multi-user authoring is not currently implemented. Exploitation requires the ability to place malicious content into the repository or content source that the CMS loads.

### Patches

The issue has been patched by replacing the direct DOMPurify call in the Markdown preview renderer with a two-pass sanitization pipeline:

1. DOMPurify processes the raw HTML as before.
2. A post-processing step validates every `iframe` element in the sanitized output. Any iframe whose src does not use an `https://` URL, uses a same-origin URL, uses a relative path, or uses any other non-HTTPS scheme (`javascript:`, `data:`, `blob:`, , etc.) is removed from the output. Surviving iframes (HTTPS cross-origin only) have a `sandbox` attribute enforced with at minimum `allow-scripts allow-same-origin`, which confines the framed document to its own origin and prevents it from accessing the parent CMS window.

Users should upgrade to Sveltia CMS [v0.167.3](https://github.com/sveltia/sveltia-cms/releases/tag/v0.167.3) or later.

### Workarounds

If upgrading is not immediately possible, avoid loading CMS content from untrusted authors and review Markdown field content for `iframe` elements pointing to same-origin or relative paths.

Administrators can also reduce exposure by limiting repository or content source write access to trusted users only.

### References

- [sveltia/sveltia-cms@`8c46294`](https://github.com/sveltia/sveltia-cms/commit/8c46294eadf52a8ac48740ccb5054b99d65cff1b)
- https://github.com/sveltia/sveltia-cms/releases/tag/v0.167.3

## Which versions are affected by GHSA-h5jc-78hr-3pc9?

2 open source packages ship an affected version, including @sveltia/cms.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@sveltia/cms` | npm | All versions | 0.167.3 |
| `@sveltia/cms` | npm | All versions | 0.167.3 |

## How do I fix GHSA-h5jc-78hr-3pc9?

Upgrade @sveltia/cms to 0.167.3 or later.

## Is GHSA-h5jc-78hr-3pc9 being exploited?

There is no known exploitation of GHSA-h5jc-78hr-3pc9 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h5jc-78hr-3pc9 and fix it if it is affected.

What it is: GHSA-h5jc-78hr-3pc9 is a cross-site scripting vulnerability in @sveltia/cms, published on 19 Jun 2026. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-h5jc-78hr-3pc9 in the wild and no public exploit code.

Affected packages and fixed versions:
- @sveltia/cms (npm): affected all versions; fixed in 0.167.3
- @sveltia/cms (npm): affected all versions; fixed in 0.167.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-h5jc-78hr-3pc9/ (Markdown: https://insights.sbomify.com/GHSA-h5jc-78hr-3pc9/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h5jc-78hr-3pc9

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h5jc-78hr-3pc9/
Summaries are generated and may contain mistakes; the official description above is the record.
