Skip to content

Stored Cross-Site Scripting Vulnerability in Recent Scans "Diff or Compare"

High
ajinabraham published GHSA-5jc6-h9w7-jm3p Dec 3, 2024 · 1 comment

Package

MobSF/Mobile-Security-Framework-MobSF

Affected versions

<=4.2.8

Patched versions

4.2.9
pip mobsf (pip)
<=4.2.8
4.2.9

Description

Summary

The application allows users to upload files with scripts in the filename parameter. As a result, a malicious user can upload a script file to the system. When users in the application use the "Diff or Compare" functionality, they are affected by a Stored Cross-Site Scripting vulnerability.

Details

I found a Stored Cross-Site Scripting vulnerability in the "Diff or Compare" functionality. This issue occurs because the upload functionality allows users to upload files with special characters such as <, >, /, and " in the filename. This vulnerability can be mitigated by restricting file uploads to filenames containing only whitelisted characters, such as A-Z, 0-9, and specific special characters permitted by business requirements, like - or _ .

PoC

Complete instructions, including specific configuration details, to reproduce the vulnerability.

  1. On MobSF version 4.2.8, I clicked on "Unload & Analyze" button.
    0

  2. I uploaded zip file as a name test.zip.
    1

  3. I used an intercepting proxy tool while uploading a file and changed the value of the filename parameter from test.zip to <image src onerror=prompt(document.domain)>test.zip. This means I uploaded a file and set its name to a script value. As a result, the server allowed the file to be uploaded successfully.
    2

  4. I accessed /recent_scans/ and found a file named <image src onerror=prompt(document.domain)>test.zip in the recent scans. Then, I clicked on the "Differ or Compare" button."
    3

  5. I found that the application requires selecting a file to compare, and I selected the file <image src onerror=prompt(document.domain)>test.zip
    4

  6. I found that the JavaScript in the filename value was executed in the web browser.
    5

Impact

Allowing a malicious user to upload a script in the filename parameter can be used to steal information from other users or administrators when they perform the compare functionality. The script will be stored in the system permanently in this vulnerability.

@ajinabraham
Copy link
Member

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N

CVE ID

CVE-2024-53999

Weaknesses

Credits