CVE-2025-59682: CWE-23 Relative Path Traversal in djangoproject Django
An issue was discovered in Django 4.2 before 4.2.25, 5.1 before 5.1.13, and 5.2 before 5.2.7. The django.utils.archive.extract() function, used by the "startapp --template" and "startproject --template" commands, allows partial directory traversal via an archive with file paths sharing a common prefix with the target directory.
AI Analysis
Technical Summary
CVE-2025-59682 is a relative path traversal vulnerability classified under CWE-23, discovered in the Django web framework versions 4.2 prior to 4.2.25, 5.1 prior to 5.1.13, and 5.2 prior to 5.2.7. The vulnerability resides in the django.utils.archive.extract() function, which is invoked by the 'startapp --template' and 'startproject --template' management commands. This function extracts archive files to create new Django apps or projects based on templates. The flaw allows an attacker to craft archive files containing file paths that share a common prefix with the target extraction directory but include relative path components (e.g., '../') that enable partial directory traversal. This can cause files to be extracted outside the intended directory, potentially overwriting or injecting files in unintended locations. The vulnerability requires the attacker to supply a malicious archive to the affected commands, which typically requires some level of access to the development or deployment environment. The CVSS v3.1 base score is 3.1, indicating low severity, with attack vector network, attack complexity high, privileges required low, no user interaction, unchanged scope, no confidentiality impact, limited integrity impact, and no availability impact. No known exploits have been reported in the wild. The vulnerability primarily affects development workflows or automated deployment pipelines that use these Django commands with untrusted archive templates. Without proper patching, attackers with limited privileges could manipulate project files, potentially leading to code injection or configuration tampering in specific scenarios.
Potential Impact
For European organizations, the impact of CVE-2025-59682 is generally low but non-negligible. Organizations using Django in their software development lifecycle, especially those leveraging the 'startapp --template' and 'startproject --template' commands with external or untrusted archive templates, could face risks of unauthorized file overwrites or injection. This could lead to integrity issues in source code or configuration files, potentially enabling further exploitation such as code execution if combined with other vulnerabilities or misconfigurations. The vulnerability does not affect confidentiality or availability directly, limiting its impact scope. However, in environments where development and deployment pipelines are automated and rely on template archives, the risk of supply chain compromise or insider threats exploiting this vulnerability increases. European organizations with strong software development sectors, including financial services, government, and technology companies, should be aware of this risk to avoid disruptions or breaches stemming from compromised Django projects. The absence of known exploits reduces immediate risk but does not eliminate the need for proactive mitigation.
Mitigation Recommendations
1. Upgrade Django to the fixed versions: 4.2.25 or later, 5.1.13 or later, or 5.2.7 or later, as applicable. 2. Avoid using untrusted or unauthenticated archive templates with the 'startapp --template' and 'startproject --template' commands. 3. Implement strict access controls on development and deployment environments to limit who can supply or modify template archives. 4. Use file system permissions and sandboxing to restrict where files can be extracted during template processing, preventing writes outside intended directories. 5. Incorporate integrity checks or cryptographic signatures on template archives to ensure authenticity and prevent tampering. 6. Monitor development and CI/CD pipelines for unusual file changes or unexpected archive usage. 7. Educate developers and DevOps teams about the risks of using external templates and the importance of applying security patches promptly. 8. Review and harden automated deployment scripts that invoke Django template commands to ensure they do not process untrusted inputs.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden, Finland, Ireland
CVE-2025-59682: CWE-23 Relative Path Traversal in djangoproject Django
Description
An issue was discovered in Django 4.2 before 4.2.25, 5.1 before 5.1.13, and 5.2 before 5.2.7. The django.utils.archive.extract() function, used by the "startapp --template" and "startproject --template" commands, allows partial directory traversal via an archive with file paths sharing a common prefix with the target directory.
AI-Powered Analysis
Technical Analysis
CVE-2025-59682 is a relative path traversal vulnerability classified under CWE-23, discovered in the Django web framework versions 4.2 prior to 4.2.25, 5.1 prior to 5.1.13, and 5.2 prior to 5.2.7. The vulnerability resides in the django.utils.archive.extract() function, which is invoked by the 'startapp --template' and 'startproject --template' management commands. This function extracts archive files to create new Django apps or projects based on templates. The flaw allows an attacker to craft archive files containing file paths that share a common prefix with the target extraction directory but include relative path components (e.g., '../') that enable partial directory traversal. This can cause files to be extracted outside the intended directory, potentially overwriting or injecting files in unintended locations. The vulnerability requires the attacker to supply a malicious archive to the affected commands, which typically requires some level of access to the development or deployment environment. The CVSS v3.1 base score is 3.1, indicating low severity, with attack vector network, attack complexity high, privileges required low, no user interaction, unchanged scope, no confidentiality impact, limited integrity impact, and no availability impact. No known exploits have been reported in the wild. The vulnerability primarily affects development workflows or automated deployment pipelines that use these Django commands with untrusted archive templates. Without proper patching, attackers with limited privileges could manipulate project files, potentially leading to code injection or configuration tampering in specific scenarios.
Potential Impact
For European organizations, the impact of CVE-2025-59682 is generally low but non-negligible. Organizations using Django in their software development lifecycle, especially those leveraging the 'startapp --template' and 'startproject --template' commands with external or untrusted archive templates, could face risks of unauthorized file overwrites or injection. This could lead to integrity issues in source code or configuration files, potentially enabling further exploitation such as code execution if combined with other vulnerabilities or misconfigurations. The vulnerability does not affect confidentiality or availability directly, limiting its impact scope. However, in environments where development and deployment pipelines are automated and rely on template archives, the risk of supply chain compromise or insider threats exploiting this vulnerability increases. European organizations with strong software development sectors, including financial services, government, and technology companies, should be aware of this risk to avoid disruptions or breaches stemming from compromised Django projects. The absence of known exploits reduces immediate risk but does not eliminate the need for proactive mitigation.
Mitigation Recommendations
1. Upgrade Django to the fixed versions: 4.2.25 or later, 5.1.13 or later, or 5.2.7 or later, as applicable. 2. Avoid using untrusted or unauthenticated archive templates with the 'startapp --template' and 'startproject --template' commands. 3. Implement strict access controls on development and deployment environments to limit who can supply or modify template archives. 4. Use file system permissions and sandboxing to restrict where files can be extracted during template processing, preventing writes outside intended directories. 5. Incorporate integrity checks or cryptographic signatures on template archives to ensure authenticity and prevent tampering. 6. Monitor development and CI/CD pipelines for unusual file changes or unexpected archive usage. 7. Educate developers and DevOps teams about the risks of using external templates and the importance of applying security patches promptly. 8. Review and harden automated deployment scripts that invoke Django template commands to ensure they do not process untrusted inputs.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- mitre
- Date Reserved
- 2025-09-18T00:00:00.000Z
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 68dd78861b22ab5635985427
Added to database: 10/1/2025, 6:52:54 PM
Last enriched: 11/4/2025, 10:14:03 PM
Last updated: 11/16/2025, 7:49:57 PM
Views: 72
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-13251: SQL Injection in WeiYe-Jing datax-web
MediumCVE-2025-13250: Improper Access Controls in WeiYe-Jing datax-web
MediumCVE-2025-13249: Unrestricted Upload in Jiusi OA
MediumCVE-2025-13248: SQL Injection in SourceCodester Patients Waiting Area Queue Management System
MediumCVE-2025-13247: SQL Injection in PHPGurukul Tourism Management System
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.