{"id":"CVE-2021-37634","aliases":["EUVD-2023-1881","GHSA-rv3x-xq3r-8j9h"],"status":"published","title":"LeafKit allows XSS with untrusted user input","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.","severity":{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.0071,"percentile":0.53861,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79","CWE-80"],"published":"2021-08-09T19:45:13Z","modified":"2026-10-20T10:54:50Z","fixes":[{"ecosystem":"SwiftURL","package":"github.com/vapor/leaf-kit","fixed_in":["1.3.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"SwiftURL","package":"github.com/vapor/leaf-kit","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.3.0"}]}]},{"source":"osv","ecosystem":"SwiftURL","package":"github.com/vapor/leaf-kit","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.3.0"}]}]}],"products":[{"vendor":"vapor","product":"leaf-kit"},{"vendor":"vapor","product":"leafkit"}],"references":[{"url":"https://github.com/vapor/leaf-kit/security/advisories/GHSA-rv3x-xq3r-8j9h","tags":["x_refsource_CONFIRM","x_transferred","Third Party Advisory","advisory","web"]},{"url":"https://github.com/vapor/leaf-kit-ghsa-rv3x-xq3r-8j9h/pull/1","tags":["x_refsource_MISC","x_transferred","Broken Link","fix"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37634","tags":["advisory"]},{"url":"https://github.com/vapor/leaf-kit/releases/tag/1.3.0","tags":["web"]},{"url":"https://github.com/advisories/GHSA-rv3x-xq3r-8j9h"},{"url":"https://github.com/vapor/leaf-kit","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-37634","title":"LeafKit allows XSS with untrusted user input","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.","status":"published","published":"2021-08-09T19:45:13Z","modified":"2024-08-04T01:23:01.289Z","cvss":[{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:32:58.359368Z"}],"euvd":[{"id":"EUVD-2023-1881","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.","status":"published","published":"2021-08-09T19:45:13Z","modified":"2024-08-04T01:23:01Z","cvss":[{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high"}],"updated_at":"2026-11-03T03:24:26.681577Z"}],"ghsa":[{"id":"GHSA-rv3x-xq3r-8j9h","title":"LeafKit allows XSS with untrusted user input","description":"### 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)","status":"published","published":"2023-06-09T19:32:32Z","modified":"2023-06-19T16:45:07Z","cwes":["CWE-79","CWE-80"],"updated_at":"2026-11-02T14:36:55.184601Z"}],"nvd":[{"id":"CVE-2021-37634","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.","status":"published","published":"2021-08-09T20:15:07.727Z","modified":"2026-06-17T04:00:52.403Z","cvss":[{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"},{"version":"2.0","score":4.3,"vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:06:56.562207Z"}],"osv":[{"id":"CVE-2021-37634","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.","status":"published","published":"2021-08-09T20:15:07.727Z","modified":"2026-10-20T10:54:50.053357717Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:44:20.434873Z"},{"id":"GHSA-rv3x-xq3r-8j9h","title":"LeafKit allows XSS with untrusted user input","description":"### 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)","status":"published","published":"2023-06-09T19:32:32Z","modified":"2026-07-08T06:27:42.364983124Z","cwes":["CWE-79","CWE-80"],"updated_at":"2026-11-02T15:46:56.281047Z"}]}}
