CVE-2022-24840
📋 TL;DR
CVE-2022-24840 is a path traversal vulnerability in django-s3file that allows attackers to access or delete files across an entire AWS S3 bucket. All users of django-s3file versions before 5.5.1 are affected, particularly those using the library for file uploads in Django applications with Amazon S3 storage.
💻 Affected Systems
- django-s3file
📦 What is this software?
Django S3file by Django S3file Project
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of all files in the S3 bucket, including sensitive data exposure, data deletion, and potential service disruption.
Likely Case
Unauthorized access to sensitive files stored in S3, potentially including user uploads, configuration files, or application data.
If Mitigated
Limited impact if AWS_LOCATION setting restricts traversal scope, but still potential access to files within that location.
🎯 Exploit Status
The vulnerability was discovered by the maintainer with no reports of third-party exploitation prior to patch release.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 5.5.1 and above
Vendor Advisory: https://github.com/codingjoe/django-s3file/security/advisories/GHSA-4w8f-hjm9-xwgf
Restart Required: Yes
Instructions:
1. Update django-s3file package using pip: pip install django-s3file>=5.5.1
2. Restart your Django application
3. Verify the update with: pip show django-s3file
🔧 Temporary Workarounds
No feasible workaround
allThe maintainer states there is no feasible workaround for this vulnerability.
🧯 If You Can't Patch
- Implement strict S3 bucket policies to limit access and prevent deletion operations
- Enable S3 bucket versioning and MFA delete to protect against data loss
🔍 How to Verify
Check if Vulnerable:
Check django-s3file version: pip show django-s3file | grep Version
Check Version:
pip show django-s3file | grep Version
Verify Fix Applied:
Confirm version is 5.5.1 or higher: pip show django-s3file | grep Version
📡 Detection & Monitoring
Log Indicators:
- Unusual S3 access patterns, unexpected file deletions, access attempts outside expected paths
Network Indicators:
- HTTP requests to django-s3file endpoints with path traversal patterns
SIEM Query:
source="aws:s3" AND (eventName="DeleteObject" OR eventName="GetObject") AND errorCode IS NULL AND userAgent CONTAINS "django-s3file"
🔗 References
- https://github.com/codingjoe/django-s3file/commit/68ccd2c621a40eb66fdd6af2be9d5fcc9c373318
- https://github.com/codingjoe/django-s3file/security/advisories/GHSA-4w8f-hjm9-xwgf
- https://github.com/codingjoe/django-s3file/commit/68ccd2c621a40eb66fdd6af2be9d5fcc9c373318
- https://github.com/codingjoe/django-s3file/security/advisories/GHSA-4w8f-hjm9-xwgf