无法使用Frida JavaScript API'DebugSymbol.fromAddress'获取符号

时间:2018-06-24 06:29:24

标签: ios frida

我正在尝试使用 Frida 开发测试工具。最近,我尝试使用文档中的代码段记录回溯记录:

Interceptor.attach(Module.findExportByName(null, 'open'), {
onEnter: function (args) {
    var path = Memory.readUtf8String(args[0]);
    console.log("open" + path + ")\n\t" + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n") + "\n");
}

});

但是我们尝试使用我的应用程序( MyApp )运行脚本,我得到了这些信息:

open/var/mobile/Containers/Data/Application/E459A8E1-12D5-4E20-8F99-40CA90967C0B/Library/Caches/XXXX/XXXX.plist)
0x1ce3140f Foundation!_NSReadBytesFromFileWithExtendedAttributes
0x1ce356c7 Foundation!-[NSData(NSData) initWithContentsOfFile:options:error:]
0x1cecf0c1 Foundation!+[NSKeyedUnarchiver unarchiveObjectWithFile:]
0x534293 MyApp!0x4f0293
0x5341f5 MyApp!0x4f01f5
0x53450d MyApp!0x4f050d
0x53360f MyApp!0x4ef60f
0x5346b9 MyApp!0x4f06b9
0x8b4473 MyApp!0x870473
0xb81ecb MyApp!0xb3decb
0xb82225 MyApp!0xb3e225
0xb823bf MyApp!0xb3e3bf
0xb3974d MyApp!0xaf574d
0xb00533 MyApp!0xabc533
0x48039 MyApp!0x4039
0x218595c5 UIKit!-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]

您可以看到

  

DebugSymbol.fromAddress

可以表示Foundation的地址,但对于MyApp则失败。

video 19:33 中,我们可以看到DebugSymbol.fromAddress可以表示目标应用程序的地址。

我使用的是 Frida 11.0.12 ,而设备是带有h3lix-RC5的iOS10.3.3的iPhone 5

有人也遇到这个问题吗?

1 个答案:

答案 0 :(得分:0)

要重现您的问题,我将需要IPA或MyApp mach0文件上至少输出nm -DC

此外,您粘贴的脚本存在问题,pathargs中的第一个元素,它是一个对字符串的引用的地址,args是一个包含(不包含)的数组。有限)的参数。

$ frida -U Telegram
     ____
    / _  |   Frida 11.0.11 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at http://www.frida.re/docs/home/

[iOS Device::Telegram]->     Interceptor.attach(Module.findExportByName(null, "open"), {
                                 onEnter: function (args) {
                                     console.log("open " + Memory.readUtf8String(args[0]));
                                     console.log(Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join
("\n"));
                                 }
                             });
{}
[iOS Device::Telegram]-> open /private/var/mobile/Containers/Shared/AppGroup/1E33CAF6-1422-.../Documents/network-usage
0x10109a8ec Telegram!0x102a8ec
0x1822bd4bc libdispatch.dylib!_dispatch_call_block_and_release
0x1822bd47c libdispatch.dylib!_dispatch_client_callout
0x1822c94c0 libdispatch.dylib!_dispatch_queue_drain
0x1822c0f80 libdispatch.dylib!_dispatch_queue_invoke
0x1822cb390 libdispatch.dylib!_dispatch_root_queue_drain
0x1822cb0b0 libdispatch.dylib!_dispatch_worker_thread3
0x1824d5470 libsystem_pthread.dylib!_pthread_wqthread
open /private/var/mobile/Containers/Data/Application/3ED4C762-597B-.../Library/Cookies/Cookies.binarycookies
0x182777dec CoreFoundation!fileOpen
0x182767eb8 CoreFoundation!_CFStreamOpen
0x182777d14 CoreFoundation!CFReadStreamOpen
0x182e578d0 CFNetwork!DiskCookieStorage::readFileToCookies(MemoryCookies*)