CVE-2021-37634: LeafKit allows XSS with untrusted user input
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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Leaf (LeafKit)to a version that resolves this vulnerability.Fixed in 1.3.0 - Configuration
Enable a Content Security Policy (CSP) configured to block inline script and inline CSS data to mitigate injected XSS payloads.
Content Security Policy (CSP) CSP to block inline script and CSS data = Enable CSP that blocks inline script and inline CSS (and CSS data if using `data:`) - Configuration
Sanitize any untrusted input prior to rendering it in Leaf tags/variable tags, since Leaf previously did not escape strings passed to tags as variables (versions prior to 1.3.0 were susceptible to XSS).
Leaf (LeafKit) templates Untrusted input sanitization before variable tags = Sanitize any untrusted input before passing it to Leaf variable tags
Event History
Frequently Asked Questions
What is CVE-2021-37634?
CVE-2021-37634 is a vulnerability in Leafkit, a templating language with Swift-inspired syntax, that allows for Cross-site Scripting (XSS) attacks.
What is the severity of CVE-2021-37634?
The severity of CVE-2021-37634 is high, with a CVSS score of 6.1.
How does CVE-2021-37634 affect Leafkit?
CVE-2021-37634 affects Leafkit versions prior to 1.3.0, allowing for XSS attacks when unsanitized data is passed to Leaf's variable tags.
How can I fix CVE-2021-37634 in Leafkit?
To fix CVE-2021-37634 in Leafkit, you should upgrade to version 1.3.0 or higher.
What is the Common Weakness Enumeration (CWE) ID for CVE-2021-37634?
The CWE ID for CVE-2021-37634 is CWE-79.