django-s3file CVE-2026-42196
CRITICALAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSend HTTP POST to upload endpoint
-
DeliveryInject path traversal in file parameter
-
ExploitS3FileMiddleware loads arbitrary S3 object
-
ExecutionMalicious file appears in request.FILES
-
PersistApplication processes file as legitimate upload
-
ImpactConfidential data exposed or integrity compromised
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Relative path traversal prevention
|
| Exploitation Conditions | Exploitation requires that the target Django application uses S3FileMiddleware from django-s3file <=7.0.1 to process file uploads. Attacker must be able to send HTTP requests to endpoints using this middleware, which depends on application-specific access controls-if upload endpoints require authentication, attacker needs valid credentials; if publicly accessible (e.g., anonymous upload features), no authentication is needed. Attacker must have knowledge or ability to guess the S3 bucket structure and target file paths beyond the upload directory to construct effective traversal payloads. Impact is limited to files accessible via the S3 IAM role/credentials used by the Django application-attacker cannot traverse beyond bucket permissions. Vulnerability does not require non-default Django configurations, but exploitation success depends on how the application subsequently handles files loaded into request.FILES (automatic processing increases risk vs. manual admin review). |
| Impact | Real-world risk is MODERATE but highly context-dependent. Without CVSS metrics or EPSS scoring, assessment relies on vulnerability class analysis and vendor advisory. Path traversal (CWE-23) typically enables unauthorized file access, but actual impact depends on three application-specific factors: (1) what data resides in the S3 bucket beyond upload directories, (2) how the Django application processes files loaded into request.FILES (read-only display vs. execution vs. database storage), and (3) whether authentication gates the vulnerable middleware. Confidentiality risk: attackers may retrieve sensitive files from S3 (credentials, backups, user data) if stored in the same bucket. Integrity risk: if application logic trusts file origins, malicious content from unexpected S3 paths could corrupt databases or trigger unsafe operations. LIMITING FACTORS: exploitation requires knowledge of S3 bucket structure and target file paths (not blind traversal), and impact is bounded by S3 IAM permissions and Django application logic. No evidence of public exploit code or active exploitation. Priority: MEDIUM for applications handling sensitive files in S3; LOWER for isolated upload-only implementations with read-only public content. |
| Exploit ScenarioDerived | An attacker identifies a Django application using django-s3file for handling file uploads to an S3 bucket containing both user uploads (s3://bucket/uploads/) and sensitive application data (s3://bucket/config/secrets.json). The attacker intercepts or crafts an HTTP request to the upload endpoint, modifying the file path parameter from 'uploads/user123/photo.jpg' to '../config/secrets.json'. The vulnerable S3FileMiddleware processes this manipulated path without proper canonicalization, retrieves secrets.json from S3, and populates it into request.FILES. The application's file processing logic then inadvertently exposes the secrets file content in the HTTP response or stores it in a publicly accessible location, resulting in credential disclosure. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 05, 2026
Path traversal in django-s3file's S3FileMiddleware allows attackers to manipulate HTTP requests and force Django applications to load arbitrary files from unintended S3 locations into request.FILES, bypassing pre-signed upload location restrictions. Affects all versions <=7.0.1. Vendor-confirmed vulnerability with patch released in version 7.0.2. No active exploitation confirmed (not in CISA KEV). CVSS metrics not available, but path traversal combined with file handling operations presents moderate confidentiality and integrity risk depending on application-specific file processing logic.
RemediationAI
Immediately upgrade django-s3file to version 7.0.2 or later using pip install --upgrade django-s3file==7.0.2 or updating requirements.txt and redeploying. Vendor advisory confirms version 7.0.2 contains the fix for path validation in S3FileMiddleware (https://github.com/codingjoe/django-s3file/security/advisories/GHSA-67qg-7284-2277). If immediate upgrade is not feasible, implement compensating controls: (1) add custom middleware before S3FileMiddleware to validate and sanitize file path parameters, rejecting requests containing '../', encoded traversal sequences, or paths resolving outside expected prefixes; (2) restrict S3 bucket IAM policies to enforce least-privilege access scoping uploaded objects to specific prefixes, limiting traversal impact; (3) implement additional application-layer validation on request.FILES to verify file origins match expected S3 keys before processing. Note that workarounds do not eliminate the vulnerability and may interfere with legitimate file upload workflows; upgrading remains the definitive remediation.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Django-s3file is a Python middleware library that facilitates direct S3 uploads in Django applications by handling pre-signed S3 URLs and populating request.FILES with uploaded content. The vulnerability resides in S3FileMiddleware's input validation logic, specifically CWE-23 (Relative Path Traversal). The middleware fails to properly sanitize or canonicalize file path parameters in HTTP requests before retrieving files from S3. Attackers can inject relative path sequences (likely '../' traversal patterns) to escape the intended pre-signed upload directory scope and reference arbitrary S3 objects within the bucket or accessible storage. This allows unauthorized file access outside the application's expected upload boundaries, violating the security contract of pre-signed URLs which should restrict uploads to specific object keys.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:H/SI:H/SA:N
Primary rating from Vendor (https://github.com/codingjoe/django-s3file) · only source for this CVE.
CVSS VectorVendor: https://github.com/codingjoe/django-s3file
Lifecycle Timeline
1DescriptionCVE.org
Impact
S3FileMiddleware is vulnerable to relative path traversal attacks, where an attacker can use a modified request to escape pre-signed upload locations and have the Django application load files from random locations into request.FILES
Depending on how files are handled, this may lead to confidentiality and integrity issues.
Patches
Django-S3File urges all users to update to a patched version >=7.0.2.
Executive ViewAI
django-s3file versions 7.0.1 and earlier contain a path traversal vulnerability in S3FileMiddleware that allows attackers to bypass upload location restrictions and force applications to load arbitrary files from unintended S3 locations, potentially exposing sensitive data or enabling malicious file injection into application workflows. Organizations using this library risk unauthorized file access and integrity compromise unless immediate patching is applied.
Vendor-released patch: django-s3file 7.0.2. Until patching: Implement restrictive S3 bucket policies that explicitly deny requests outside intended upload prefixes; add application-level path validation and normalization before file processing; monitor S3 access logs for anomalous file load patterns; disable S3FileMiddleware if not actively required and use alternative secure file handling mechanisms.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Affected Products (CPE)CVE.org
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
GHSA-67qg-7284-2277
NVD
CVE.org
EPSS
Exploit-DB