Vulnerabilities in pkg:pypi/django-two-factor-auth
PACKAGECVE-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.
pkg:pypi/django-two-factor-auth
Vulnerability advisories affecting package pkg:pypi/django-two-factor-auth. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-vhr6-pvjm-9qwf | CVE-2020-15105 | MODERATE | User passwords are stored in clear text in the Django session |
CVE-2020-15105 at a Glance
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).
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.
pip install django-two-factor-auth>=1.12
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
CVE-2020-15105 Affected Django two factor auth Versions
1 component(s)| 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?
Which Django two factor auth versions are affected?
What version fixes CVE-2020-15105?
Is django-two-factor-auth affected?
What is the CVSS score of CVE-2020-15105?
What CWE is associated with CVE-2020-15105?
How can I check PyPI dependencies for CVE-2020-15105?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}