iOS App Hacking
ios 앱 사용자 함수 hooking (using frida)
hyunmini
2017. 8. 16. 11:19
가끔 앱해킹을 하다보면 특이한 환경 때문에(난독화 등) 사용자 일반 함수를 후킹해야 할 때가 있다.
When I analysis app, need a hook at user function sometimes in an unusual environment(obfuscation, check jailbreak, etc).
이럴때 Frida 를 이용해서 후킹이 가능하다.
In this case, frida can be used to hook.
후킹은 일반적으로 함수 주소를 구해오는데, 사용자 함수는 심볼이 없으므로 offset 을 동적으로 구해와야 한다.
Hooking is usually set to function address, the user function must obtain the offset dynamically because there are no symbols.
결론 : 앱 실행 후 base 주소를 얻고, offset 을 더해준 주소에 후킹을 걸어주면 된다.
conclusion: after running the app, obtain the base address and add the offset. then you can set a hook to the address.
var module_base = Module.findBaseAddress('testapp'); // get base addr var custom3_5fdfd4 = module_base.add(0x5fdfd4); // add function offset Interceptor.attach(custom3_5fdfd4, { // set hook onEnter: function (args) { send("[S] !!!!!!!!!!!!!! custom3() called"); // before call }, onLeave: function (retval) { //send("[W] custom3 ret: " + retval.toString() ); // after call } });
끝~
the end~