fritap support on iOS 16.x #65
|
I'm trying to run fritap on iOS 16.x on a jalbroken iPhone (palerain), but I just get a constant rain of crashes before anything even starts. I can run this script https://github.com/jankais3r/Frida-iOS-15-TLS-Keylogger/blob/main/ios-tls-keylogger.js (with the updated offset) just fine, but when I use fritap, it just seems to crash. I'm not sure the best way to debug this is. I've tried to comment out everything in diff --git a/agent/platforms/ios.ts b/agent/platforms/ios.ts
index 64b9a2b..107ee93 100644
--- a/agent/platforms/ios.ts
+++ b/agent/platforms/ios.ts
@@ -24,19 +24,19 @@ function hook_iOS_SSL_Libs(hookRegistry: HookRegistry, is_base_hook: boolean) {
export function load_ios_hooking_agent() {
- hookRegistry.registerAll([
- // TLS libraries (TLS protocol family)
- { platform: plattform_name, pattern: /.*libboringssl\.dylib/, hookFn: (use_modern ? boring_execute_modern : boring_execute), library: "BoringSSL", libraryType: "boringssl", protocol: "tls" },
- { platform: plattform_name, pattern: /.*cronet.*\.dylib/, hookFn: (use_modern ? cronet_execute_modern : cronet_execute), library: "Cronet", libraryType: "boringssl", protocol: "tls" },
- { platform: plattform_name, pattern: /.*flutter.*\.dylib/, hookFn: (use_modern ? flutter_execute_modern : flutter_execute), library: "Flutter BoringSSL", libraryType: "boringssl", protocol: "tls" },
- ]);
-
- hook_iOS_SSL_Libs(hookRegistry, true);
- processScanResults(scan_results, plattform_name, true, selected_protocol);
- hookDynamicLoader({
- platform: plattform_name,
- platformLabel: "iOS",
- loaderLibrary: /libSystem.B.dylib/,
- functionName: "dlopen",
- }, hookRegistry, moduleNames, false, selected_protocol);
-}
\ No newline at end of file
+ // hookRegistry.registerAll([
+ // TLS libraries (TLS protocol family)
+ // { platform: plattform_name, pattern: /.*libboringssl\.dylib/, hookFn: (use_modern ? boring_execute_modern : boring_execute), library: "BoringSSL", libraryType: "boringssl", protocol: "tls" },
+ // { platform: plattform_name, pattern: /.*cronet.*\.dylib/, hookFn: (use_modern ? cronet_execute_modern : cronet_execute), library: "Cronet", libraryType: "boringssl", protocol: "tls" },
+ // { platform: plattform_name, pattern: /.*flutter.*\.dylib/, hookFn: (use_modern ? flutter_execute_modern : flutter_execute), library: "Flutter BoringSSL", libraryType: "boringssl", protocol: "tls" },
+ // ]);
+
+ // hook_iOS_SSL_Libs(hookRegistry, true);
+ // processScanResults(scan_results, plattform_name, true, selected_protocol);
+ // hookDynamicLoader({
+ // platform: plattform_name,
+ // platformLabel: "iOS",
+ // loaderLibrary: /libSystem.B.dylib/,
+ // functionName: "dlopen",
+ // }, hookRegistry, moduleNames, false, selected_protocol);
+}Any tips/tricks for how I can best debug this issue? fritap is becoming quite large, so the entrypoint feels more difficult to find :) |
Replies: 1 comment
|
Hi @eyJhb thanks for posting this, and apologies for the late reply. We only recently came across your post here in Discussions. I took a closer look at the Apple/iOS path, and your observation that the standalone keylogger works with the updated offset while friTap crashes was a very useful clue. The short version is: the offsets you contributed were not the problem. The bug was in how friTap selected and applied them. What caused the crashOn Apple's BoringSSL, That makes getting the offset right quite important: if friTap selects the wrong one, it writes into a neighbouring The old implementation selected that offset through a There was also an error in the CF-version-to-iOS-version mapping that could put iOS 16 into the wrong version bucket. So your original offsets were useful and correct for the versions they were determined on; friTap's surrounding version-selection logic was the part that failed. What changedI have changed the Apple path so that friTap no longer relies primarily on a version table. Instead, it now tries to derive the offset directly from the str x1, [x0, #imm]
retThe immediate value is the The version table remains as a fallback for cases where the symbol cannot be recovered. I also found a separate Apple spawn-mode issue: friTap queried A few diagnostics have been added around this as well:
Finding your way through friTapYour comment about the entrypoint is fair — the project has grown quite a bit. The easiest way to think about it is as two entrypoints and one platform switchboard. On the host side:
On the agent side, For iOS, the main switchboard is: That file maps module-name patterns to the corresponding hook implementation. For One potentially confusing detail is that That may also explain why commenting things out in one part of the agent did not necessarily have the effect you expected. One other development gotcha: npm ci --ignore-scripts
./dev/compile_agent.shOtherwise it is very easy to think a change had no effect while still running the previous agent bundle. If you still have the iOS 16 deviceIf you are able to test this again, the most useful first step would be: fritap -do ...The debug output should now show the detected iOS version, selected I would also try: fritap --probe ...first. If the application survives As an additional test, One caveat: iOS support is still not as broad as the other platforms. Apple's system Thanks again for posting this :-) — and also for the earlier offset contribution. Digging into this made it clear that the values themselves were not the issue. All the best Daniel |
Hi @eyJhb
thanks for posting this, and apologies for the late reply. We only recently came across your post here in Discussions.
I took a closer look at the Apple/iOS path, and your observation that the standalone keylogger works with the updated offset while friTap crashes was a very useful clue.
The short version is: the offsets you contributed were not the problem. The bug was in how friTap selected and applied them.
What caused the crash
On Apple's BoringSSL,
SSL_CTX_set_keylog_callbackis not exported. friTap therefore hooks the exportedSSL_CTX_set_info_callback, obtains the liveSSL_CTX, and writes its own keylog callback directly into the structure at the expected byte offset.Tha…