Open Myshtea opened 1 month ago
Running on an ArchLinux frida-node bindings version 16.5.2 Frida server is on a Fairphone 4 rooted with magisk version 16.5.2
The following code is based on https://github.com/frida/frida-node/blob/main/examples/cancellation.js, with added spawn gating.
const frida = require('frida'); let device; async function main() { const cancellable = new frida.Cancellable(); setTimeout(() => { console.log('Cancelling'); device.spawnAdded.disconnect((...args) => console.log("spawn", ...args)); cancellable.cancel(); }, 2000); device = await frida.getDevice('92fa9259', { timeout: 10000 }, cancellable); device.spawnAdded.connect((...args) => onProcessAdded("spawn", ...args)); device.enableSpawnGating() console.log('[*] Device:', device); } async function onProcessAdded(type, spawn) { console.log("[*] onSpawnAdded:", spawn, " of type ", type); await device.resume(spawn.pid); } main() .catch(e => { console.error(e); });
Program prints device Program prints any spawned process Cancellation triggers Program stops
$ npx esrun test.js [*] Device: Device { id: '92fa9259', name: 'FP4', icon: { format: 'rgba', width: 16, height: 16, image: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff 40 d2 e2 9c ff ff ff ff 30 ff ff ff 40 ff ff ff 40 ff ff ff 30 d7 e5 a8 ff ff ff ff 40 00 00 ... 974 more bytes> }, type: 'usb' } [*] onSpawnAdded: Spawn { pid: 5049, identifier: 'com.bnyro.recorder' } of type spawn [*] Resuming 5049 [*] onSpawnAdded: Spawn { pid: 5120, identifier: 'gr.nikolasspyr.integritycheck' } of type spawn [*] Resuming 5120 Cancelling $
Program prints device Program prints any spawned process Cancellation triggers Program continues printing spawned processes without stopping
$ npx esrun test.js [*] Device: Device { id: '92fa9259', name: 'FP4', icon: { format: 'rgba', width: 16, height: 16, image: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff 40 d2 e2 9c ff ff ff ff 30 ff ff ff 40 ff ff ff 40 ff ff ff 30 d7 e5 a8 ff ff ff ff 40 00 00 ... 974 more bytes> }, type: 'usb' } [*] onSpawnAdded: Spawn { pid: 5282, identifier: 'gr.nikolasspyr.integritycheck' } of type spawn [*] onSpawnAdded: Spawn { pid: 5311, identifier: 'org.fdroid.fdroid' } of type spawn Cancelling [*] onSpawnAdded: Spawn { pid: 5395, identifier: 'org.fdroid.fdroid' } of type spawn ...
Cancellation does work without "device.spawnAdded.connect" Cancellation does not work even if "device.enableSpawnGating()" is not called.
Environment data
Running on an ArchLinux frida-node bindings version 16.5.2 Frida server is on a Fairphone 4 rooted with magisk version 16.5.2
Tested code
The following code is based on https://github.com/frida/frida-node/blob/main/examples/cancellation.js, with added spawn gating.
Expected behavior
Program prints device Program prints any spawned process Cancellation triggers Program stops
Actual behavior
Program prints device Program prints any spawned process Cancellation triggers Program continues printing spawned processes without stopping
Cancellation does work without "device.spawnAdded.connect" Cancellation does not work even if "device.enableSpawnGating()" is not called.