CVE-2022-22818 is a medium-severity (CVSS 6.1) Cross-site Scripting (XSS) vulnerability in django. 3 public exploit references exist, so weaponization risk is real. A fix is available for django — see the affected versions and patch details below.
Cross-site Scripting in Django
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2022-22818 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 388,997 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
django🐍django🐍djangoReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | django | ≥ 2.2&&< 2.2.27 | 2.2.27pip install --upgrade 'django==2.2.27' |
| 🐍PyPI | django | ≥ 3.2&&< 3.2.12 | 3.2.12pip install --upgrade 'django==3.2.12' |
| 🐍PyPI | django | ≥ 4.0&&< 4.0.2 | 4.0.2pip install --upgrade 'django==4.0.2' |
Affected Products
debian linuxdebiandjangodjangoprojectfedorafedoraprojectResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for django, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update django to 2.2.27 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-22818 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenStack Platform 16.1 | python-django20-0:2.0.13-18.el8ost | RHSA-2022:8872 |
| Red Hat OpenStack Platform 16.2 | python-django20-0:2.0.13-18.el8ost | RHSA-2022:8853 |
| Red Hat Satellite 6.11 for RHEL 8 | python-django-0:3.2.13-1.el8pc | RHSA-2022:5498 |
| Red Hat Satellite 6.12 for RHEL 8 | python-django-0:3.2.14-2.el8pc | RHSA-2022:8506 |
Frequently Asked Questions
Is CVE-2022-22818 in your dependencies?
Find it across PyPI, including transitive dependencies.