sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.46k stars 854 forks source link

Non-Rooted Android Device : unable to find process with name 'system_server' #424

Closed ganesh2183 closed 3 years ago

ganesh2183 commented 3 years ago

Using Non-Rooted Android Device for testing, patched apk file using below command

objection patchapk --source "C:\AndroidTesting\apps\diva-beta.apk" --architecture armeabi-v7a
Using latest Github gadget version: 14.0.8
Patcher will be using Gadget version: 14.0.8
Detected apktool version as: 2.4.1
Running apktool empty-framework-dir...
I: Removing 1.apk framework file...
Press any key to continue . . .
Unpacking C:\AndroidTesting\apps\diva-beta.apk
App already has android.permission.INTERNET
Target class not specified, searching for launchable activity instead...
Reading smali from: C:\Users\W1BABUG\AppData\Local\Temp\tmpfhoa5y2s.apktemp\smali\jakhar/aseem/diva/MainActivity.smali
Injecting loadLibrary call at line: 6
Attempting to fix the constructors .locals count
Current locals value is 0, updating to 1:
Writing patched smali back to: C:\Users\W1BABUG\AppData\Local\Temp\tmpfhoa5y2s.apktemp\smali\jakhar/aseem/diva/MainActivity.smali
Copying Frida gadget to libs path...
Rebuilding the APK with the frida-gadget loaded...
Built new APK with injected loadLibrary and frida-gadget
Signing new APK.
Signed the new APK
Performing zipalign
Zipalign completed
Copying final apk from C:\Users\W1BABUG\AppData\Local\Temp\tmpfhoa5y2s.apktemp.aligned.objection.apk to C:\AndroidTesting\apps\diva-beta.objection.apk in current directory...
Cleaning up temp files...

Installed patched apk using adb command:

adb install "C:\AndroidTesting\apps\diva-beta.objection.apk"
Performing Streamed Install
Success

After installation when I open the app in android device, I m getting error message as "Diva has stopped, Close App"

Python version: 3.7.7 Frida version: 14.0.8 OS: Windows 10

frida-ps -U
Waiting for USB device to appear...
  PID  Name
-----  ------------
 8612  app_process
 8798  frida-server
 8800  logcat
20365  logcat
20368  logcat
21086  pmas
20356  sh

When I run below command I m getting error message,

frida-ps -Uia
Waiting for USB device to appear...
Failed to enumerate applications: unable to find process with name 'system_server'
objection explore
Using USB device `SM-G955U`
Traceback (most recent call last):
  File "C:\Program Files\Python37\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python37\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python37\Scripts\objection.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python37\Lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Program Files\Python37\Lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Program Files\Python37\Lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Program Files\Python37\Lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Program Files\Python37\Lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Program Files\Python37\Lib\site-packages\objection\console\cli.py", line 114, in explore
    agent.inject()
  File "C:\Program Files\Python37\Lib\site-packages\objection\utils\agent.py", line 202, in inject
    session = self.get_session()
  File "C:\Program Files\Python37\Lib\site-packages\objection\utils\agent.py", line 166, in get_session
    self.spawned_pid = self.device.spawn(state_connection.gadget_name)
  File "C:\Program Files\Python37\Lib\site-packages\frida\core.py", line 26, in wrapper
    return f(*args, **kwargs)
  File "C:\Program Files\Python37\Lib\site-packages\frida\core.py", line 140, in spawn
    return self._impl.spawn(program, argv, envp, env, cwd, stdio, aux_options)
frida.ProcessNotFoundError: unable to find process with name 'system_server'

How to fix this issue ??

leonjza commented 3 years ago

Please try using vanilla Frida first here. If that works and objection still fails, feel free to open a new issue.