CVE-2021-37634: Github.com/vapor/leaf kit Cross-Site Scripting Vulnerability
MODERATECVE-2021-37634 is a MODERATE cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting Github.com/vapor/leaf kit libraries in the SwiftURL ecosystem. The issue involves leafkit allows xss with untrusted user input. Remediation is available by upgrading affected packages to version 1.3.0.
CVE-2021-37634 at a Glance
How to Fix CVE-2021-37634
To remediate this vulnerability, upgrade all affected Github.com/vapor/leaf kit dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/vapor/leaf-kit to 1.3.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/vapor/leaf-kit
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-37634, inspect your project dependencies for Github.com/vapor/leaf kit:
inspect dependencies for github.com/vapor/leaf-kit
Analyze the terminal output to locate any version of Github.com/vapor/leaf kit in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In Github.com/vapor/leaf kit, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-37634 Affected Github.com/vapor/leaf kit Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/vapor/leaf-kit
|
SwiftURL |
< 1.3.0
|
1.3.0
|
References
Frequently Asked Questions
What is CVE-2021-37634?
Which Github.com/vapor/leaf kit versions are affected?
What version fixes CVE-2021-37634?
Is github.com/vapor/leaf-kit affected?
What CWE is associated with CVE-2021-37634?
How can I check SwiftURL dependencies for CVE-2021-37634?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rv3x-xq3r-8j9h",
"modified" : "2023-06-09T19:32:32Z",
"published" : "2023-06-09T19:32:32Z",
"aliases" : [ "CVE-2021-37634" ],
"summary" : "LeafKit allows XSS with untrusted user input",
"details" : "### Impact\nThis 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.\n\n### Patches\nThis has been patched in 1.3.0\n\n### Workarounds\nSanitise any untrusted input before passing it to Leaf and enable a CSP to block inline script and CSS data.\n\n### References\nhttps://github.com/vapor/leaf-kit-ghsa-rv3x-xq3r-8j9h/pull/1\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Leaf Kit](https://github.com/vapor/leaf-kit)\n* Email us at [security@vapor.codes](mailto:security@vapor.codes)",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "SwiftURL",
"name" : "github.com/vapor/leaf-kit"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.3.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vapor/leaf-kit/security/advisories/GHSA-rv3x-xq3r-8j9h"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-37634"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vapor/leaf-kit"
}, {
"type" : "WEB",
"url" : "https://github.com/vapor/leaf-kit/releases/tag/1.3.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79", "CWE-80" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-06-09T19:32:32Z",
"nvd_published_at" : "2021-08-09T20:15:00Z"
}
}