Process discovery (Android)¶
The process that runs an app's TLS is often not the process you launched. Hooking only the launched package then yields no keys, or only some of them. This page explains why, how tlsLibHunter finds the right processes, and how friTap captures them with a discovery profile. For the flags in short, see Android: Delegate Processes and the CLI reference.
The problem¶
Common reasons the TLS runs elsewhere:
- Launcher hand-off. Gemini (
com.google.android.apps.bard) is a thin launcher: it hands the conversation to the Google app (com.google.android.googlequicksearchbox, process:search), which talks QUIC through Cronet in/apex/com.android.tethering/lib64/libhttpengine.so. Hooking Gemini alone captures nothing of the Gemini backend. - Sub-processes. Apps split work into
:processsiblings (sync, media, push) that each open their own connections. - Restarts. A process can be killed and restarted while you use the app; an attach-only capture loses it.
The Android process model¶
Android has no system TLS daemon like Schannel/LSASS on Windows. Every process runs its own TLS stack in-process:
- Conscrypt (BoringSSL) for the platform
javax.net.sslstack. - HttpEngine (Cronet in the tethering APEX) and GMS Cronet, which Play services loads into the app's process via dynamite modules.
- WebView: networking runs in the app process (network service in-process); renderers are isolated and do no networking.
The one in-app exception is the SDK Runtime: ad SDKs can run in <pkg>_sdk_sandbox, a separate process whose traffic is still attributable to the app.
Apps can still delegate whole requests over binder or intents to other processes that run their own TLS: Google Play services (GMS), DownloadProvider, Chrome (Custom Tabs), netd/DnsResolver (Private DNS / DoT) and the Play Store. Those processes serve many apps, so their traffic cannot be attributed to the target. friTap reports them (role shared_system) but never hooks them by default.
With --include-shared-delegates (needs --profile or --discover) friTap also attaches the profile's running shared_system processes late. It never spawn-gates or force-stops them (they serve the whole device). Their events carry process_origin.role: "shared_system" and use their own event classes, so their keys go only to <keylog>.shared (needs -k; a # comment line names the target they are not attributable to) and never into the main keylog, pcap, flows or .tap. In the -j - stream they appear as shared_delegate_keylog / shared_delegate_data records, with the usual key redaction.
Zygote, copy-on-write and spawn gating¶
Every app process is forked from zygote and inherits its memory copy-on-write. Injecting Frida into zygote itself does not work: after fork() only the forking thread survives in the child, so Frida's agent threads are gone, while the inherited trampolines still point into an agent that no longer runs, and the child crashes.
The usable vantage point is spawn gating at process specialization: Frida pauses each new process right after zygote turns it into an app, before the app code runs, so friTap can hook it before its first connection.
Zygote maps Conscrypt's libssl.so and the tethering APEX's libhttpengine.so into every app process (verified on a Pixel 5, Android 14). Their presence in /proc/<pid>/maps is therefore only weak evidence: tlsLibHunter labels them tls_lib:conscrypt/libssl.so / tls_lib:tethering/libhttpengine.so and marks a process confirmed only when such a library comes with an owned TLS socket. Any other TLS library (bundled Cronet, Flutter, WebView, ...) confirms on its own.
Evidence layers and roles¶
tlsLibHunter combines several kinds of evidence per process:
| Layer | What it checks |
|---|---|
| Topology | Same app UID (uid % 100000), isolated processes (app id 90000-99999), SDK sandbox (app id 20000-29999), :process names |
| Hand-off | The foreground host after launch; dumpsys activity oom adjSource bindings from the target to other processes |
| Socket ownership | /proc/net/{tcp,udp}* joined with /proc/<pid>/fd (needs root). netd fchowns DNS/DoT sockets to the app UID, so the UID alone does not prove the app opened a socket |
| TLS libraries | Which TLS libraries are mapped in /proc/<pid>/maps (root, no Frida) |
Binder probe (opt-in, --probe) | A short Frida probe in the target logs the binder interfaces it calls (handoff:binder:<descriptor>) and its TLS-port connect/sendto calls |
Each process gets a role:
| Role | Meaning | friTap |
|---|---|---|
target | The launched package | hooked |
sibling | :process of the same package | hooked |
delegate | Another package the target hands work to (e.g. the Google app for Gemini) | hooked, restarted under spawn gating |
sdk_sandbox | <pkg>_sdk_sandbox of the target | hooked |
shared_system | GMS, netd, Play Store, ... serving many apps | reported only; captured into <keylog>.shared with --include-shared-delegates |
Workflow: learn, then capture¶
1. Learn. Run discovery while you exercise the app:
tlslibhunter discover com.google.android.apps.bard --serial <SERIAL> \
--duration 30 --write-profile gemini.json
2. Capture. Launch fresh with the profile:
Add --probe to also record which binder services the target calls, or use tlslibhunter discover <pkg> --watch to stream process restarts and new delegates as JSON lines (tlslibhunter.watch/1).
Or do both in one run with --discover SECONDS (needs tlsLibHunter installed). Add packages by hand with --also-package <package> (repeatable).
Idle first, then use the app. Background processes open sockets all the time (sync, push, telemetry). With a baseline, discovery first samples the device while you leave the app alone, then tells you to use it; sockets that are new after the baseline get the evidence net:new-after-baseline and rank first. In tlsLibHunter this is --baseline SECONDS, in friTap --discover-baseline SECONDS (tlsLibHunter 0.4.2 or newer):
friTap logs the cues: Keep <pkg> idle for 5 s ..., then Use <pkg> now for 30 s (send a prompt / reload) ....
Binder probe. --discover-probe runs tlsLibHunter's probe (its discover --probe) before discovery, on friTap's open Frida device: it attaches to the running app (launching it if needed, thawing it if the freezer holds it) and records the binder interfaces it calls, which reveals delegates that dumpsys misses. A failing probe is logged as a warning and discovery runs without it; the capture never aborts because of it. The probe leaves the app running, so with -s friTap force-stops it before spawning it.
What friTap does with a profile:
- Enables spawn gating for all profile packages before force-stopping the delegates. Delegates such as the Google app respawn in about 0.1 s, so the gate must already be armed.
- Holds each gated process until the agent reports its hooks installed (at most 6 s, below Android's 10 s process-start timeout), then resumes it.
- Keeps capturing while any profile process runs, even after the target exits. Stop with Ctrl+C.
Why not attach late? Cronet and QUIC pool connections: the handshakes happen at startup and later requests reuse them. Attaching after the fact finds the connections already established and gets no keys for them.
Every event carries process_origin (pid, process, role), and .tap flows carry pid / process_role (see .tap format).
When friTap suggests discovery¶
You usually notice delegation only after the fact: the capture of the app alone yields no TLS keys, or the app exits right after the start and friTap reports the target as stopped. For Android captures (-m) without --profile, --discover or --also-package, friTap then suggests discovery on its own (memory-scan findings do not count as keys):
- At exit, a
[Hint]with the commands to run next. Its code istarget_exited_earlywhen the app went away before or within 15 s of the capture start, elseno_keys. An early-exit report gains one line,-> This app may hand its traffic to another process; see the [Hint] below.
[Hint] No TLS keys were captured from com.google.android.apps.bard. On Android the TLS often runs in another process (e.g. Gemini hands off to the Google app). Process discovery finds those processes and captures them from their start:
-> fritap -m <SERIAL> --discover 30 --discover-baseline 5 -k keys.log -s com.google.android.apps.bard
-> tlslibhunter discover com.google.android.apps.bard --serial <SERIAL> --baseline 5 --duration 30 --write-profile com.google.android.apps.bard.profile.json
-> fritap -m <SERIAL> --profile com.google.android.apps.bard.profile.json -k keys.log -s com.google.android.apps.bard
-> fritap -m <SERIAL> --also-package <other.package> -k keys.log -s com.google.android.apps.bard (if you already know the process that does the work)
The serial is filled in from -m <serial> or the Frida device id. --baseline needs tlsLibHunter 0.4.2 or newer; drop it on older versions. - When the app cannot be spawned. Gemini's launcher hands off before its own process runs, so a plain fritap -m <SERIAL> -s com.google.android.apps.bard fails with Frida's TimeOutError: unexpectedly timed out while waiting for app to launch. friTap then prints the same commands under code spawn_timeout (also as the hint of the -j - error record). A profile capture of the same app works, because the delegate packages are spawn-gated first. - During the capture (interactive CLI only, not with -j - or in the TUI), one line after 30 s without a key: No TLS keys yet from <pkg> after 30 s. If the app hands off to another process, stop (Ctrl+C) and re-run with --discover 30 (details at exit). - In machine output, a hint record in the -j - JSONL stream (code, message, suggestions), a HintEvent line in a -j file.jsonl file and a top-level hints array in the -j file.json document. - In the agent API, capture_status and stop_capture return hints (code, message, suggestions, next_tool). For no_keys and target_exited_early, next_tool is discover_processes: run it with write_profile, then start_capture with that profile.
In the TUI¶
The TUI (fritap without arguments) guides you through discovery when the device is an Android phone over USB and the target's package is known (spawn by package name, or attach to an app from the app list):
- During the capture, a toast after 30 s without a TLS key: No TLS keys yet from
<pkg>... Press D to find those processes. D(Find TLS processes) opens the discovery wizard at any time. It is shown in the footer only when discovery fits the target; otherwiseDsays why (no Android USB device, no package, or the capture already uses a profile). During a capture,Dasks before it stops the capture.- After a capture with no TLS keys, friTap offers Find processes (not shown for profile captures or captures that produced keys).
The wizard explains what discovery does (root on the device is required; no Frida is injected while it runs), lets you pick 15, 30 or 60 s, then asks you to keep the app idle for 5 s and to use it for the chosen time. It then lists the attributable processes (all selected), the shared_system processes that are only reported, and any discovery incomplete gaps. Restart capture saves the selected processes as a profile (default <keylog dir or cwd>/<pkg>.profile.json) and starts a spawn-mode profile capture of the same package with the previous capture mode; Save profile only just writes the file for a later --profile run. Without tlsLibHunter the wizard shows the pip install -U 'tlsLibHunter>=0.4.2' command.
Profile format¶
A profile is JSON with schema tlslibhunter.profile/1:
| Field | Content |
|---|---|
target | Target process name |
target_package | Target package |
gate_packages | Packages friTap spawn-gates |
process_patterns | Process names to hook |
device_fingerprint, version_code | Device and app version the profile was learned on |
candidates[] | pid, process, package, uid, role, evidence per process |
gaps[] | Optional: code, detail per device read that came back empty (see Discovery incomplete) |
Profiles are untrusted input: friTap validates every package and process name against Android naming rules and rejects a profile with any other value. Re-learn the profile after app or OS updates.
Discovery incomplete¶
When the device does not let discovery see everything, the profile lists gaps and friTap prints one line per gap in the capture summary, discovery incomplete: <code> (<detail>) (the agent API returns them as gaps in discover_processes). The candidates are then a lower bound:
| Code | Meaning | What to do |
|---|---|---|
no_root | No su: socket ownership and other processes' /proc entries are unreadable | Use a rooted device or emulator |
fd_visibility_incomplete | Some processes' file descriptors could not be read, so their sockets are not attributed | Check that su grants full root (SELinux) |
maps_unavailable | Process memory maps (loaded TLS libraries) could not be read | Check root; re-run |
socket_table_unavailable | /proc/net/tcp* / udp* came back empty | Check root and SELinux; re-run |
foreground_unavailable | The foreground app could not be determined | Keep the app in the foreground; re-run |
Gap codes are validated (short [a-z_] identifiers); details come from the device and are escaped and shortened before they are shown.
Limitations¶
- Socket ownership needs root; without it discovery relies on the other layers.
- Discovery polls
/proc; very short-lived sockets can be missed. - Traffic that a target delegates to
shared_systemprocesses is not captured. - The USAP pool pre-forks app processes, which can escape spawn gating. friTap warns and prints the command to disable it (
setprop persist.device_config.runtime_native.usap_pool_enabled false). - The cached-app freezer can freeze background processes, so a delegate may produce no traffic until it is in use again.
- After a run in which the target was closed and relaunched (so delegates were hooked again while the main target was gone), Frida's script unload can stall in the delegate processes. friTap still removes every hook (graceful detach), but the idle Frida agent stays mapped in those processes until they exit. Run
adb shell am force-stop <delegate package>to clear it. --probeneeds the target's own process to run. Pure launchers such as Gemini hand off before their process stays up, so there is nothing to probe; discovery then still finds the delegates through the other layers.
Measured example¶
Gemini on a Pixel 5, Android 14:
| Mode | Result |
|---|---|
| Late attach to Gemini | 0 keys |
--profile capture | All startup handshakes keyed (10/10); the Gemini backend robinfrontend-pa.googleapis.com decrypted over HTTP/3 |
See also QUIC: Gemini / Google app.