dmayer / idb

idb is a tool to simplify some common tasks for iOS pentesting and research
MIT License
942 stars 156 forks source link

Crash while loading application #98

Open Ill-ithid opened 7 years ago

Ill-ithid commented 7 years ago

I'm` getting persistent crashes in idb when loading any application:

Running on iPad, iOS 9.3.5 with Phoenix jailbreak / Ubuntu 16.04.1 ruby 2.3.1p112

I've looked through the existing similar issues but this doesn't seem to be a dup.

`REDACTED:/opt$ idb
 ...
[DEBUG] 2017-10-12 14:05:01 :: idb ::  Executing blocking SSH command: ls /private/var/containers/Bundle/Application/A220DF04-02A4-4C3F-A833-E15FFD2DCFB4/*app/Info.plist
[INFO] 2017-10-12 14:05:02 :: idb ::  Info.plist found at /private/var/containers/Bundle/Application/A220DF04-02A4-4C3F-A833-E15FFD2DCFB4/Phœnix.app/Info.plist
[INFO] 2017-10-12 14:05:02 :: idb ::  Parsing plist file..
[DEBUG] 2017-10-12 14:05:02 :: idb ::  Data Dir: {"snapshots"=>nil, "identifier"=>nil, "$class"=>nil}
[DEBUG] 2017-10-12 14:05:07 :: idb ::  Appending extension to AppIcon60x60
[DEBUG] 2017-10-12 14:05:07 :: idb ::  Now: AppIcon60x60*.png
[DEBUG] 2017-10-12 14:05:07 :: idb ::  Executing blocking SSH command: ls /private/var/containers/Bundle/Application/REDACTED/*app/AppIcon60x60*.png
[INFO] 2017-10-12 14:05:07 :: idb ::  Icon found at /private/var/containers/Bundle/Application/REDACTED/AppIcon60x60@2x.png
[INFO] 2017-10-12 14:05:08 :: idb ::  Locating application binary...
[DEBUG] 2017-10-12 14:05:15 :: idb ::  File not found: Net::SFTP::StatusException (2, "no such file")
[DEBUG] 2017-10-12 14:05:15 :: idb ::  File not found: Net::SFTP::StatusException (2, "no such file")
[DEBUG] 2017-10-12 14:05:15 :: idb ::  Executing blocking SSH command: /usr/bin/ldid -e '/private/var/containers/Bundle/Application/REDACTED'
#<Plist4r::Plist:0x00000001bd1bf8>
[DEBUG] 2017-10-12 14:05:15 :: idb ::  Executing blocking SSH command: /usr/bin/ldid -e '/private/var/containers/Bundle/Application/REDACTED'
#<Plist4r::Plist:0x00000001b05dc8>
[DEBUG] 2017-10-12 14:05:15 :: idb ::  Executing blocking SSH command: /usr/bin/ldid -e '/private/var/containers/Bundle/Application/REDACTED'
#<Plist4r::Plist:0x000000012f9aa8>
/var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/app_details_group_box.rb:69:in `app_changed': undefined method `sub' for nil:NilClass (NoMethodError)
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/app_tab_widget.rb:48:in `app_changed'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/main_tab_widget.rb:163:in `app_changed'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/idb.rb:122:in `block in init_ui'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `qt_metacall'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `app_changed'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `block (2 levels) in initialize'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `qt_metacall'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `method_missing'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `block in initialize'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:in `qt_metacall'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:in `method_missing'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:917:in `exec'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:63:in `block in initialize'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:in `qt_metacall'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:in `method_missing'
    from /var/lib/gems/2.3.0/gems/qtbindings-4.8.6.3/lib/Qt/qtruby4.rb:479:in `exec'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/lib/idb.rb:278:in `run'
    from /var/lib/gems/2.3.0/gems/idb-2.10.3/bin/idb:4:in `<top (required)>'
    from /usr/local/bin/idb:23:in `load'
    from /usr/local/bin/idb:23:in `<main>'
`
bitdaemon commented 7 years ago

Hi,

i am getting the same error messages. In my case, i am running MacOS 10.12 and ios 10.1.1. Any update would be appreciated.

ladyleet1337 commented 7 years ago

I am also getting same error

lazyw0lf commented 7 years ago

Same issue on iOS 10.2 and MacOS 10.10.2

0xff7 commented 7 years ago

Same issue on iOS 10.2 and macOS 10.13.1

whoot commented 7 years ago

Same here on iOS 9.3.3 and macOS 10.13 !

Debug log:

[DEBUG] 2017-11-13 17:17:59 :: idb ::  Executing blocking SSH command: /usr/bin/ldid -e '/private/var/containers/Bundle/Application/6B9C9D66-A9C4-4CB7-B9E0-2ACBF17040B7//DamnVulnerableIOSApp.app/DamnVulnerableIOSApp'
/Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:82:in `from_string': Unknown plist format for string:  (RuntimeError)
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:280:in `block in parse_opts'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:277:in `each'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:277:in `parse_opts'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r/plist.rb:53:in `initialize'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r.rb:20:in `new'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/plist4r-1.2.2/lib/plist4r.rb:20:in `new'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/lib/ios10_application_state_db_wrapper.rb:28:in `entitlements_by_binary'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/lib/app.rb:300:in `entitlements'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/default_protection_class_group_widget.rb:23:in `update'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/plist_file_widget.rb:52:in `setup'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/local_storage_tab_widget.rb:25:in `setup'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/main_tab_widget.rb:95:in `enableLocalStorage'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/main_tab_widget.rb:159:in `app_changed'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/idb.rb:122:in `block in init_ui'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `qt_metacall'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `app_changed'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:61:in `block (2 levels) in initialize'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `qt_metacall'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `method_missing'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/app_list_dialog.rb:24:in `block in initialize'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:917:in `qt_metacall'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:917:in `method_missing'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:917:in `exec'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/gui/global_app_details_group_box.rb:63:in `block in initialize'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:2470:in `invoke'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:479:in `qt_metacall'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:479:in `method_missing'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/qtbindings-4.8.6.4/lib/Qt/qtruby4.rb:479:in `exec'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/lib/idb.rb:278:in `run'
    from /Users/admin/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/idb-2.10.3/bin/idb:4:in `<top (required)>'
    from /Users/admin/.rvm/gems/ruby-2.4.1/bin/idb:23:in `load'
    from /Users/admin/.rvm/gems/ruby-2.4.1/bin/idb:23:in `<main>'
    from /Users/admin/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/admin/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
recv failed: Resource temporarily unavailable
whoot commented 7 years ago

Alright I found a workaround!! It seems like there is something wrong with the iOS 10 support. Revert this and all subsequent commits and idb will work again!

You have to do the following steps:

git clone https://github.com/dmayer/idb
cd idb/
git revert 038355497091b24c53596817b8818d2b2bc18e4b
git revert 799a0e6565c17f72dce5a7e9f1a5738abbd08ae2
git revert 092929aa51b941e003f7e4d162b550171da8d66a
git revert c8dcb9f091fc7f706af60b40c5a041299c3dcf35
git revert c8d025012fa7eacaae688a53e22078ccf4cebe15

bundle install
bundle exec idb

WARNING: This will drop the support for iOS 10!

Ill-ithid commented 7 years ago

I can confirm this fix worked on my system - still a few bugs with trying to get info about the binary protections but possibly because I'm running on Ubuntu / no otool.

Hopefully whatever issues were introduced will be tweaked in a future version.

git-oaktree commented 7 years ago

This did not work for me. I replaced revert with "reset --hard" . I confirmed the version of the repo using "git rev-parse HEAD" which did show hash c8d025012fa7eacaae688a53e22078ccf4cebe15. With these changes, I still encountered the same errors.

jcmoreno commented 6 years ago

I'm on High Sierra and it worked for me.

Thanks!!!