Toolchain guidance, observation ordering, and target-neutral records

Capability-first tooling guidance, plus removal of target identity from the repo.

Toolchain (references/toolchain.md):
- New ASC (droidasc) section + README Requirements row. An agent should reach for an
  indexer before any full decompile. Covers install, query subcommands, the division
  of labour with ddc (ASC locates, ddc reads), and its measured limits -- including the
  unverified-negative trap when a non-ASCII needle goes through a shell, and the
  mangled-class case where ASC is the only route.
- ddc: two measured limits -- a renamed class is unreachable via -c, and a decompiled
  body can be semantically wrong rather than merely ugly.
- New "Closing a capability gap": installing the missing tool IS the task, with measured
  install costs set against the cost of the workaround.
- New "Using the kit's scripts instead of writing your own", with two-tools-disagreeing
  as the bug detector it is.
- Ghidra section for the aarch64 case: headless invocation, the flattening caveat, and
  the "a decompiler cannot go where the data is not" boundary.
- HaE placed in Tier 3 as traffic triage, naming the three situations where it is the
  wrong next step.

Observation ordering:
- SKILL.md: new Tooling section with four obligations; G2 now requires a written
  capability inventory; symptom index gains four rows (silent feature loss with no
  request at all, telling your patch apart from the target's own behaviour, spawn keeps
  the Activity stack down, the device server being killed by the ROM).
- dynamic-frida.md: the patch-then-detach ordering, and device-server survival notes.
- New scripts/spawn_patch_detach.py and scripts/hook_patch_only.js.

Neutrality:
- docs/verification-jiongnew/ -> docs/tool-verification/. Target-specific transcripts
  dropped; all target identity removed. The record keeps the measurements and loses
  the specimen.
- No target identity remains anywhere in the tree.

check_repo.py: 0 problems. check_refs.py: 182 reachable, 0 dangling, 0 warnings.
This commit is contained in:
inliver233 committed 2026-09-20 19:14:36 +08:00
1 parent 90f7a58615
commit 206a2f5465
13 files changed
+601 -580

No files matched your search

@@ -0,0 +1,69 @@
// Minimal Frida probe: neutralise ONE native death site in memory, then report PATCHED.
//
// Intended for use with spawn_patch_detach.py. The write lands while attached; the
// driver then detaches so the app runs with no instrumentation present and its UI
// actually renders. Memory.patchCode writes survive detach; Interceptor hooks do not.
//
// Configure the four constants below from your own analysis. There is nothing
// target-specific here on purpose: the shape to look for is a short "recover the frame
// and return" epilogue that replaces a terminate call. Never substitute a NOP for a
// call that has live code after it -- the fall-through is the bug you are creating.
// See references/native-tamper-and-suicide.md.
'use strict';
// --- configure -----------------------------------------------------------------
var MODULE_NAME = 'libtarget.so'; // the module that holds the site
var FILE_OFFSET = 0x0; // byte offset of the sequence to replace
var PATCH_BYTES = []; // equal-length replacement bytes
var PRE_EXISTING = ''; // hex of PATCH_BYTES, space separated, for the idempotence check
// -------------------------------------------------------------------------------
var T0 = Date.now();
function el() { return ((Date.now() - T0) / 1000).toFixed(2) + 's'; }
function hx(p, n) {
try {
return Array.from(new Uint8Array(p.readByteArray(n))).map(function (b) {
return ('0' + b.toString(16)).slice(-2);
}).join(' ');
} catch (e) { return '<unreadable>'; }
}
if (!PATCH_BYTES.length) {
console.log('[!] PATCH_BYTES is empty -- configure this probe before using it');
send('PATCHFAIL');
} else {
var timer = setInterval(function () {
var m = null;
try { m = Process.findModuleByName(MODULE_NAME); } catch (e) { m = null; }
if (!m) return;
clearInterval(timer);
var at = m.base.add(FILE_OFFSET);
var before = hx(at, PATCH_BYTES.length);
console.log('[' + el() + '][i] ' + MODULE_NAME + ' base=' + m.base +
' bytes@0x' + FILE_OFFSET.toString(16) + ' = ' + before);
if (PRE_EXISTING && before === PRE_EXISTING) {
console.log('[' + el() + '][i] already carries the patch');
send('PATCHED');
return;
}
try {
Memory.patchCode(at, PATCH_BYTES.length, function (code) {
code.writeByteArray(PATCH_BYTES);
});
console.log('[' + el() + '][PATCH] now = ' + hx(at, PATCH_BYTES.length));
send('PATCHED');
} catch (e) {
console.log('[' + el() + '][!] patch failed: ' + e);
send('PATCHFAIL');
}
}, 10);
}
// Keep the message channel alive so the driver can see the probe is loaded. Cheap, and
// it gives a heartbeat you can read while waiting for the site to appear.
setInterval(function () { console.log('[' + el() + '][alive]'); }, 10000);
console.log('=== patch-only probe armed ===');