CVE-2022-22818: XSS

Published Jan 31, 2022
·
Updated

A flaw was found in Django. The {% debug %} template tag did not properly encode the current context, posing a Cross-site scripting attack vector (XSS).

Other sources

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.

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.

— GitHub

The {% debug %} template tag didn't properly encode the current context, posing an XSS attack vector. In order to avoid this vulnerability, {% debug %} no longer outputs an information when the DEBUG setting is False, and it ensures all context variables are correctly escaped when the DEBUG setting is True.

— Red Hat

Affected Software

32 affected componentsFixes available
redhat/python-django20<0:2.0.13-18.el8
0:2.0.13-18.el8
redhat/python-django<0:3.2.13-1.el8
0:3.2.13-1.el8
redhat/python-django<0:3.2.14-2.el8
0:3.2.14-2.el8
debian/2:2.2.25-1~deb11u1<=undefined
debian/2:3.2.11-2<=undefined
debian/python-django<=1:1.11.29-1~deb10u1
2:3.2.12-12:4.0.2-12:2.2.28-1~deb11u1
debian/2:3.2.10-2<=undefined
debian/1:1.10.7-2+deb9u14<=undefined
redhat/django<4.0.2
4.0.2
redhat/django<3.2.12
3.2.12
redhat/django<2.2.27
2.2.27
pip/django>=4.0<4.0.2
4.0.2
pip/django>=3.2<3.2.12
3.2.12
pip/django>=2.2<2.2.27
2.2.27
djangoproject Django>=2.2<2.2.27
djangoproject Django>=3.2<3.2.12
djangoproject Django>=4.0<4.0.2
Fedoraproject Fedora=35
Debian Debian Linux=11.0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
alpine/py3-django<3.2.12-r0
3.2.12-r0
debian/python-django<2:3.2.12-1
2:3.2.12-1
debian/python-django<2:3.2.12-1
2:3.2.12-1
debian/python-django<2:3.2.12-1
2:3.2.12-1
debian/python-django
3:3.2.25-0+deb12u33:3.2.25-0+deb12u63:4.2.28-0+deb13u23:4.2.28-0+deb13u13:5.2.17-23:5.2.19-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/python-django20 to a version that resolves this vulnerability.

    Fixed in 0:2.0.13-18.el8
  2. Upgrade

    Upgrade redhat/python-django to a version that resolves this vulnerability.

    Fixed in 0:3.2.13-1.el8
  3. Upgrade

    Upgrade redhat/python-django to a version that resolves this vulnerability.

    Fixed in 0:3.2.14-2.el8
  4. Upgrade

    Upgrade debian/python-django to a version that resolves this vulnerability.

    Fixed in 2:3.2.12-1Fixed in 2:4.0.2-1Fixed in 2:2.2.28-1~deb11u1
  5. Upgrade

    Upgrade redhat/django to a version that resolves this vulnerability.

    Fixed in 4.0.2
  6. Upgrade

    Upgrade redhat/django to a version that resolves this vulnerability.

    Fixed in 3.2.12
  7. Upgrade

    Upgrade redhat/django to a version that resolves this vulnerability.

    Fixed in 2.2.27
  8. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 4.0.2
  9. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 3.2.12
  10. Upgrade

    Upgrade pip/django to a version that resolves this vulnerability.

    Fixed in 2.2.27
  11. Upgrade

    Upgrade alpine/py3-django to a version that resolves this vulnerability.

    Fixed in 3.2.12-r0
  12. Upgrade

    Upgrade debian/python-django to a version that resolves this vulnerability.

    Fixed in 2:3.2.12-1
  13. Upgrade

    Upgrade debian/python-django to a version that resolves this vulnerability.

    Fixed in 3:3.2.25-0+deb12u3Fixed in 3:3.2.25-0+deb12u6Fixed in 3:4.2.28-0+deb13u2Fixed in 3:4.2.28-0+deb13u1Fixed in 3:5.2.17-2Fixed in 3:5.2.19-1

Event History

Feb 1, 2022
CVE Published
08:00 AM
Feb 3, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·02:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·02:15 AM
DescriptionSeverityAffected Software
Feb 4, 2022
Advisory Published
via GitHub·12:00 AM
Dec 10, 2022
Exploit Published
via GitHub·12:38 PM

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the vulnerability ID?

The vulnerability ID is CVE-2022-22818.

2

What is the severity level of CVE-2022-22818?

The severity level of CVE-2022-22818 is medium with a CVSS score of 6.1.

3

What is the affected software?

The affected software includes Django versions 2.2 before 2.2.27, 3.2 before 3.2.12, and 4.0 before 4.0.2.

4

How does the vulnerability impact the affected software?

The vulnerability in Django may lead to XSS (Cross-Site Scripting) attacks.

5

How do I fix CVE-2022-22818?

You can fix CVE-2022-22818 by upgrading Django to versions 2.2.27, 3.2.12, or 4.0.2 depending on your current version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203