Cloudanix VulnDB

CVE-2016-2513

Low · 3.1

CVSS

3.1

EPSS

3.3%

Published

Apr 8, 2016

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

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.

Chainable
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

  1. Attacker identifies a web application using a vulnerable version of the Django framework.
  2. The attacker prepares a dictionary of potential usernames to test against the application's login endpoint.
  3. Using an automated script, the attacker sends login requests for each username and measures the server's response time.
  4. The attacker analyzes the timing data, differentiating between faster responses (invalid user) and slower responses (valid user).
  5. A list of valid usernames is compiled from the results.
  6. 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