-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Some of the symbol lookups are using the DebugSymbol Frida API. In most cases, this works well :)
From script.js:
const __CFBinaryPlistCreate15 = DebugSymbol.fromName('__CFBinaryPlistCreate15').address;
const _xpc_connection_call_event_handler = DebugSymbol.fromName("_xpc_connection_call_event_handler").address;This is necessary since the two non-exported symbols cannot be looked up using Module.getBaseAddress(). However, some hardened daemons like imagent don't allow using the DebugSymbol API. This in turn crashes the daemon like this:
default 22:56:23.233756+0100 imagent [0xc68bb1930] activating connection: mach=true listener=false peer=false name=com.apple.coresymbolicationd
error 22:56:23.234062+0100 kernel Sandbox: imagent(441) deny(1) mach-lookup com.apple.coresymbolicationd
default 22:56:23.234492+0100 imagent [0xc68bb1930] failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159]
default 22:56:23.234539+0100 imagent [0xc68bb1930] invalidated after a failed init
error 22:56:23.234616+0100 imagent Invalid connection: com.apple.coresymbolicationd
default 22:56:30.745460+0100 kernel EXC_RESOURCE -> imagent[441] exceeded mem limit: InactiveHard 500 MB (fatal)
default 22:56:30.745614+0100 kernel memorystatus: killing process 441 [imagent] in high band ? (140) - memorystatus_available_pages: 78501
default 22:56:30.745631+0100 kernel imagent[441] Corpse allowed 1 of 5
Increasing the process memory limit does not help, this is just a follow-up error by Frida.
I haven't found an elegant workaround yet :( What I did to get gxpc working again was to first attach to a process that allows lookups (like bluetoothd), use Frida for the lookup and then add this back to the script like so:
frida -U bluetoothd
[iPad::bluetoothd ]-> ptr(DebugSymbol.fromName("_xpc_connection_call_event_handler").address - Module.getBaseAddress('libxpc.dylib'))
"0xf98c"
[iPad::bluetoothd ]-> ptr(DebugSymbol.fromName("__CFBinaryPlistCreate15").address - Module.getBaseAddress('CoreFoundation'))
"0x7dbf4"And then replace it for that particular iOS/iPadOS version within script.js:
const __CFBinaryPlistCreate15 = Module.getBaseAddress('CoreFoundation').add(0x7dbf4);
const _xpc_connection_call_event_handler = Module.getBaseAddress('libxpc.dylib').add(0xf98c);Maybe this is useful for anyone who gets similar crashes :) And maybe there's a more elegant workaround?