Broken Authentication in Django

How Broken Authentication Manifests in Django

Broken Authentication in Django applications typically exploits weaknesses in how Django handles session management, password policies, and authentication flows. Unlike generic web frameworks, Django's authentication system has specific implementation details that attackers can target.

One common attack vector is session fixation. Django generates session IDs that, if not properly invalidated during login, allow attackers to force a user into a known session. This occurs when developers call login() without first calling django.contrib.auth.logout() or creating a new session:

 

Related CWEs: authentication

CWE IDNameSeverity
CWE-287Improper Authentication CRITICAL
CWE-306Missing Authentication for Critical Function CRITICAL
CWE-307Brute Force HIGH
CWE-308Single-Factor Authentication MEDIUM
CWE-309Use of Password System for Primary Authentication MEDIUM
CWE-347Improper Verification of Cryptographic Signature HIGH
CWE-384Session Fixation HIGH
CWE-521Weak Password Requirements MEDIUM
CWE-613Insufficient Session Expiration MEDIUM
CWE-640Weak Password Recovery HIGH