CVE-2021-21416: Django registration Potential Sensitive Information Disclosed Vulnerability
LOWCVE-2021-21416 is a LOW (CVSS 3.7) potential sensitive information disclosed vulnerability (CWE-209: Generation of Error Message Containing Sensitive Information) affecting Django registration libraries in the PyPI ecosystem. The issue involves potential sensitive information disclosed in error reports. Remediation is available by upgrading affected packages to version 3.1.2.
CVE-2021-21416 at a Glance
Security Impact
CVSS: 3.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2021-21416
To remediate this vulnerability, upgrade all affected Django registration 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-registration>=3.1.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show django-registration
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-21416, inspect your installed packages using pip:
pip show django-registration
Analyze the terminal output to locate any version of Django registration in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.2), your application is affected.
Note: The pip show django-registration command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-209: Generation of Error Message Containing Sensitive Information, where the product generates an error message that includes sensitive information about its environment, users, or associated data. In Django registration, 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-2021-21416 Affected Django registration Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
django-registration
|
PyPI |
< 3.1.2
|
3.1.2
|
References
Frequently Asked Questions
What is CVE-2021-21416?
Which Django registration versions are affected?
What version fixes CVE-2021-21416?
Is django-registration affected?
What is the CVSS score of CVE-2021-21416?
What CWE is associated with CVE-2021-21416?
How can I check PyPI dependencies for CVE-2021-21416?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-58c7-px5v-82hh",
"modified" : "2024-09-16T21:29:06Z",
"published" : "2021-04-06T17:28:59Z",
"aliases" : [ "CVE-2021-21416" ],
"summary" : "Potential sensitive information disclosed in error reports",
"details" : "django-registration is a user-registration application for Django. \n\n### Impact\n\nThe django-registration package provides tools for implementing user-account registration flows in the Django web framework. In django-registration prior to 3.1.2, the base user-account registration view did not properly apply filters to sensitive data, with the result that sensitive data could be included in error reports rather than removed automatically by Django.\n\nTriggering this requires the following conditions:\n\n* A site is using django-registration < 3.1.2\n* The site has detailed error reports (such as Django's [emailed error reports to site staff/developers](https://docs.djangoproject.com/en/3.1/howto/error-reporting/#email-reports)) enabled\n* A server-side error (HTTP 5xx) occurs during an attempt by a user to register an account\n\nUnder these conditions, recipients of the detailed error report will see all submitted data from the account-registration attempt, which may include the user's proposed credentials (such as a password).\n\n### Patches\n\nAs of version 3.1.2, django-registration properly applies Django's `sensitive_post_parameters()` decorator to the base user-registration view, which will cause all data from the HTTP request body to be filtered from detailed error reports in the event of a server-side crash during user account registration.\n\nNote that as applied, this filters *all* HTTP request data from error reports. To selectively allow some fields but not others, see Django's own documentation (in references) and the notes below for how to apply `sensitive_post_parameters()` manually to a particular codebase's `RegistrationView` subclass(es).\n\n### Workarounds\n\nUsers who cannot upgrade quickly can apply the `django.views.decorators.debug.sensitive_post_parameters()` decorator to their own registration views. The decorator should be applied on the `dispatch()` method of the appropriate `RegistrationView` class, using Django's `method_decorator()` helper. For example:\n\n```python\nfrom django.utils.decorators import method_decorator\nfrom django.views.decorators.debug import sensitive_post_parameters\n\nfrom django_registration.views import RegistrationView\n\nclass MyRegistrationView(RegistrationView):\n \"\"\"\n A RegistrationView subclass manually protected against sensitive information disclosure\n in error reports.\n\n \"\"\"\n @method_decorator(sensitive_post_parameters())\n def dispatch(self, *args, **kwargs):\n return super().dispatch(*args, **kwargs)\n```\n\n### References\n\n* Django's documentation on [error reporting in production](https://docs.djangoproject.com/en/3.1/howto/error-reporting/)\n* [How Django's sensitive-data filters work](https://docs.djangoproject.com/en/3.1/howto/error-reporting/#filtering-error-reports)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "django-registration"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.1.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ubernostrum/django-registration/security/advisories/GHSA-58c7-px5v-82hh"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21416"
}, {
"type" : "WEB",
"url" : "https://github.com/ubernostrum/django-registration/commit/2db0bb7ec35636ea46b07b146328b87b2cb13ca5"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/django-registration/PYSEC-2021-11.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ubernostrum/django-registration"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-201", "CWE-209" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-01T21:03:08Z",
"nvd_published_at" : "2021-04-01T22:15:00Z"
}
}