CVE-2026-34231

MEDIUM
2026-03-30 https://github.com/mixxorz/slippers GHSA-w7rv-gfp4-j9j3
6.1
CVSS 3.1
Share

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

3
Analysis Generated
Mar 30, 2026 - 17:36 vuln.today
Patch Released
Mar 30, 2026 - 17:36 nvd
Patch available
CVE Published
Mar 30, 2026 - 17:20 nvd
MEDIUM 6.1

Description

## 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 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. ## Remediation Replace the f-string in `attr_string()` with `format_html()`, which escapes both key and value: ```python from django.utils.html import format_html def attr_string(key: str, value: Any): if isinstance(value, bool): return key if value else "" key = key.replace("_", "-") return format_html('{}="{}"', key, value) ``` Until a patch is available, sanitise untrusted values before passing them to `{% attrs %}`, for example with `django.utils.html.escape()` in the view layer.

Analysis

Cross-site scripting (XSS) in the slippers Django package's {% attrs %} template tag allows unauthenticated remote attackers to inject arbitrary HTML and JavaScript by passing untrusted context variables containing quote characters and event handler attributes. The vulnerability affects templates that pass user-supplied or database-derived values to {% attrs %} without prior escaping. …

Sign in for full analysis, threat intelligence, and remediation guidance.

Priority Score

31
Low Medium High Critical
KEV: 0
EPSS: +0.0
CVSS: +30
POC: 0

Share

CVE-2026-34231 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy