CVE-2015-8213
NoneCVSS
—
EPSS
4.3%
Published
Dec 7, 2015
CISA due date
—
Cloudanix analysis
Older Django-based websites may accidentally reveal private application secrets if a user can make the site treat a secret name like a date or time format.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Exposure
- Component
- Web Framework
- Class
- Information Disclosure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
CVE-2015-8213 is an information disclosure flaw in Django's localization format handling. In affected Django versions, the get_format function could be given an arbitrary Django settings key instead of a legitimate date/time or number-format setting name. If an application exposed a code path where an attacker could influence the requested format key, Django could return sensitive configuration values such as SECRET_KEY or other application settings. The flaw impacts confidentiality only; it does not directly enable code execution, data modification, or denial of service.
Why it matters to the business
Successful exploitation can expose application secrets used to sign cookies, password-reset tokens, CSRF-related data, or other sensitive configuration values. Disclosure of Django SECRET_KEY is especially serious because it may let attackers forge signed data depending on how the application uses Django signing features. The vulnerability affects older Django 1.7, 1.8, and pre-release 1.9 versions; although it is not listed in CISA KEV and no mature public exploitation is indicated, internet-facing legacy Django applications should treat exposure as a meaningful risk because leaked secrets may require credential and key rotation, user session invalidation, and incident response.
How an attack unfolds
An attacker first identifies an application running a vulnerable Django release. They then look for an endpoint, template feature, localization feature, API parameter, or custom view that accepts a user-controlled date/time or localization format name and passes it to Django's get_format behavior. Instead of supplying a legitimate value such as DATE_FORMAT or DATETIME_FORMAT, the attacker supplies a sensitive settings name such as SECRET_KEY. On vulnerable versions, Django may resolve and return the value of that setting. The attacker can then use the disclosed secret to support follow-on attacks, such as forging signed values, attacking session-related workflows, or harvesting additional configuration details if other settings are exposed through the same path.
How to fix it
Upgrade Django to a fixed release. Affected version ranges are Django 1.7.x before 1.7.11, Django 1.8.x before 1.8.7, and Django 1.9.x before 1.9rc2. Prefer upgrading to a currently supported Django LTS or stable release rather than remaining on legacy branches. If immediate upgrade is not possible, remove or restrict any application code paths that allow user-controlled input to select localization or format setting names, and allowlist only expected format constants such as DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT, MONTH_DAY_FORMAT, SHORT_DATE_FORMAT, SHORT_DATETIME_FORMAT, FIRST_DAY_OF_WEEK, DECIMAL_SEPARATOR, THOUSAND_SEPARATOR, NUMBER_GROUPING, DATE_INPUT_FORMATS, TIME_INPUT_FORMATS, and DATETIME_INPUT_FORMATS. If SECRET_KEY or other credentials may have been exposed, rotate affected secrets, invalidate sessions and signed tokens as appropriate, and review any dependent integrations for credential reuse.
How to confirm the fix worked
Confirm the installed Django version is not within the vulnerable ranges: 1.7.x must be 1.7.11 or later, 1.8.x must be 1.8.7 or later, and 1.9 pre-release deployments must be 1.9rc2 or later. Validate through package inventory, build manifests, dependency lockfiles, container images, and runtime checks such as importing django and printing django.get_version(). Review application code for direct calls to django.utils.formats.get_format where the format_type argument can be influenced by request parameters, path variables, headers, cookies, JSON bodies, or template context. Perform a safe negative test in a non-production environment by attempting to request SECRET_KEY or another harmless sentinel settings name through exposed formatting functionality and confirming the value is not returned.
Typical attack path
- Fingerprint the target as a Django application, often by observing headers, error pages, static paths, framework behavior, or dependency disclosures.
- Identify a reachable endpoint or feature that accepts a user-controlled localization, date, time, or formatting key.
- Submit a sensitive Django settings key, commonly SECRET_KEY, in place of an expected date/time format setting.
- Inspect the response for leaked configuration values or unexpected raw setting output.
- Use any disclosed secret to attempt downstream attacks such as forging signed values, bypassing trust checks, or expanding access to other application secrets.
- Repeat with other likely settings names if the application reflects or returns configuration values.
How to detect it
To determine whether exploitation was attempted or successful, review HTTP access logs, application logs, reverse proxy logs, WAF logs, and error logs for requests containing Django settings names submitted as query parameters, form fields, JSON keys, path components, or template/localization parameters. Focus on strings such as SECRET_KEY, DATABASES, PASSWORD, EMAIL_HOST_PASSWORD, AWS_SECRET_ACCESS_KEY, API_KEY, TOKEN, DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, and format-related parameter names. Investigate responses to these requests for unusually long values, high-entropy strings, quoted configuration values, stack traces, or serialized settings output. If full request and response logging is available, look for the sensitive value being returned to the client. Also review application source and historical request logs for custom endpoints that wrap django.utils.formats.get_format. If SECRET_KEY exposure is suspected, examine downstream signs of abuse such as anomalous signed cookie values, unexpected session activity, forged password-reset or activation workflows, and authentication events that do not align with normal user behavior.
- SECRET_KEY
- format=SECRET_KEY
- format_type=SECRET_KEY
- key=SECRET_KEY
- setting=SECRET_KEY
- get_format
- DATE_FORMAT
- DATETIME_FORMAT
- TIME_FORMAT
- DATABASES
- EMAIL_HOST_PASSWORD
- AWS_SECRET_ACCESS_KEY
- API_KEY
- API_TOKEN
- PASSWORD
- django.utils.formats.get_format
What your security team should do
- Prioritize identification and upgrade of internet-facing applications using vulnerable Django 1.7.x, 1.8.x, or 1.9 pre-release versions.
- Search codebases for user-controlled calls to django.utils.formats.get_format and replace dynamic format selection with strict allowlists.
- If exposure is confirmed or cannot be ruled out, rotate Django SECRET_KEY and any other potentially disclosed secrets, then invalidate sessions and signed tokens that depend on the old key.
- Review web access logs for attempts to request SECRET_KEY or other settings names through query strings, form fields, JSON bodies, or localization-related endpoints.
- Add monitoring for suspicious requests containing Django settings names such as SECRET_KEY, DATABASES, EMAIL_HOST_PASSWORD, AWS_SECRET_ACCESS_KEY, and API_TOKEN.
- Plan migration away from unsupported Django branches to a supported LTS release to reduce exposure to legacy framework vulnerabilities.
The record
The get_format function in utils/formats.py in Django before 1.7.x before 1.7.11, 1.8.x before 1.8.7, and 1.9.x before 1.9rc2 might allow remote attackers to obtain sensitive application secrets via a settings key in place of a date/time format setting, as demonstrated by SECRET_KEY.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | django | 0 | 1.7.11 |
| PyPI | django | 0 | 316bc3fc9437c5960c24baceb93c73f1939711e4 |
| PyPI | django | 1.7 | 1.7.11 |
| PyPI | django | 1.8 | 1.8.7 |
| PyPI | django | 1.8a1 | 1.8.7 |
| PyPI | django | 1.9a1 | 1.9rc2 |
| Debian:11 | python-django | 0 | 1.8.7-1 |
| Debian:12 | python-django | 0 | 1.8.7-1 |
| Debian:13 | python-django | 0 | 1.8.7-1 |
| Debian:6.0 | python-django | 0 | 1.2.3-3+squeeze15 |
| Debian:7 | python-django | 0 | 1.4.5-1+deb7u14 |
| Debian:8 | python-django | 0 | 1.7.7-1+deb8u3 |
| Mageia:5 | python-django | 0 | 1.8.7-1.mga5 |
| Red Hat:openstack-optools:7::el7 | python-django | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack-optools:7::el7 | python-django-bash-completion | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:5::el6 | python-django | 0 | 0:1.6.11-4.el6ost |
| Red Hat:openstack:5::el6 | python-django-bash-completion | 0 | 0:1.6.11-4.el6ost |
| Red Hat:openstack:5::el6 | python-django-doc | 0 | 0:1.6.11-4.el6ost |
| Red Hat:openstack:5::el7 | python-django | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:5::el7 | python-django-bash-completion | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:5::el7 | python-django-doc | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:6::el7 | python-django | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:6::el7 | python-django-bash-completion | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:6::el7 | python-django-doc | 0 | 0:1.6.11-4.el7ost |
| Red Hat:openstack:7::el7 | python-django | 0 | 0:1.8.7-1.el7 |
| Red Hat:openstack:7::el7 | python-django-bash-completion | 0 | 0:1.8.7-1.el7 |
| Red Hat:openstack:7::el7 | python-django-doc | 0 | 0:1.8.7-1.el7 |
| SUSE:Enterprise Storage 1.0 | python-Django | 0 | 1.6.11-11.1 |
| SUSE:Enterprise Storage 2 | python-Django | 0 | 1.6.11-3.1 |
| SUSE:OpenStack Cloud 5 | python-Django | 0 | 1.6.11-13.1 |
| Ubuntu:14.04:LTS | python-django | 0 | 1.6.1-2ubuntu0.11 |
| pypi | Django | 1.7 | No fix |
| pypi | Django | 1.8a1 | No fix |
| pypi | Django | 1.9a1 | No fix |
Related vulnerabilities
- GHSA-8p8v-wh79-9r56 Django vulnerable to Uncontrolled Resource Consumption Also affects django
- GHSA-mjgh-79qc-68w3 Django has a Race Condition vulnerability Also affects django
- CVE-2026-25673 An issue was discovered in 6.0 before 6.0.3, 5.2 before 5.2.12, and 4.2 before 4.2.29. Also affects django
- CVE-2026-25674 An issue was discovered in 6.0 before 6.0.3, 5.2 before 5.2.12, and 4.2 before 4.2.29. Also affects django
- GHSA-6426-9fv3-65x8 Django has an SQL Injection issue Also affects django
- GHSA-gvg8-93h5-g6qq Django has an SQL Injection issue Also affects django
- GHSA-2mcm-79hx-8fxw Django has Observable Timing Discrepancy Also affects django
- GHSA-33mw-q7rj-mjwj Django has Inefficient Algorithmic Complexity Also affects django