ChiChou / bagbak

Yet another frida based iOS dumpdecrypted. Also decrypts app extensions
MIT License
1.12k stars 184 forks source link

Fatal Error, agent.js does not exist. Frida 16.0.14 nodeJS 19.5.0 #96

Closed gelosecurity closed 1 year ago

gelosecurity commented 1 year ago

Describe the bug Fatal Error, agent.js does not exist.

To Reproduce Steps to reproduce the behavior:

  1. Install Frida 16.0.14 on iOS and MacOS.
  2. Install bagbak using npm
  3. bagbak -l is working
  4. when attempting bagbak '[app]', get the following error:
FATAL ERROR
[Error: ENOENT: no such file or directory, open '/opt/homebrew/lib/node_modules/bagbak/agent/dist/agent.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/opt/homebrew/lib/node_modules/bagbak/agent/dist/agent.js'
}

Expected behavior Should dump the app

Desktop (please complete the following information):

ChiChou commented 1 year ago

There is a known issue(#93, #94) that v2.5.1 and v2.5.2 are incompletely published. Please make sure you are on the latest version: npm install -g bagbak@2.5.3

bensh commented 1 year ago

Still seems to have an issue

node_modules$ 
node_modules$ npm list -g         
/Users/ben/.nvm/versions/node/v19.5.0/lib
├── bagbak@2.5.3
└── frida@16.0.17

tools$ bagbak -u xxxxxxxxxxx com.app.internal -o /Users/ben/Documents/ios -z -f
FATAL ERROR
[Error: ENOENT: no such file or directory, open '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent/dist/agent.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent/dist/agent.js'
}
ChiChou commented 1 year ago

I deleted all 2.5.x releases. However the v2.5.3 failed to pull from npm because of too many downloads

bensh commented 1 year ago

Still getting this issue on 2.6.0

FATAL ERROR
[Error: ENOENT: no such file or directory, open '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent/dist/agent.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent/dist/agent.js'
}

npm list -g          
/Users/ben/.nvm/versions/node/v19.5.0/lib
├── bagbak@2.6.0
├── frida@16.0.17
├── grapefruit@0.2.0
└── retire@4.1.1
ChiChou commented 1 year ago

...pushed a new version again @bensh

bensh commented 1 year ago
ios$ npm -g list
/Users/ben/.nvm/versions/node/v19.5.0/lib
├── bagbak@2.6.1
├── frida@16.0.17
├── grapefruit@0.2.0
└── retire@4.1.1

ios$ 
ios$ 
ios$ bagbak com.thomsonreuters.eikonhd -z
FATAL ERROR
[Error: ENOENT: no such file or directory, open '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent.dist.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/ben/.nvm/versions/node/v19.5.0/lib/node_modules/bagbak/agent.dist.js'
}

Is there anything I can help you with debugging wise? Or anything I can try my end in case its my setup?

ChiChou commented 1 year ago

@bensh npm is cursed. I tried https://github.com/ChiChou/bagbak/commit/0607d6b82f4572534fa8969a5448e1e0e63b6a54 bug it only works locally.

ChiChou commented 1 year ago

I am giving up on this, maybe I shoud ignore #90 and revert evrything to two weeks ago

ChiChou commented 1 year ago

The problem is that agent.dist.js got excluded from the package because it respects rules from .gitignore. Meanwhile I need this rule to exclude the compiled code of course to avoid accidently commit it.

bensh commented 1 year ago

Appreciate all the time you are putting into this for the community.

EDIT: 3 mins after I wrote this I install 2.6.3, and it downloaded and it dumped fine. Had an issue with the original app I tried above

dump extensions
unable to dump plugins Error: Timeout was reached

But a different app worked fine

patch PluginKit validation
dump extensions
download ...A8C-ACE3-E2F407D83FF1/Rescue.app/PlugIns/RescueDeviceView.appex/RescueDeviceView
fetching decrypted data
████████████████████████████████████████ | 100% | 0.02Mib/0.02Mib
Congrats!
open dump/com.logmein.rescue/Payload

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs LE)

Scanning the drive:
150 folders, 441 files, 15325393 bytes (15 MiB)

Creating archive: ../com.logmein.rescue.zip

Items to compress: 591

Files read from disk: 441
Archive size: 7509752 bytes (7334 KiB)
Everything is Ok
archive: dump/com.logmein.rescue.ipa
contents: dump/com.logmein.rescue
ChiChou commented 1 year ago

Should be working now