Slippers Vulnerable to Cross-Site Scripting (XSS) in `attrs` Template Tag
Date: 2026-03
Affected: pip/slippers
Attack vector: xss
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2026-34231
CWE: CWE-79
CVSS: 6.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

## Summary 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. ## Vulnerability details ### Root cause `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: ```python def attr_string(key: str, value: Any): if isinstance(value, bool): return key if value else "" key = key.replace("_", "-") return f'{key}="{value}"' # value is not escaped ``` ### Attack scenario Given a template that uses `{% attrs %}` with a user-supplied value: ```django {% load slippers %} <input {% attrs type placeholder %}> ``` ```python render(request, "search.html", {"placeholder": request.GET.get("q", "")}) ``` An attacker crafting a request with `q=" onmouseover="alert(document.cookie)" x="` produces: ```html <input type="text" placeholder="" onmouseover="alert(document.cookie)" x=""> ``` ## Impact Any template that passes values derived from user input, database


Mitigations:

Architectural layers (MAESTRO):