CVE-2021-37634 json
LeafKit allows XSS with untrusted user input
published 2021-08-09 5 y ago modified 2026-07-08 4 mo ago also EUVD-2023-1881 , GHSA-rv3x-xq3r-8j9h
- cvss
- 7.4
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.7%
- EPSS 0.7% chance of exploitation in 30 days, percentile 53%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- swift github.com/vapor/leaf-kit 1.3.0
- vapor leafkit 1.3.0
Exploit prediction
0.71% chance of exploitation in the next 30 days, higher than 53% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N |
| NVD | 3.1 | 6.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| NVD | 2.0 | 4.3 | AV:N/AC:M/Au:N/C:N/I:P/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| swift | github.com/vapor/leaf-kit | <1.3.0 |
1.3.0 |
Affected products
- vapor leaf-kit
Classification
References
-
github.com
/vapor/leaf-kit-ghsa-rv3x-xq3r-8j9h/pull/1
broken-link
-
github.com
/vapor/leaf-kit/security/advisories/GHSA-rv3x-xq3r-8j9h
web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-37634
advisory
-
github.com
/vapor/leaf-kit
package
-
github.com
/vapor/leaf-kit/releases/tag/1.3.0
web
Sources
- CVE List CVE-2021-37634
- GitHub Advisory GHSA-rv3x-xq3r-8j9h
- NVD CVE-2021-37634
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.