Vulnerabilities in pkg:pypi/django-basic-auth-ip-whitelist

PACKAGE
Advisory Identifier: GHSA-m38j-pmg3-v5x5
Advisory Summary

CVE-2020-4071 is a MODERATE (CVSS 2.2) timing attack on django-basic-auth-ip-whitelist vulnerability (CWE-208: Observable Timing Discrepancy) affecting Django basic auth ip whitelist libraries in the PyPI ecosystem. The issue involves timing attack on django-basic-auth-ip-whitelist. Remediation is available by upgrading affected packages to version 0.3.4.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/django-basic-auth-ip-whitelist

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/django-basic-auth-ip-whitelist. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-m38j-pmg3-v5x5 CVE-2020-4071 MODERATE Timing attack on django-basic-auth-ip-whitelist

CVE-2020-4071 at a Glance

CVE Identifier CVE-2020-4071
GHSA Identifier GHSA-m38j-pmg3-v5x5
Severity MODERATE
CVSS v3.1 Base Score 2.2
CWE Classification CWE-208: Observable Timing Discrepancy
Affected Product Django basic auth ip whitelist
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 2.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N).

Attack Vector Physical (AV:P)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2020-4071

To remediate this vulnerability, upgrade all affected Django basic auth ip whitelist dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

django-basic-auth-ip-whitelist fixed: 0.3.4
pip install django-basic-auth-ip-whitelist>=0.3.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show django-basic-auth-ip-whitelist

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2020-4071, inspect your installed packages using pip:

pip show django-basic-auth-ip-whitelist

Analyze the terminal output to locate any version of Django basic auth ip whitelist in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.4), your application is affected.

Note: The pip show django-basic-auth-ip-whitelist command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-208: Observable Timing Discrepancy, where two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not. In Django basic auth ip whitelist, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Potential timing attack exists on websites where the basic authentication is used or configured, i.e. `BASIC_AUTH_LOGIN` and `BASIC_AUTH_PASSWORD` is set. Currently the string comparison between configured credentials and the ones provided by users is performed through a character-by-character string comparison. This enables a possibility that attacker may time the time it takes the server to validate different usernames and password, and use this knowledge to work out the valid credentials. This attack is understood not to be realistic over the Internet. However, it may be achieved from within local networks where the website is hosted, e.g. from inside a data centre where a website's server is located. Sites protected by IP address whitelisting only are unaffected by this vulnerability. ### Patches This vulnerability has been fixed on version 0.3.4 of django-basic-auth-ip-whitelist. Update to version 0.3.4 as soon as possible and change basic authentication username and password configured on a Django project using this package. ### Workarounds Stop using basic authentication and use the IP whitelisting component only. It can be achieved by not setting `BASIC_AUTH_LOGIN` and `BASIC_AUTH_PASSWORD` in Django project settings. ### References - [Django mailing list discussion](https://groups.google.com/forum/#!msg/django-developers/iAaq0pvHXuA/fpUuwjK3i2wJ) ### For more information If you have any questions or comments about this advisory: * Open an issue at https://github.com/tm-kn/django-basic-auth-ip-whitelist/issues * Email us at the email specified on the [security policy](https://github.com/tm-kn/django-basic-auth-ip-whitelist/security/policy). ### Acknowledgements Thanks to Thibaud Colas for reporting this.

CVE-2020-4071 Affected Django basic auth ip whitelist Versions

1 component(s)
Fixed Versions:
0.3.4
Product / Package Ecosystem Affected Versions Fixed Version
django-basic-auth-ip-whitelist
PyPI
< 0.3.4
0.3.4

References

Frequently Asked Questions

What is CVE-2020-4071?
CVE-2020-4071 is a security vulnerability in Django basic auth ip whitelist involving Timing attack on django-basic-auth-ip-whitelist under CWE-208: Observable Timing Discrepancy.
Which Django basic auth ip whitelist versions are affected?
Affected versions include releases prior to 0.3.4 across affected packages: django-basic-auth-ip-whitelist.
What version fixes CVE-2020-4071?
Upgrading to 0.3.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is django-basic-auth-ip-whitelist affected?
Yes, django-basic-auth-ip-whitelist is affected in releases prior to 0.3.4. Upgrade your dependency to 0.3.4 or later.
What is the CVSS score of CVE-2020-4071?
CVE-2020-4071 has a CVSS v3.1 base score of 2.2 (MODERATE) with vector string CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2020-4071?
CVE-2020-4071 is classified under CWE-208: Observable Timing Discrepancy (Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not.).
How can I check PyPI dependencies for CVE-2020-4071?
Run the dependency tree command: 'pip show django-basic-auth-ip-whitelist'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m38j-pmg3-v5x5",
  "modified" : "2024-11-18T16:26:09Z",
  "published" : "2020-06-23T19:58:27Z",
  "aliases" : [ "CVE-2020-4071" ],
  "summary" : "Timing attack on django-basic-auth-ip-whitelist",
  "details" : "### Impact\n\nPotential timing attack exists on websites where the basic authentication is used or configured, i.e. `BASIC_AUTH_LOGIN` and `BASIC_AUTH_PASSWORD` is set. Currently the string comparison between configured credentials and the ones provided by users is performed through a character-by-character string comparison. This enables a possibility that attacker may time the time it takes the server to validate different usernames and password, and use this knowledge to work out the valid credentials. This attack is understood not to be realistic over the Internet. However, it may be achieved from within local networks where the website is hosted, e.g. from inside a data centre where a website's server is located.\n\nSites protected by IP address whitelisting only are unaffected by this vulnerability.\n\n### Patches\nThis vulnerability has been fixed on version 0.3.4 of django-basic-auth-ip-whitelist. Update to version 0.3.4 as soon as possible and change basic authentication username and password configured on a Django project using this package.\n\n### Workarounds\nStop using basic authentication and use the IP whitelisting component only. It can be achieved by not setting `BASIC_AUTH_LOGIN` and `BASIC_AUTH_PASSWORD` in Django project settings.\n\n### References\n\n- [Django mailing list discussion](https://groups.google.com/forum/#!msg/django-developers/iAaq0pvHXuA/fpUuwjK3i2wJ)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue at https://github.com/tm-kn/django-basic-auth-ip-whitelist/issues\n* Email us at the email specified on the [security policy](https://github.com/tm-kn/django-basic-auth-ip-whitelist/security/policy).\n\n### Acknowledgements\n\nThanks to Thibaud Colas for reporting this.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "django-basic-auth-ip-whitelist"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tm-kn/django-basic-auth-ip-whitelist/security/advisories/GHSA-m38j-pmg3-v5x5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-4071"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tm-kn/django-basic-auth-ip-whitelist/commit/effe05ed1ed9e1ccc675a65b69d36217e5c5dfc6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django-basic-auth-ip-whitelist/PYSEC-2020-37.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tm-kn/django-basic-auth-ip-whitelist"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!msg/django-developers/iAaq0pvHXuA/fpUuwjK3i2wJ"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-208" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-23T19:56:14Z",
    "nvd_published_at" : null
  }
}