Cloudanix VulnDB

CVE-2009-2659

None

CVSS

—

EPSS

2.3%

Published

Aug 4, 2009

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A security flaw in older versions of a web application component could allow an attacker to read sensitive files from the server by sending a specially crafted web request.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Data Exposure
Component
Web Framework
Class
Path Traversal
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

A path traversal vulnerability in the Django Admin media handler allows an unauthenticated remote attacker to read arbitrary files on the server's filesystem. The flaw exists because the application does not properly sanitize user-supplied input in URL requests for static media files, allowing directory traversal sequences (e.g., '../') to navigate outside the intended web root directory. This results in the disclosure of any file readable by the web server process.

Why it matters to the business

An attacker can exploit this vulnerability to steal sensitive information from the server, such as application source code, configuration files containing credentials, API keys, or other secrets. This data leakage can lead to further system compromise, unauthorized access to other systems, regulatory penalties for data breaches, and significant reputational damage. Any system still running such an old, vulnerable version is likely unmaintained and poses a severe, multifaceted risk to the organization.

How an attack unfolds

An unauthenticated remote attacker crafts a malicious URL targeting the Django application's admin media handler. Instead of requesting a legitimate static file like an image or stylesheet, the URL path includes directory traversal sequences (e.g., `../../../etc/passwd`). The vulnerable server fails to validate the path and processes the request, navigating up the directory tree from the intended static files folder. The server then reads the targeted file from the filesystem and returns its contents in the HTTP response, effectively giving the attacker access to sensitive server-side files.

How to fix it

The primary remediation is to upgrade to a patched version of Django. This specific vulnerability was fixed in Django 1.0.1 and 0.96.5. Given the age of these versions, a full upgrade to a modern, supported Django release is strongly recommended to address this and numerous other vulnerabilities. For downstream products that bundle Django, upgrade to a version confirmed to resolve the issue, such as 'vault-k8s-fips (Chainguard)' version 1.3.1-r3 or later. As a temporary mitigation, a Web Application Firewall (WAF) can be configured to block requests containing directory traversal patterns.

How to confirm the fix worked

To validate the fix, use a security scanner or manual testing to send a request containing a directory traversal payload to the admin media handler. For example, attempt to access a common system file with a request like `GET /admin_media/../../../etc/passwd HTTP/1.1`. A vulnerable system will return the contents of the file with a '200 OK' status. A patched system should return a '404 Not Found' error or otherwise block the request. Additionally, verify that the installed Django version is no longer in the vulnerable range (1.0 or 0.96).

Typical attack path

  1. The attacker identifies a web application running a vulnerable version of Django (e.g., 1.0 or 0.96).
  2. The attacker crafts a malicious HTTP GET request to an endpoint served by the Admin media handler.
  3. The request's URL path contains directory traversal sequences ('../') to navigate outside the intended static media directory.
  4. The attacker targets a known sensitive file on the server's filesystem, such as '/etc/passwd' or application configuration files.
  5. The vulnerable server processes the request, reads the targeted file, and sends its contents back in the HTTP response.
  6. The attacker successfully exfiltrates the contents of the sensitive file.

How to detect it

To detect potential exploitation, review web server access logs (e.g., Apache, Nginx) for HTTP GET requests directed at the Django admin media handler that contain directory traversal sequences. Look for patterns like '../', '..%2f', or '%2e%2e%2f' within the URL path. A successful exploitation attempt would likely be followed by a '200 OK' HTTP status code, indicating the server successfully retrieved and returned a file. Failed attempts may register as '404 Not Found' or '403 Forbidden'. Monitor for anomalous file read operations by the web server's process user on the host system.

  • GET /admin_media/..
  • %2e%2e%2f
  • %2e%2e/
  • ../
  • ..%2f

What your security team should do

  • Immediately scan for and identify all applications using vulnerable Django versions (1.0 and 0.96) and prioritize them for remediation.
  • Upgrade affected Django instances to a patched version (1.0.1+ or 0.96.5+), or preferably, migrate the application to a currently supported long-term support (LTS) release of Django.
  • If an immediate upgrade is not possible, deploy a Web Application Firewall (WAF) rule to block directory traversal attempts (e.g., requests containing '../' or '%2e%2e%2f') as an interim mitigation.
  • Review web server access logs for historical evidence of exploitation attempts targeting this vulnerability.

The record

The Admin media handler in core/servers/basehttp.py in Django 1.0 and 0.96 does not properly map URL requests to expected "static media files," which allows remote attackers to conduct directory traversal attacks and read arbitrary files via a crafted URL.

Affected packages

Ecosystem Package Introduced Fixed
PyPI django 0 1.1
PyPI django 0.96.0 0.96.4
PyPI django 1.0 1.0.3
Debian:10 python-django 0 1.1-1
Debian:11 python-django 0 1.1-1
Debian:12 python-django 0 1.1-1
Debian:13 python-django 0 1.1-1
pypi Django 0.96.0 No fix
pypi Django 1.0 No fix

Related vulnerabilities