CVE-2020-15105: Django two factor auth User Passwords Are Stored Vulnerability

MODERATE
Advisory Identifier: GHSA-vhr6-pvjm-9qwf
CVSS 5.4
CWE-312
Published
Advisory Summary

CVE-2020-15105 is a MODERATE (CVSS 5.4) user passwords are stored vulnerability (CWE-312: Cleartext Storage of Sensitive Information) affecting Django two factor auth libraries in the PyPI ecosystem. The issue involves user passwords are stored in clear text in the django session. Remediation is available by upgrading affected packages to version 1.12.

CVE-2020-15105 at a Glance

CVE Identifier CVE-2020-15105
GHSA Identifier GHSA-vhr6-pvjm-9qwf
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-312: Cleartext Storage of Sensitive Information
Affected Product Django two factor auth
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.4

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

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

How to Fix CVE-2020-15105

To remediate this vulnerability, upgrade all affected Django two factor auth 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-two-factor-auth fixed: 1.12
pip install django-two-factor-auth>=1.12
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-two-factor-auth

How to Check if You Are Affected

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

pip show django-two-factor-auth

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

Note: The pip show django-two-factor-auth command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-312: Cleartext Storage of Sensitive Information, where the product stores sensitive information in cleartext within a resource that might be accessible to another control sphere. In Django two factor auth, 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 django-two-factor-auth versions 1.11 and before store the user's password in clear text in the user session (base64-encoded). The password is stored in the session when the user submits their username and password, and is removed once they complete authentication by entering a two-factor authentication code. This means that the password is stored in clear text in the session for an arbitrary amount of time, and potentially forever if the user begins the login process by entering their username and password, and then leaves before entering their two-factor authentication code. The severity of this issue depends on which type of session storage you have configured: in the worst case, if you're using Django's default database session storage, then users' password are stored in clear text in your database. In the best case, if you're using Django's signed cookie session, then users' passwords are only stored in clear text within their browser's cookie store. In the common case of using Django's cache session store, the users' password are stored in clear text in whatever cache storage you have configured (typically Memcached or Redis). ### Patches Upgrade to version 1.12 to resolve this issue. After upgrading, users should be sure to delete any clear text passwords that have been stored. For example, if you're using the database session backend, you'll likely want to delete any session record from the database and purge that data from any database backups or replicas. In addition, affected organizations who have suffered a database breach while using an affected version should inform their users that their clear text passwords have been compromised. All organizations should encourage users whose passwords were insecurely stored to change these passwords on any sites where they were used. ### Workarounds Switching Django's session storage to use signed cookies instead of the database or cache lessens the impact of this issue, but should not be done without a thorough understanding of the security tradeoffs of using signed cookies rather than a server-side session storage. There is no way to fully mitigate the issue without upgrading. ### References For an explanation of why storing cleartext password is a substantial vulnerability: [Hashing Passwords: One-Way Road to Security](https://auth0.com/blog/hashing-passwords-one-way-road-to-security/). For documentation on configuring the Django session storage engine: [Django session documentation](https://docs.djangoproject.com/en/3.0/topics/http/sessions/). ### For more information If you have any questions or comments about this advisory: * Open an issue in [the repo](https://github.com/Bouke/django-two-factor-auth)

CVE-2020-15105 Affected Django two factor auth Versions

1 component(s)
Fixed Versions:
1.12
Product / Package Ecosystem Affected Versions Fixed Version
django-two-factor-auth
PyPI
< 1.12
1.12

References

Frequently Asked Questions

What is CVE-2020-15105?
CVE-2020-15105 is a security vulnerability in Django two factor auth involving User passwords are stored in clear text in the Django session under CWE-312: Cleartext Storage of Sensitive Information.
Which Django two factor auth versions are affected?
Affected versions include releases prior to 1.12 across affected packages: django-two-factor-auth.
What version fixes CVE-2020-15105?
Upgrading to 1.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is django-two-factor-auth affected?
Yes, django-two-factor-auth is affected in releases prior to 1.12. Upgrade your dependency to 1.12 or later.
What is the CVSS score of CVE-2020-15105?
CVE-2020-15105 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2020-15105?
CVE-2020-15105 is classified under CWE-312: Cleartext Storage of Sensitive Information (The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.).
How can I check PyPI dependencies for CVE-2020-15105?
Run the dependency tree command: 'pip show django-two-factor-auth'. 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-vhr6-pvjm-9qwf",
  "modified" : "2024-09-16T21:33:50Z",
  "published" : "2020-07-10T20:55:00Z",
  "aliases" : [ "CVE-2020-15105" ],
  "summary" : "User passwords are stored in clear text in the Django session",
  "details" : "### Impact\n\ndjango-two-factor-auth versions 1.11 and before store the user's password in clear text in the user session (base64-encoded). The password is stored in the session when the user submits their username and password, and is removed once they complete authentication by entering a two-factor authentication code. This means that the password is stored in clear text in the session for an arbitrary amount of time, and potentially forever if the user begins the login process by entering their username and password, and then leaves before entering their two-factor authentication code.\n\nThe severity of this issue depends on which type of session storage you have configured: in the worst case, if you're using Django's default database session storage, then users' password are stored in clear text in your database. In the best case, if you're using Django's signed cookie session, then users' passwords are only stored in clear text within their browser's cookie store. In the common case of using Django's cache session store, the users' password are stored in clear text in whatever cache storage you have configured (typically Memcached or Redis).\n\n### Patches\n\nUpgrade to version 1.12 to resolve this issue.\n\nAfter upgrading, users should be sure to delete any clear text passwords that have been stored. For example, if you're using the database session backend, you'll likely want to delete any session record from the database and purge that data from any database backups or replicas.\n\nIn addition, affected organizations who have suffered a database breach while using an affected version should inform their users that their clear text passwords have been compromised. All organizations should encourage users whose passwords were insecurely stored to change these passwords on any sites where they were used.\n\n### Workarounds\n\nSwitching Django's session storage to use signed cookies instead of the database or cache lessens the impact of this issue, but should not be done without a thorough understanding of the security tradeoffs of using signed cookies rather than a server-side session storage. There is no way to fully mitigate the issue without upgrading.\n\n### References\n\nFor an explanation of why storing cleartext password is a substantial vulnerability: [Hashing Passwords: One-Way Road to Security](https://auth0.com/blog/hashing-passwords-one-way-road-to-security/).  \nFor documentation on configuring the Django session storage engine: [Django session documentation](https://docs.djangoproject.com/en/3.0/topics/http/sessions/).\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the repo](https://github.com/Bouke/django-two-factor-auth)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "django-two-factor-auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.12"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Bouke/django-two-factor-auth/security/advisories/GHSA-vhr6-pvjm-9qwf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15105"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Bouke/django-two-factor-auth/commit/454fd9842fa6e8bb772dbf0943976bc8e3335359"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Bouke/django-two-factor-auth"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Bouke/django-two-factor-auth/blob/master/CHANGELOG.md#112---2020-07-08"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django-two-factor-auth/PYSEC-2020-39.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-312" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-07-10T20:52:31Z",
    "nvd_published_at" : null
  }
}