CVE-2019-12781: Django - HTTP Request Not Redirected to HTTPS

django Updated 02 Oct 2025

Summary

01/07/2019
Yes i
Moderate
5.3

CVE-2019-12781: An issue was discovered in Django 1.11 before 1.11.22, 2.1 before 2.1.10, and 2.2 before 2.2.3. Affects django across 3 version ranges.

>= 1.11, < 1.11.22 >= 2.1, < 2.1.10 >= 2.2, < 2.2.3

Fixed in 1.11.22, 2.1.10 or 2.2.3, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2019-12781 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Django is a popular Python web framework used for building web applications. It provides a set of tools and libraries to simplify the development process. The framework allows developers to create secure and scalable web applications with ease. However, Django versions 1.11 before 1.11.22, 2.1 before 2.1.10, and 2.2 before 2.2.3 are vulnerable to an issue where an HTTP request is not redirected to HTTPS when certain settings are used. This vulnerability arises when the SECURE_PROXY_SSL_HEADER and SECURE_SSL_REDIRECT settings are enabled, and the proxy connects to Django via HTTPS. The incorrect behavior of the django.http.HttpRequest.scheme method allows the HTTP request to bypass the intended redirection to HTTPS.

Vulnerability Detail

The vulnerability in Django allows an attacker to bypass the intended redirection from HTTP to HTTPS. This means that even if the SECURE_PROXY_SSL_HEADER and SECURE_SSL_REDIRECT settings are enabled, an HTTP request can still be processed without being redirected to the secure HTTPS protocol. This can lead to potential security risks, as sensitive information transmitted over HTTP may be intercepted or modified by attackers. It is important to note that this vulnerability only affects Django applications that use these specific settings and are accessed through a proxy via HTTPS.

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 1.11, < 1.11.22 1.11.22
    pip install --upgrade "django==1.11.22"
  • >= 2.1, < 2.1.10 2.1.10
    pip install --upgrade "django==2.1.10"
  • >= 2.2, < 2.2.3 2.2.3
    pip install --upgrade "django==2.2.3"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If upgrading Django is not immediately possible, a workaround can be implemented by manually checking the request scheme and redirecting to HTTPS if the scheme is not already secure. Here is an example of how this can be done in Django:

from django.http import HttpResponsePermanentRedirect

def redirect_to_https(request):
    if not request.is_secure():
        url = request.build_absolute_uri(request.get_full_path())
        secure_url = url.replace('http://', 'https://')
        return HttpResponsePermanentRedirect(secure_url)
    return None

This code snippet checks if the request is not secure (HTTP) and then builds a new URL with the 'https://' scheme. It then returns an HTTP 301 permanent redirect response to the secure URL. This workaround can be added to the Django application's views or middleware to enforce HTTPS redirection.

Conclusion

The vulnerability in Django versions 1.11 before 1.11.22, 2.1 before 2.1.10, and 2.2 before 2.2.3 allows an HTTP request to bypass the intended redirection to HTTPS when certain settings are used. This can lead to potential security risks, as sensitive information transmitted over HTTP may be intercepted or modified by attackers. It is crucial to upgrade Django to the latest secure version or implement the provided workaround to mitigate the risk of this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for django →

Share this vulnerability

FAQ

Django versions 1.11 before 1.11.22, 2.1 before 2.1.10, and 2.2 before 2.2.3 are affected by this vulnerability.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply provide your Pipfile.lock file, and Vulert will analyze it for any open-source vulnerabilities, including this one.

The vulnerability allows an attacker to bypass the intended redirection from HTTP to HTTPS, potentially exposing sensitive information transmitted over HTTP to interception or modification. This can lead to data breaches, unauthorized access, and other security incidents.

Yes, a workaround is available. By manually checking the request scheme and redirecting to HTTPS if necessary, you can enforce the redirection even if the vulnerability is present. Refer to the 'workaround' section for a code example.

To fix this vulnerability, it is recommended to upgrade Django to version 1.11.22, 2.1.10, or 2.2.3, depending on the version being used. These versions include the necessary fixes to ensure proper redirection from HTTP to HTTPS.

Related vulnerabilities

Recent vulnerabilities recorded for django.

How To Fix

Latest published version: 6.1.2 as of 22 Oct 2026

pip install --upgrade "django==6.1.2"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 1.11, < 1.11.22 1.11.22
    pip install --upgrade "django==1.11.22"
  • >= 2.1, < 2.1.10 2.1.10
    pip install --upgrade "django==2.1.10"
  • >= 2.2, < 2.2.3 2.2.3
    pip install --upgrade "django==2.2.3"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback