# CVE-2021-37634: LeafKit allows XSS with untrusted user input

- Severity: High 7.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.71%, higher than 54% of CVEs (2026-12-01)
- Published: 2021-08-09T19:45:13.000Z
- Modified: 2026-07-08T06:27:42.364Z
- Also known as: GHSA-rv3x-xq3r-8j9h
- Weaknesses: CWE-79, CWE-80
- Assigned by: GitHub_M

## Description

Leafkit is a templating language with Swift-inspired syntax. Versions prior to 1.3.0 are susceptible to Cross-site Scripting (XSS) attacks. This affects anyone passing unsanitised data to Leaf's variable tags. Before this fix, Leaf would not escape any strings passed to tags as variables. If an attacker managed to find a variable that was rendered with their unsanitised data, they could inject scripts into a generated Leaf page, which could enable XSS attacks if other mitigations such as a Content Security Policy were not enabled. This has been patched in 1.3.0. As a workaround sanitize any untrusted input before passing it to Leaf and enable a CSP to block inline script and CSS data.

(As written by CVE List.)

## Affected

- vapor leaf-kit: < 1.3.0
- github.com/vapor/leaf-kit (SwiftURL): before 1.3.0
- vapor leafkit: before 1.3.0

## Every score

- GitHub_M: CVSS:3.1 7.4 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N`
- GitHub: rating Medium
- NVD: CVSS:3.1 6.1 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`
- NVD: CVSS:2.0 4.3 Medium `AV:N/AC:M/Au:N/C:N/I:P/A:N`

## References

- <https://github.com/vapor/leaf-kit/security/advisories/GHSA-rv3x-xq3r-8j9h> (third-party-advisory, web)
- <https://github.com/vapor/leaf-kit-ghsa-rv3x-xq3r-8j9h/pull/1> (broken-link)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-37634> (advisory)
- <https://github.com/vapor/leaf-kit> (package)
- <https://github.com/vapor/leaf-kit/releases/tag/1.3.0> (web)

## Sources

- CVE List: [CVE-2021-37634](https://www.cve.org/CVERecord?id=CVE-2021-37634), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-rv3x-xq3r-8j9h](https://github.com/advisories/GHSA-rv3x-xq3r-8j9h), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-37634](https://nvd.nist.gov/vuln/detail/CVE-2021-37634), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-37634 · Whole record: https://cve.day/CVE-2021-37634.json · Rebuilt by cve.day 2026-11-25T22:58:03.076Z
