CVE-2016-2513
Low · 3.1CVSS
3.1
EPSS
3.3%
Published
Apr 8, 2016
CISA due date
—
Cloudanix analysis
A flaw in the website's login function could allow an attacker to discover valid usernames, which can then be used in targeted attempts to guess passwords and break into accounts.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- High
- Impact
- Data Exposure
- Component
- Web Framework
- Class
- Information Disclosure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability is a timing side-channel weakness in Django's password hashing component. When processing login requests, the system takes a measurably different amount of time to respond depending on whether the provided username exists or not. This is because a computationally intensive password hashing operation is only performed for existing users. This timing difference allows a remote attacker to distinguish valid usernames from invalid ones, leading to user enumeration.
Why it matters to the business
Attackers can exploit this flaw to build a list of valid usernames for an application. This list of confirmed accounts can then be used to launch more targeted attacks, such as password spraying, credential stuffing, or phishing campaigns, significantly increasing the risk of account takeovers and subsequent data breaches.
How an attack unfolds
An unauthenticated remote attacker targets the login form of an application built with a vulnerable version of Django. The attacker systematically submits login attempts for a large list of potential usernames, each with a dummy password. By precisely measuring the server's response time for each attempt, the attacker can identify a slight but consistent delay for requests involving valid usernames compared to invalid ones. Using statistical analysis to account for network latency, the attacker can reliably filter the list of potential usernames down to a confirmed list of accounts registered on the system.
How to fix it
Upgrade Django to a patched version. For projects on the 1.8.x branch, upgrade to version 1.8.10 or later. For projects on the 1.9.x branch, upgrade to version 1.9.3 or later. As a defense-in-depth measure, implement rate limiting and temporary account lockouts on authentication endpoints to frustrate automated enumeration attempts.
How to confirm the fix worked
Confirm that your application's dependencies have been updated and the deployed version of Django is 1.8.10+ or 1.9.3+. You can verify this by checking your project's `requirements.txt` or equivalent dependency management file. To actively test for the vulnerability, use a security tool or custom script capable of performing timing attacks against the login form. After patching, there should be no statistically significant difference in response times between login attempts for valid and invalid usernames.
Typical attack path
- Attacker identifies a web application using a vulnerable version of the Django framework.
- The attacker prepares a dictionary of potential usernames to test against the application's login endpoint.
- Using an automated script, the attacker sends login requests for each username and measures the server's response time.
- The attacker analyzes the timing data, differentiating between faster responses (invalid user) and slower responses (valid user).
- A list of valid usernames is compiled from the results.
- The attacker uses the enumerated usernames to conduct password spraying or targeted phishing attacks to gain unauthorized access.
How to detect it
Detecting exploitation of this timing attack is challenging as it masquerades as normal failed login traffic. Analysts should look for behavioral anomalies in web server and application logs. Key indicators include a high volume of failed login attempts originating from a single IP address that cycles through a large number of different, non-sequential usernames. This pattern differs from a standard brute-force attack, which typically targets one account with many passwords. Correlate these events with subsequent password spraying attempts (many users, few passwords) or successful logins from unexpected locations.
What your security team should do
- Immediately identify and prioritize upgrading all applications using vulnerable Django versions (pre-1.8.10 or pre-1.9.3).
- Implement robust rate-limiting on authentication endpoints to mitigate this and other brute-force style attacks.
- Configure monitoring and alerting for high rates of failed login attempts from a single source IP across multiple user accounts, as this can indicate an enumeration attempt.
The record
The password hasher in contrib/auth/hashers.py in Django before 1.8.10 and 1.9.x before 1.9.3 allows remote attackers to enumerate users via a timing attack involving login requests.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | django | 0 | 1.8.10 |
| PyPI | django | 0 | 67b46ba7016da2d259c1ecc7d666d11f5e1cfaab |
| PyPI | django | 1.9 | 1.9.3 |
| Debian:11 | python-django | 0 | 1.9.4-1 |
| Debian:12 | python-django | 0 | 1.9.4-1 |
| Debian:13 | python-django | 0 | 1.9.4-1 |
| Debian:7 | python-django | 0 | 1.4.5-1+deb7u16 |
| Debian:8 | python-django | 0 | 1.7.7-1+deb8u4 |
| Mageia:5 | python-django | 0 | 1.8.10-1.mga5 |
| Red Hat:openstack-optools:7::el7 | python-django | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack-optools:7::el7 | python-django-bash-completion | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:5::el6 | python-django | 0 | 0:1.6.11-5.el6ost |
| Red Hat:openstack:5::el6 | python-django-bash-completion | 0 | 0:1.6.11-5.el6ost |
| Red Hat:openstack:5::el6 | python-django-doc | 0 | 0:1.6.11-5.el6ost |
| Red Hat:openstack:5::el7 | python-django | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:5::el7 | python-django-bash-completion | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:5::el7 | python-django-doc | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:6::el7 | python-django | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:6::el7 | python-django-bash-completion | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:6::el7 | python-django-doc | 0 | 0:1.6.11-5.el7ost |
| Red Hat:openstack:7::el7 | python-django | 0 | 0:1.8.11-1.el7ost |
| Red Hat:openstack:7::el7 | python-django-bash-completion | 0 | 0:1.8.11-1.el7ost |
| Red Hat:openstack:7::el7 | python-django-doc | 0 | 0:1.8.11-1.el7ost |
| Ubuntu:14.04:LTS | python-django | 0 | 1.6.1-2ubuntu0.12 |
| openSUSE:Tumbleweed | python-Django | 0 | 1.10.4-1.1 |
| pypi | Django | 1.9 | 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