sensepost / objection

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

[bug] Problems with frida and frida scripts "unable to handle 64-bit processes due to build configuration" #522

Closed xopham closed 3 weeks ago

xopham commented 2 years ago

Describe the bug I am running an android smartphone using Genymotion, pushing and starting the frida server and then connecting via objection (installed in virtualenv) using objection --gadget org.myorg.myapp explore. However, already the command frida fails:

org.myorg.myapp on (Android: 10) [usb] # frida
An unexpected internal exception has occurred. If this looks like a code related error, please file a bug report!
'filename'

Python stack trace: Traceback (most recent call last):
  File "/home/me/.venv/lib/python3.8/site-packages/objection/console/repl.py", line 371, in start_repl
    self.run_command(document)
  File "/home/me/.venv/lib/python3.8/site-packages/objection/console/repl.py", line 185, in run_command
    exec_method(arguments)
  File "/home/me/.venv/lib/python3.8/site-packages/objection/commands/frida_commands.py", line 38, in frida_environment
    ('Script Filename', frida_env['filename']),
KeyError: 'filename'

Now, while this can easily be fixed by commenting the respective line. When trying to import a script, e.g. for root detection bypass an issue with the architecture occurs:

org.myorg.myapp on (Android: 10) [usb] # import /home/me/antiroot.js
(agent) Loaded 11350 classes!
(agent) loaded: -1
(agent) ProcessManager hook not loaded
(agent) KeyInfo hook not loaded
An unexpected internal exception has occurred. If this looks like a code related error, please file a bug report!
unable to handle 64-bit processes due to build configuration

Python stack trace: Traceback (most recent call last):
  File "/home/me/.venv/lib/python3.8/site-packages/objection/console/repl.py", line 371, in start_repl
    self.run_command(document)
  File "/home/me/.venv/lib/python3.8/site-packages/objection/console/repl.py", line 185, in run_command
    exec_method(arguments)
  File "/home/me/.venv/lib/python3.8/site-packages/objection/commands/frida_commands.py", line 86, in load_background
    agent.background(hook)
  File "/home/me/.venv/lib/python3.8/site-packages/objection/utils/agent.py", line 274, in background
    self.device.resume(self.spawned_pid)
  File "/home/me/.venv/lib/python3.8/site-packages/frida/core.py", line 26, in wrapper
    return f(*args, **kwargs)
  File "/home/me/.venv/lib/python3.8/site-packages/frida/core.py", line 157, in resume
    self._impl.resume(self._pid_of(target))
frida.NotSupportedError: unable to handle 64-bit processes due to build configuration

I am using the frida antiroot script by dzonerzy (https://codeshare.frida.re/@dzonerzy/fridantiroot/). I have also tried using it as a startup script which fails the same way. Running it via frida client works as expected:

frida -U --codeshare dzonerzy/fridantiroot -f org.myorg.myapp

I have tried different frida server architectures, however all but x86 fail to start.

Help is much appreciated :pray:

To Reproduce see above

Similar issues

354

and for frida: https://github.com/frida/frida/issues/999

Expected behavior Commands frida and import should work.

Evidence / Logs / Screenshots see above

Environment (please complete the following information):

Application none

Additional context none

IPMegladon commented 3 weeks ago

Suspect you used an x86 instead of an x86_64 frida-server. Closing as stale, feel free to reopen.