{"title":"Django 2.2.22 release notes","version":"dev","locale":"en","docname":"releases/2.2.22","url":"/en/dev/releases/2.2.22/","canonical":"https://djangodocs.dev/en/dev/releases/2.2.22/","summary":"Django 2.2.22 fixes a security issue in 2.2.21. On Python 3.9.5+, URLValidator didn’t prohibit newlines and tabs.","html":"<h1>Django 2.2.22 release notes<a class=\"heading-anchor\" href=\"#django-2-2-22-release-notes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><em>May 6, 2021</em></p>\n<p>Django 2.2.22 fixes a security issue in 2.2.21.</p>\n<section id=\"cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5\">\n<h2>CVE-2021-32052: Header injection possibility since <code class=\"docutils literal notranslate\">URLValidator</code> accepted newlines in input on Python 3.9.5+<a class=\"heading-anchor\" href=\"#cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>On Python 3.9.5+, <a class=\"reference internal\" href=\"/en/dev/ref/validators/#django.core.validators.URLValidator\" title=\"django.core.validators.URLValidator\"><code class=\"xref py py-class docutils literal notranslate\">URLValidator</code></a> didn’t prohibit\nnewlines and tabs. If you used values with newlines in HTTP response, you could\nsuffer from header injection attacks. Django itself wasn’t vulnerable because\n<a class=\"reference internal\" href=\"/en/dev/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a> prohibits newlines in HTTP headers.</p>\n<p>Moreover, the <code class=\"docutils literal notranslate\">URLField</code> form field which uses <code class=\"docutils literal notranslate\">URLValidator</code> silently\nremoves newlines and tabs on Python 3.9.5+, so the possibility of newlines\nentering your data only existed if you are using this validator outside of the\nform fields.</p>\n<p>This issue was introduced by the <a class=\"extlink-bpo reference external\" href=\"https://bugs.python.org/issue?&#64;action=redirect&amp;bpo=43882\">bpo-43882</a> fix.</p>\n</section>","rootId":"django-2-2-22-release-notes","toc":[{"title":"CVE-2021-32052: Header injection possibility since URLValidator accepted newlines in input on Python 3.9.5+","anchor":"cve-2021-32052-header-injection-possibility-since-urlvalidator-accepted-newlines-in-input-on-python-3-9-5","children":[]}],"breadcrumbs":[{"docname":"releases/index","title":"Release notes","url":"/en/dev/releases/"}],"prev":{"docname":"releases/2.2.23","title":"Django 2.2.23 release notes","url":"/en/dev/releases/2.2.23/"},"next":{"docname":"releases/2.2.21","title":"Django 2.2.21 release notes","url":"/en/dev/releases/2.2.21/"},"formats":{"html":"/en/dev/releases/2.2.22/","markdown":"/en/dev/releases/2.2.22.md","json":"/en/dev/releases/2.2.22.json"},"source":"https://github.com/django/django/blob/main/docs/releases/2.2.22.txt","official":"https://docs.djangoproject.com/en/dev/releases/2.2.22/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","2.2"],"inLocales":["en"]}