Vulnerabilities in pkg:pypi/django-registration

PACKAGE
Advisory Identifier: GHSA-58c7-px5v-82hh
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/django-registration

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-58c7-px5v-82hh CVE-2021-21416 LOW Potential sensitive information disclosed in error reports

CVE-2021-21416 at a Glance

CVE Identifier CVE-2021-21416
GHSA Identifier GHSA-58c7-px5v-82hh
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-209: Generation of Error Message Containing Sensitive Information
Affected Product Django registration
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

django-registration fixed: 3.1.2
pip install django-registration>=3.1.2
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-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

django-registration is a user-registration application for Django. ### Impact The 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. Triggering this requires the following conditions: * A site is using django-registration < 3.1.2 * 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 * A server-side error (HTTP 5xx) occurs during an attempt by a user to register an account Under 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). ### Patches As 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. Note 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). ### Workarounds Users 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: ```python from django.utils.decorators import method_decorator from django.views.decorators.debug import sensitive_post_parameters from django_registration.views import RegistrationView class MyRegistrationView(RegistrationView): """ A RegistrationView subclass manually protected against sensitive information disclosure in error reports. """ @method_decorator(sensitive_post_parameters()) def dispatch(self, *args, **kwargs): return super().dispatch(*args, **kwargs) ``` ### References * Django's documentation on [error reporting in production](https://docs.djangoproject.com/en/3.1/howto/error-reporting/) * [How Django's sensitive-data filters work](https://docs.djangoproject.com/en/3.1/howto/error-reporting/#filtering-error-reports)

CVE-2021-21416 Affected Django registration Versions

1 component(s)
Fixed Versions:
3.1.2
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?
CVE-2021-21416 is a security vulnerability in Django registration involving Potential sensitive information disclosed in error reports under CWE-209: Generation of Error Message Containing Sensitive Information.
Which Django registration versions are affected?
Affected versions include releases prior to 3.1.2 across affected packages: django-registration.
What version fixes CVE-2021-21416?
Upgrading to 3.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is django-registration affected?
Yes, django-registration is affected in releases prior to 3.1.2. Upgrade your dependency to 3.1.2 or later.
What is the CVSS score of CVE-2021-21416?
CVE-2021-21416 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-21416?
CVE-2021-21416 is classified under CWE-209: Generation of Error Message Containing Sensitive Information (The product generates an error message that includes sensitive information about its environment, users, or associated data.).
How can I check PyPI dependencies for CVE-2021-21416?
Run the dependency tree command: 'pip show django-registration'. 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-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"
  }
}