{"id":"CVE-2026-34231","aliases":["CVE-2026-34231","GHSA-w7rv-gfp4-j9j3","PYSEC-2026-2279"],"related":[],"kind":"vulnerability","state":"published","title":"Slippers: Cross-Site Scripting (XSS) in `attrs` Template Tag","summary":"Slippers is a UI component framework for Django. Prior to version 0.6.3, a Cross-Site Scripting (XSS) vulnerability exists in the {% attrs %} template tag of the slippers Django package. When a context variable containing untrusted data is passed to {% attrs %}, the value is interpolated into an HTML attribute string without escaping, allowing an attacker to break out of the attribute context and inject arbitrary HTML or JavaScript into the rendered page. This issue has been patched in version 0.6.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Slippers is a UI component framework for Django. Prior to version 0.6.3, a Cross-Site Scripting (XSS) vulnerability exists in the {% attrs %} template tag of the slippers Django package. When a context variable containing untrusted data is passed to {% attrs %}, the value is interpolated into an HTML attribute string without escaping, allowing an attacker to break out of the attribute context and inject arbitrary HTML or JavaScript into the rendered page. This issue has been patched in version 0.6.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nA Cross-site Scripting (XSS) vulnerability exists in the `{% attrs %}` template tag of the `slippers` Django package. When a context variable containing untrusted data is passed to `{% attrs %}`, the value is interpolated into an HTML attribute string without escaping, allowing an attacker to break out of the attribute context and inject arbitrary HTML or JavaScript into the rendered page.\n\n## Vulnerability details\n\n### Root cause\n\n`AttrsNode` is a custom `Node` subclass registered via `register.tag()`. Unlike `register.simple_tag()`, which automatically applies `conditional_escape()` when autoescape is on, custom `Node.render()` methods receive no automatic escaping and are fully responsible for sanitising their output. `attr_string()` fails to do this:\n\n```python\ndef attr_string(key: str, value: Any):\n    if isinstance(value, bool):\n        return key if value else \"\"\n    key = key.replace(\"_\", \"-\")\n    return f'{key}=\"{value}\"'   # value is not escaped\n```\n\n### Attack scenario\n\nGiven a template that uses `{% attrs %}` with a user-supplied value:\n\n```django\n{% load slippers %}\n<input {% attrs type placeholder %}>\n```\n\n```python\nrender(request, \"search.html\", {\"placeholder\": request.GET.get(\"q\", \"\")})\n```\n\nAn attacker crafting a request with `q=\" onmouseover=\"alert(document.cookie)\" x=\"` produces:\n\n```html\n<input type=\"text\" placeholder=\"\" onmouseover=\"alert(document.cookie)\" x=\"\">\n```\n\n## Impact\n\nAny template that passes values derived from user input, database content, or other untrusted sources to `{% attrs %}` is vulnerable. Successful exploitation can lead to session hijacking, credential theft, arbitrary actions on behalf of the victim, and page defacement.\n\n## Remediation\n\nReplace the f-string in `attr_string()` with `format_html()`, which escapes both key and value:\n\n```python\nfrom django.utils.html import format_html\n\ndef attr_string(key: str, value: Any):\n    if isinstance(value, bool):\n        return key if value else \"\"\n    key = key.replace(\"_\", \"-\")\n    return format_html('{}=\"{}\"', key, value)\n```\n\nUntil a patch is available, sanitise untrusted values before passing them to `{% attrs %}`, for example with `django.utils.html.escape()` in the view layer.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Slippers es un framework de componentes de UI para Django. Antes de la versión 0.6.3, existe una vulnerabilidad de cross-site scripting (XSS) en la etiqueta de plantilla {% attrs %} del paquete Django slippers. Cuando una variable de contexto que contiene datos no confiables se pasa a {% attrs %}, el valor se interpola en una cadena de atributo HTML sin escape, permitiendo a un atacante salir del contexto del atributo e inyectar HTML o JavaScript arbitrario en la página renderizada. Este problema ha sido parcheado en la versión 0.6.3.","source":"nvd"}],"published":"2026-03-30T17:20:04.000Z","modified":"2026-07-24T20:10:00.147Z","severity":{"scorer":"GitHub_M","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"},"severities":[{"scorer":"GitHub_M","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":"GitHub","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":"PyPA Advisory Database","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"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 0.6.3","status":"affected"}],"vendor":"mixxorz","product":"slippers","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.6.3"}],"ecosystem":"PyPI","package":"slippers","purl":"pkg:pypi/slippers","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"0.6.2"}],"vendor":"django","product":"slippers","cpe":"cpe:2.3:a:django:slippers:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.6.3"}],"ecosystem":"PyPI","package":"slippers","purl":"pkg:pypi/slippers","source":"pysec"}],"references":[{"url":"https://github.com/mixxorz/slippers/security/advisories/GHSA-w7rv-gfp4-j9j3","tags":["evidence","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/mixxorz/slippers/commit/16cc4ef4fa8ad2f7aee30798f16c3e7b653423b2","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/mixxorz/slippers/releases/tag/0.6.3","tags":["advisory","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34231","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/mixxorz/slippers","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-03-31T17:21:42.383Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-34231","url":"https://www.cve.org/CVERecord?id=CVE-2026-34231","licence":"CVE Terms of Use","modified":"2026-03-31T17:21:50.192Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-w7rv-gfp4-j9j3","url":"https://github.com/advisories/GHSA-w7rv-gfp4-j9j3","licence":"CC-BY-4.0","modified":"2026-07-13T07:26:50.491Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-34231","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-34231","licence":"Public domain","modified":"2026-07-24T20:10:00.147Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2279","url":"https://osv.dev/vulnerability/PYSEC-2026-2279","licence":"CC-BY-4.0","modified":"2026-07-13T07:15:42.377Z"}],"updatedAt":"2026-11-25T22:59:17.597Z","epss":{"score":0.00272,"percentile":0.20942,"date":"2026-12-01T12:00:22.000Z"}}