# CVE-2026-28499: LeafKit's HTML escaping may be skipped for Collection values, enabling XSS

> Attackers can inject malicious scripts via unescaped collection values in LeafKit templates, leading to cross-site scripting attacks.

- **Severity:** Medium 6.9 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Mar 2026
- **Updated:** 18 Mar 2026
- **Also known as:** GHSA-6jj5-j4j8-8473

## What is CVE-2026-28499?

CVE-2026-28499 is a medium-severity cross-site scripting vulnerability in vapor leaf-kit, published on 18 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

LeafKit is a templating language with Swift-inspired syntax. Prior to version 1.14.2, HTML escaping doesn't work correctly when a template prints a collection (Array / Dictionary) via `#(value)`. This can result in XSS, allowing potentially untrusted input to be rendered unescaped. Version 1.14.2 fixes the issue.

Weakness: CWE-80 (Improper Neutralization of Script-Related HTML Tags in a Web Page), CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-116 (Improper Encoding or Escaping of Output)

## Which versions are affected by CVE-2026-28499?

2 open source packages ship an affected version, including github.com/vapor/leaf-kit. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/vapor/leaf-kit` | SwiftURL | All versions | 1.14.2 |
| `github.com/vapor/leaf-kit` | SwiftURL | All versions | 1.14.2 |

Products: Vapor Leafkit.

## How do I fix CVE-2026-28499?

Upgrade github.com/vapor/leaf-kit to 1.14.2 or later.

## Is CVE-2026-28499 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-28499 exists.

## Other vulnerabilities in vapor leaf-kit

- [CVE-2021-37634](https://insights.sbomify.com/CVE-2021-37634/): LeafKit allows XSS with untrusted user input (high 7.4)
- [CVE-2026-27120](https://insights.sbomify.com/CVE-2026-27120/): Leaf-kit html escaping does not work on characters that are part of extended grapheme cluster (medium 6.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-28499 and fix it if it is affected.

What it is: CVE-2026-28499 is a medium-severity cross-site scripting vulnerability in vapor leaf-kit, published on 18 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-28499 exists.

Affected packages and fixed versions:
- github.com/vapor/leaf-kit (SwiftURL): affected all versions; fixed in 1.14.2
- github.com/vapor/leaf-kit (SwiftURL): affected all versions; fixed in 1.14.2

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/CVE-2026-28499/ (Markdown: https://insights.sbomify.com/CVE-2026-28499/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-28499
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-28499
- OSV: https://osv.dev/vulnerability/CVE-2026-28499

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-28499/
Summaries are generated and may contain mistakes; the official description above is the record.
