CVE-2024-43399: Mobsf Mobile Security Framework (MobSF) Has Vulnerability
HIGHCVE-2024-43399 is a HIGH (CVSS 8.0) mobile security framework (mobsf) has vulnerability (CWE-23: Relative Path Traversal) affecting Mobsf libraries in the PyPI ecosystem. The issue involves mobile security framework (mobsf) has a zip slip vulnerability in .a static library files. Remediation is available by upgrading affected packages to version 4.0.7.
CVE-2024-43399 at a Glance
Security Impact
CVSS: 8.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-43399
To remediate this vulnerability, upgrade all affected Mobsf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install mobsf>=4.0.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show mobsf
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-43399, inspect your installed packages using pip:
pip show mobsf
Analyze the terminal output to locate any version of Mobsf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.7), your application is affected.
Note: The pip show mobsf command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Mobsf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-43399 Affected Mobsf Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
mobsf
|
PyPI |
< 4.0.7
|
4.0.7
|
References
Frequently Asked Questions
What is CVE-2024-43399?
Which Mobsf versions are affected?
What version fixes CVE-2024-43399?
Is mobsf affected?
What is the CVSS score of CVE-2024-43399?
What CWE is associated with CVE-2024-43399?
How can I check PyPI dependencies for CVE-2024-43399?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4hh3-vj32-gr6j",
"modified" : "2024-08-19T17:29:52Z",
"published" : "2024-08-19T17:29:52Z",
"aliases" : [ "CVE-2024-43399" ],
"summary" : "Mobile Security Framework (MobSF) has a Zip Slip Vulnerability in .a Static Library Files",
"details" : "### Summary\nUpon reviewing the MobSF source code, I identified a flaw in the Static Libraries analysis section. Specifically, during the extraction of .a extension files, the measure intended to prevent Zip Slip attacks is improperly implemented.\n\nSince the implemented measure can be bypassed, the vulnerability allows an attacker to extract files to any desired location within the server running MobSF.\n\n### Details\n\nUpon examining lines 183-192 of the `mobsf/StaticAnalyzer/views/common/shared_func.py` file, it is observed that there is a mitigation against Zip Slip attacks implemented as `a.decode('utf-8', 'ignore').replace('../', '').replace('..\\\\', '')`. However, this measure can be bypassed using sequences like `....//....//....//`. Since the replace operation is not recursive, this sequence is transformed into `../../../` after the replace operation, allowing files to be written to upper directories.\n\n<img width=\"448\" alt=\"image\" src=\"https://github.com/user-attachments/assets/fadf4bcc-1a92-4655-b66a-5349278ad9c5\">\n\n\nFor the proof of concept, I created an .a archive file that renders MobSF unusable by writing an empty file with the same name over the database located at `/home/mobsf/.MobSF/db.sqlite3`.\n\n<img width=\"300\" alt=\"poc a_1\" src=\"https://github.com/user-attachments/assets/54acf101-3931-401f-9970-a0934265eecb\">\n\n\nI am including the binary used for the POC named `poc.VULN`. To test it, you need to rename this binary to `poc.a`.\n\n **Warning:** As soon as you scan this file with MobSF, the database will be deleted, rendering MobSF unusable.\n\nPoC Binary File ([poc.VULN](https://drive.google.com/file/d/1K2eHYIZ1hUbs-Vi5zhKAKecnd0nDB8lO/view?usp=share_link))\n\n### PoC\n\n\nhttps://github.com/user-attachments/assets/3225ccb0-cb00-47a5-8305-37a40ca1ae7f\n\n\n\n### Impact\n\nWhen a malicious .a file is scanned with MobSF, a critical vulnerability is present as it allows files to be extracted to any location on the server where MobSF is running. In this POC, I deleted the database, but it is also possible to achieve RCE by overwriting binaries of certain tools or by overwriting the /etc/passwd file.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "mobsf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.0.6"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF/security/advisories/GHSA-4hh3-vj32-gr6j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-43399"
}, {
"type" : "WEB",
"url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF/commit/cc625fe8430f3437a473e82aa2966d100a4dc883"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/MobSF/Mobile-Security-Framework-MobSF"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-23" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-08-19T17:29:52Z",
"nvd_published_at" : "2024-08-19T15:15:09Z"
}
}