CVE-2012-4520: Django Allows Arbitrary URL Generation
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.88547%
CWE
Published
5/17/2022
Updated
9/18/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
django | pip | >= 1.3, < 1.3.4 | 1.3.4 |
django | pip | >= 1.4, < 1.4.2 | 1.4.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key points:
- The original get_host() function lacked validation for dangerous characters (e.g., '@') in the Host header, allowing URL manipulation (CWE-20). The commit adds a check for these characters.
- The admin password reset view (when is_admin_site=True) used the raw HTTP_HOST value from request.META, bypassing get_host()'s validation entirely in vulnerable versions. The patch replaced this with request.get_host(), which (after being fixed) enforced proper validation. The combination of these two factors allowed attackers to control the domain in generated URLs via malicious Host headers.