MobSF / Mobile-Security-Framework-MobSF

Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis.
https://opensecurity.in
GNU General Public License v3.0
17.51k stars 3.24k forks source link

Dynamic Analyzer, first run error due to absence of certificate #1326

Closed ajinabraham closed 4 years ago

ajinabraham commented 4 years ago

ENVIRONMENT

OS and Version: All
Python Version: All
MobSF Version: 3.0.5

EXPLANATION OF THE ISSUE

When Dynamic Analysis is attempted first time, MobSFy fails since mitmproxy ca certs are not created just yet.

* daemon started successfully
[INFO] 16/Mar/2020 14:14:21 - ADB Restarted
[INFO] 16/Mar/2020 14:14:21 - Waiting for 2 seconds...
[INFO] 16/Mar/2020 14:14:23 - Connecting to Android ********:5555
[INFO] 16/Mar/2020 14:14:23 - Waiting for 2 seconds...
[INFO] 16/Mar/2020 14:14:25 - Restarting ADB Daemon as root
[INFO] 16/Mar/2020 14:14:25 - Waiting for 2 seconds...
[INFO] 16/Mar/2020 14:14:27 - Reconnect to Android Device
[INFO] 16/Mar/2020 14:14:28 - Waiting for 2 seconds...
[INFO] 16/Mar/2020 14:14:30 - Remounting /system
[INFO] 16/Mar/2020 14:14:30 - Android Version identified as 6.0
[INFO] 16/Mar/2020 14:14:30 - Environment MobSFyed Check
[WARNING] 16/Mar/2020 14:14:30 - This Android instance is not MobSfyed.
MobSFying the android runtime environment
[INFO] 16/Mar/2020 14:14:30 - Android Version identified as 6.0
[INFO] 16/Mar/2020 14:14:30 - Android instance architecture identified as x86
[INFO] 16/Mar/2020 14:14:30 - Copying frida server
[ERROR] 16/Mar/2020 14:14:34 - Failed to MobSFy Android Instance
Traceback (most recent call last):
  File "C:\*******\DynamicAnalyzer\views\android\environment.py", line 336, in mobsfy_init
    self.mobsf_agents_setup('frida')
  File "C:\*******\DynamicAnalyzer\views\android\environment.py", line 346, in mobsf_agents_setup
    self.install_mobsf_ca('install')
  File "C:\*******\DynamicAnalyzer\views\android\environment.py", line 123, in install_mobsf_ca
    pem = open(get_ca_dir(), 'rb').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\*****\\.mitmproxy\\mitmproxy-ca-cert.pem'
[ERROR] 16/Mar/2020 14:14:34 - Failed to MobSFy the instance
[ERROR] 16/Mar/2020 14:14:34 - Internal Server Error: /android_dynamic/
ERROR:django.request:Internal Server Error: /android_dynamic/

STEPS TO REPRODUCE THE ISSUE

Install MobSF on a fresh system with no mitmproxy installed.
Try Dynamic Analysis -> MobSFy

LOG FILE

Paste the contents of logs/debug.log here or attach the log file.
ajinabraham commented 4 years ago

Should be fixed in 3.0.6