sensepost / objection

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

[bug] Target process died unexpectedly #504

Closed scinerio closed 2 years ago

scinerio commented 2 years ago

Bug Description When attempting to explore a gadget, the application starts and crashes. The following error is returned: frida.ProcessNotFoundError: target process died unexpectedly

To Reproduce Steps to reproduce the behavior: objection --gadget com.highaltitudehacks.DVIAswiftv2.Y8NCLCGVSJ explore

Expected behavior Application opens and objection attaches

Evidence / Logs / Screenshots image

[debug] Agent path is: /usr/local/lib/python3.9/site-packages/objection/agent.js
[debug] Injecting agent...
Using USB device `iPhone`
[debug] Attempting to attach to process: `com.highaltitudehacks.DVIAswiftv2.Y8NCLCGVSJ`
[debug] Unable to find process: `com.highaltitudehacks.DVIAswiftv2.Y8NCLCGVSJ`, attempting spawn
[debug] PID `2623` spawned, attaching...
Traceback (most recent call last):
  File "/usr/local/bin/objection", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/objection/console/cli.py", line 114, in explore
    agent.inject()
  File "/usr/local/lib/python3.9/site-packages/objection/utils/agent.py", line 202, in inject
    session = self.get_session()
  File "/usr/local/lib/python3.9/site-packages/objection/utils/agent.py", line 169, in get_session
    self.session = self.device.attach(self.spawned_pid)
  File "/usr/local/lib/python3.9/site-packages/frida/core.py", line 26, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/frida/core.py", line 165, in attach
    return Session(self._impl.attach(self._pid_of(target), *args, **kwargs))
frida.ProcessNotFoundError: target process died unexpectedly

Environment (please complete the following information):

Application Damn Vulnerable iOS App 2 https://github.com/prateek147/DVIA-v2

Additional context Add any other context about the problem here.

leonjza commented 2 years ago

Try and pass the PID (2612 in this case) to -g.

scinerio commented 2 years ago

This works as an alternative. Thanks for the comment!