Cloudanix VulnDB

CVE-2014-0474

None

CVSS

—

EPSS

4.9%

Published

Apr 23, 2014

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A flaw in the web application framework could allow an unauthenticated attacker to manipulate the underlying database by sending unexpected data types, potentially leading to a complete system compromise.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Full Compromise
Component
Web Framework
Class
Improper Input Validation
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The vulnerability exists in specific Django model field classes (FilePathField, GenericIPAddressField, and IPAddressField) which fail to properly perform type conversion before sending data to a MySQL database. An attacker can submit specially crafted input that, due to MySQL's lenient typecasting rules, is interpreted differently than intended by the application logic. This can bypass data validation and security controls, potentially leading to information disclosure, data manipulation, or even SQL injection, allowing for arbitrary code execution or full database compromise.

Why it matters to the business

An attacker exploiting this vulnerability could gain complete control over the application's database, leading to a severe data breach, unauthorized modification of critical information, or complete service disruption. This can result in significant financial losses, regulatory fines, reputational damage, and loss of customer trust. The impact is critical as it could allow an attacker to read, alter, or delete any data the application has access to.

How an attack unfolds

A remote, unauthenticated attacker first identifies a public-facing web application built with a vulnerable version of the Django framework and backed by a MySQL database. The attacker then locates an input field that corresponds to a FilePathField, GenericIPAddressField, or IPAddressField in the application's data model. By submitting a carefully crafted value that is not of the expected data type (e.g., a boolean value or a string that can be interpreted as a number or SQL syntax), the attacker abuses the lack of proper type conversion in Django. The malformed data is passed to the MySQL database, which then applies its own lenient typecasting rules. This can cause the database query to behave in an unintended manner, allowing the attacker to bypass security checks, retrieve sensitive data, modify records, or potentially execute arbitrary SQL commands, leading to a full compromise of the database.

How to fix it

The primary remediation is to upgrade the Django framework to a patched version. Developers should update their applications to use Django 1.4.11 or later, 1.5.6 or later, 1.6.3 or later, or 1.7 beta 2 or later. For systems using package managers, ensure the installed Django package meets or exceeds these versions. For example, for Ubuntu 16.04 LTS, the ntopng package should be upgraded to version '2.2+dfsg1-1build1' or newer. For Debian 13, ntopng should be upgraded to '2.2+dfsg1-1' or newer. If an immediate upgrade is not possible, a web application firewall (WAF) could be configured to strictly validate input types for fields known to be vulnerable, but this should be considered a temporary mitigation, not a complete fix.

How to confirm the fix worked

To validate the remediation, check the installed version of the Django framework in your application's environment. This can typically be done by running `python -m django --version` or checking the project's dependency files (e.g., `requirements.txt`). Ensure the version is 1.4.11+, 1.5.6+, 1.6.3+, or 1.7 beta 2+. You can also check the version of dependent packages like `ntopng` using system package managers (e.g., `dpkg -l | grep ntopng` on Debian/Ubuntu) and verify it matches or exceeds the fixed versions specified by the vendor. Automated dependency scanning tools can also be used to identify vulnerable Django versions within your software supply chain.

Typical attack path

  1. Attacker identifies a target web application running a vulnerable version of Django with a MySQL backend.
  2. Attacker probes the application's input forms to find one that maps to a FilePathField, GenericIPAddressField, or IPAddressField.
  3. Attacker crafts a malicious payload, such as a boolean value or a string that exploits MySQL's typecasting behavior.
  4. Attacker submits the malicious payload through the identified input field.
  5. The Django application passes the value to the database without proper type validation.
  6. The MySQL database misinterprets the value due to its typecasting rules, altering the logic of the SQL query.
  7. The altered query execution leads to information disclosure, data modification, or potential SQL injection.

How to detect it

To detect potential exploitation, security teams should review web server access logs (e.g., Apache, Nginx) and application logs for HTTP requests containing unusual data in fields that should contain file paths or IP addresses. Look for inputs such as boolean values (`true`, `false`), integers (`0`, `1`), or SQL-like syntax being sent to these fields. Additionally, if database query logging is enabled on the MySQL server, review the logs for malformed or unexpected queries originating from the Django application that involve `FilePathField`, `GenericIPAddressField`, or `IPAddressField` lookups. Anomalies in query structure or unexpected `WHERE` clause evaluations could indicate an exploitation attempt.

What your security team should do

  • Immediately patch all applications using vulnerable Django versions to the latest secure release, as this critical, remotely exploitable vulnerability can lead to a full system compromise.
  • Use dependency analysis tools and vulnerability scanners to identify all instances of vulnerable Django versions across your application portfolio.
  • If patching cannot be performed immediately, implement strict input validation rules in a Web Application Firewall (WAF) to block non-standard data types (e.g., booleans, non-IP strings) from being submitted to fields expecting file paths or IP addresses as a temporary compensating control.

The record

The (1) FilePathField, (2) GenericIPAddressField, and (3) IPAddressField model field classes in Django before 1.4.11, 1.5.x before 1.5.6, 1.6.x before 1.6.3, and 1.7.x before 1.7 beta 2 do not properly perform type conversion, which allows remote attackers to have unspecified impact and vectors, related to "MySQL typecasting."

Affected packages

Ecosystem Package Introduced Fixed
PyPI django 0 1.4.11
PyPI django 1.5 1.5.6
PyPI django 1.5.0 1.5.6
PyPI django 1.6 1.6.3
PyPI django 1.6.0 1.6.3
Debian:11 python-django 0 1.6.3-1
Debian:12 python-django 0 1.6.3-1
Debian:13 python-django 0 1.6.3-1
Debian:6.0 python-django 0 1.2.3-3+squeeze10
Debian:7 python-django 0 1.4.5-1+deb7u7
Mageia:3 python-django 0 1.4.11-1.1.mga3
Mageia:4 python-django 0 1.5.6-1.1.mga4
Mageia:4 python-django14 0 1.4.11-1.1.mga4
Red Hat:openstack:3::el6 Django14 0 0:1.4.11-1.el6ost
Red Hat:openstack:3::el6 Django14-doc 0 0:1.4.11-1.el6ost
Red Hat:openstack:4::el6 Django14 0 0:1.4.11-1.el6ost
Red Hat:openstack:4::el6 Django14-doc 0 0:1.4.11-1.el6ost
Ubuntu:14.04:LTS python-django 0 1.6.1-2ubuntu0.1
pypi Django 1.5 No fix
pypi Django 1.6 No fix

Related vulnerabilities