CVE-2024-43399: Mobile Security Framework (MobSF) has a Zip Slip Vulnerability in .a Static Library Files

Published Aug 19, 2024
·
Updated

Summary Upon 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.

Since the implemented measure can be bypassed, the vulnerability allows an attacker to extract files to any desired location within the server running MobSF.

Details

Upon examining lines 183-192 of the mobsf/StaticAnalyzer/views/common/sharedfunc.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.

<img width="448" alt="image" src="https://github.com/user-attachments/assets/fadf4bcc-1a92-4655-b66a-5349278ad9c5">

For 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.

<img width="300" alt="poc a1" src="https://github.com/user-attachments/assets/54acf101-3931-401f-9970-a0934265eecb">

I am including the binary used for the POC named poc.VULN. To test it, you need to rename this binary to poc.a.

Warning: As soon as you scan this file with MobSF, the database will be deleted, rendering MobSF unusable.

PoC Binary File (poc.VULN)

PoC

https://github.com/user-attachments/assets/3225ccb0-cb00-47a5-8305-37a40ca1ae7f

Impact

When 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.

Other sources

Mobile Security Framework (MobSF) is a pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis. Before 4.0.7, there is 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. Since the implemented measure can be bypassed, the vulnerability allows an attacker to extract files to any desired location within the server running MobSF. This vulnerability is fixed in 4.0.7.

MITRE

Affected Software

2 affected componentsFixes available
pip/mobsf<=4.0.6
4.0.7
Opensecurity Mobile Security Framework<4.0.7

Event History

Aug 19, 2024
CVE Published
via MITRE·02:44 PM
Data Sourced
via MITRE·02:44 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·05:29 PM

Frequently Asked Questions

1

What is the severity of CVE-2024-43399?

CVE-2024-43399 is considered to be a significant security vulnerability due to its potential for Zip Slip attacks.

2

How do I fix CVE-2024-43399?

To fix CVE-2024-43399, upgrade to MobSF version 4.0.7 or higher.

3

Which versions of MobSF are affected by CVE-2024-43399?

CVE-2024-43399 affects MobSF versions up to and including 4.0.6.

4

What component of MobSF is impacted by CVE-2024-43399?

CVE-2024-43399 impacts the Static Libraries analysis section during the extraction of .a extension files.

5

What type of attack is CVE-2024-43399 associated with?

CVE-2024-43399 is associated with Zip Slip attacks due to improper implementation of preventive measures.

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