{"id":"CVE-2021-37634","aliases":["CVE-2021-37634","GHSA-rv3x-xq3r-8j9h"],"related":[],"kind":"vulnerability","state":"published","title":"LeafKit allows XSS with untrusted user input","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Leafkit es un lenguaje de plantillas con una sintaxis inspirada en Swift. Las versiones anteriores a 1.3.0, son susceptibles de sufrir ataques de tipo Cross-site Scripting (XSS). Esto afecta a cualquiera que pase datos no saneados a las etiquetas variables de Leaf. Antes de esta corrección, Leaf no escapaba las cadenas pasadas a las etiquetas como variables. Si un atacante lograba encontrar una variable que se presentara con sus datos no saneados, podía inyectar scripts en una página de Leaf generada, que podía permitir ataques de tipo XSS si no se habilitaban otras mitigaciones como una Política de Seguridad de Contenidos. Esto ha sido parcheado en versión 1.3.0. Como solución, sanear cualquier entrada no confiable antes de pasarla a Leaf y habilitar una CSP para bloquear los datos de script y CSS en línea","source":"nvd"}],"published":"2021-08-09T19:45:13.000Z","modified":"2026-07-08T06:27:42.364Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","score":7.4,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","score":7.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-79","CWE-80"],"affected":[{"ranges":[{"version":"< 1.3.0","status":"affected"}],"vendor":"vapor","product":"leaf-kit","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.3.0"}],"ecosystem":"SwiftURL","package":"github.com/vapor/leaf-kit","purl":"pkg:swift/github.com/vapor/leaf-kit","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.3.0"}],"vendor":"vapor","product":"leafkit","cpe":"cpe:2.3:a:vapor:leafkit:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/vapor/leaf-kit/security/advisories/GHSA-rv3x-xq3r-8j9h","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/vapor/leaf-kit-ghsa-rv3x-xq3r-8j9h/pull/1","tags":["broken-link","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37634","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/vapor/leaf-kit","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/vapor/leaf-kit/releases/tag/1.3.0","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-37634","url":"https://www.cve.org/CVERecord?id=CVE-2021-37634","licence":"CVE Terms of Use","modified":"2024-08-04T01:23:01.289Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rv3x-xq3r-8j9h","url":"https://github.com/advisories/GHSA-rv3x-xq3r-8j9h","licence":"CC-BY-4.0","modified":"2026-07-08T06:27:42.364Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-37634","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37634","licence":"Public domain","modified":"2026-06-17T04:00:52.403Z"}],"updatedAt":"2026-11-25T22:58:03.076Z","epss":{"score":0.0071,"percentile":0.54751,"date":"2026-12-01T12:00:22.000Z"}}