httptoolkit / frida-interception-and-unpinning

Frida scripts to directly MitM all HTTPS traffic from a target mobile application
https://httptoolkit.com/android/
GNU Affero General Public License v3.0
905 stars 178 forks source link

Error: VM::AttachCurrentThread failed: -1 #11

Closed x011 closed 2 years ago

x011 commented 2 years ago

Hi, When I try to use frida-script.js I get an error:

frida --no-pause -U -l ./frida-script.js -f tech.httptoolkit.pinning_demo
     ____
    / _  |   Frida 15.1.14 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
Spawned `tech.httptoolkit.pinning_demo`. Resuming main thread!
Error: VM::AttachCurrentThread failed: -1
    at o (frida/node_modules/frida-java-bridge/lib/result.js:4)
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:25)
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:14)
    at Xe (frida/node_modules/frida-java-bridge/lib/android.js:500)
    at Ie (frida/node_modules/frida-java-bridge/lib/android.js:196)
    at Ce (frida/node_modules/frida-java-bridge/lib/android.js:16)
    at _tryInitialize (frida/node_modules/frida-java-bridge/index.js:17)
    at y (frida/node_modules/frida-java-bridge/index.js:9)
    at <anonymous> (frida/node_modules/frida-java-bridge/index.js:320)
    at call (native)
    at o (/_java.js)
    at <anonymous> (/_java.js)
    at <anonymous> (frida/runtime/java.js:1)
    at call (native)
    at o (/_java.js)
    at r (/_java.js)
    at <eval> (frida/runtime/java.js:3)
    at _loadJava (native)
    at get (frida/runtime/core.js:125)
    at <anonymous> (/frida-script.js:510)
    at apply (native)
    at <anonymous> (frida/runtime/core.js:45)

It doesn't matter which app I use (com.twitter.android, tech.httptoolkit.pinning_demo, etc) the result is always the same.

Android 11, Samsung SM G998B (s21 Ultra) rooted. Frida is installed on Windows 11 / Python3.7

Any idea how to fix this? Thank you.

x011 commented 2 years ago

I've used apk-mitm instead of Frida to disable certificate pinning.

pimterry commented 2 years ago

Thanks for reporting this @x011. I've heard about similar issues before (#3) - in that case this was a general Frida problem, rather than something to do with the script being used.

If you have a minute, it would be useful if you could confirm that (just check that running other Frida scripts from https://codeshare.frida.re/ fails too, so it's not related to this script).

Either way I'm not sure what causes the underlying issue. Any clues would be very welcome, I'd love to be able to give some advice to get Frida working for the next person who runs into this!