objection icon indicating copy to clipboard operation
objection copied to clipboard

[bug] Only name works, but not identifier of app to attach to process

Open sushi2k opened this issue 4 years ago • 1 comments

  • Please, fill in all of the sections in this template.
  • Please read each section carefully. Each has a description of what information will help.
  • Windows support is limited. There is a good chance that a pull request would help!
  • The more information you give, the better.
  • Remove this section when you are done.

Describe the bug Objection is not attaching to a running process when using the identifier, but it's working when using the name only. When using the identifier objection always spawns the process (App re-opens on device) instead of attaching.

To Reproduce Steps to reproduce the behavior:

  1. Run command objection -d -g com.apple.mobilesafari explore

Similar issues Please link the issues in this repository that is similar to yours.

Expected behavior objection should attach when using the identifier of an app

Evidence / Logs / Screenshots Any output from objection, such as stack traces or errors that occurred. Be sure to run objection with the --debug flag so that errors from the agent are verbose enough to debug. For example:

~ ❯ frida-ps -Ua                                                                                                       
 PID  Name       Identifier
----  ---------  ----------------------
3744  Mail       com.apple.mobilemail
3747  Safari     com.apple.mobilesafari
❯ objection -d -g com.apple.mobilesafari explore                                                                             base
[debug] Agent path is: /usr/local/lib/python3.7/site-packages/objection/agent.js
[debug] Injecting agent...
Using USB device `iPhone`
[debug] Attempting to attach to process: `com.apple.mobilesafari`
[debug] Unable to find process: `com.apple.mobilesafari`, attempting spawn
Traceback (most recent call last):
  File "/usr/local/bin/objection", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/objection/console/cli.py", line 114, in explore
    agent.inject()
  File "/usr/local/lib/python3.7/site-packages/objection/utils/agent.py", line 202, in inject
    session = self.get_session()
  File "/usr/local/lib/python3.7/site-packages/objection/utils/agent.py", line 166, in get_session
    self.spawned_pid = self.device.spawn(state_connection.gadget_name)
  File "/usr/local/lib/python3.7/site-packages/frida/core.py", line 26, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/frida/core.py", line 140, in spawn
    return self._impl.spawn(program, argv, envp, env, cwd, stdio, aux_options)
frida.TimedOutError: unexpectedly timed out while waiting for app to launch
~ ❯ objection -d -g Safari explore                                                                                        21s  base
[debug] Agent path is: /usr/local/lib/python3.7/site-packages/objection/agent.js
[debug] Injecting agent...
Using USB device `iPhone`
[debug] Attempting to attach to process: `Safari`
[debug] Process attached!
Agent injected and responds ok!

     _   _         _   _
 ___| |_|_|___ ___| |_|_|___ ___
| . | . | | -_|  _|  _| | . |   |
|___|___| |___|___|_| |_|___|_|_|
      |___|(object)inject(ion) v1.9.6

     Runtime Mobile Exploration
        by: @leonjza from @sensepost

[tab] for command suggestions
com.apple.mobilesafari on (iPhone: 12.4) [usb] # exit
Exiting...
Asking jobs to stop...
Unloading objection agent...
[debug] Calling unload()

Environment (please complete the following information):

  • Device: iPhone6s
  • OS: 12.4
  • Frida Version 12.11.10
  • Objection Version 1.9.6

Application Was trying it with Safari and also other apps. Same behaviour.

Additional context Add any other context about the problem here.

sushi2k avatar Aug 27 '20 22:08 sushi2k

It's a problem with Frida. I'm getting the same error on an android using Frida and objection both. Not sure about the fix.

az0mb13 avatar Jan 29 '21 14:01 az0mb13