21 Commits
Author SHA1 Message Date
root 93ec493d02 Absorb game-reserve's Unity/Lua and AssetBundle reverse engineering
Adds references/unity-lua-and-assetbundles.md: Unity + Lua containers, the Lua 5.1
header-byte tamper, the loader's bytecode-only check, the CRC manifest the game
actually reads, UnityFS partial-encryption windows, rebuild traps (layout loss,
dependency null, compressed == raw), TextAsset read-back, and half-encrypted Mono
assemblies behind a publisher shell.

Extends framework-runtimes with LayaAir Conch (DCC checksum and loader patch),
recon with resource completeness and the encryption map, repack-and-sign with
package rename, split-apk with the narrow apktool merge, dex-patching with
call-deletion instead of method rewrite, and packers with PairIP as a
target-selection signal. Adds pitfalls P51-P53 and two symptom rows.

Registration: one reference row, two capability rows (both partial/unverified),
two evidence-summary rows, two route-inventory rows, two coverage bullets, one
known-limitation bullet, and EXTENSION-game-reserve-2026-11.md. Gates and pytest
green.
2026-11-09 20:35:44 +08:00
root 90d9bd3e57 Audit the ref drop folder a third time, and measure what it can measure
ref/ still held the sixteen write-ups absorbed on 2026-10-24, with unchanged mtimes, so this pass
re-read them instead of re-absorbing. Nine generalisable mechanisms were still missing: Pyarmor's
outer container layer and its three nonce scopes (plus the live dump being structurally incomplete),
fixed-width arithmetic in the 12-byte key VM, Python compiled to native extensions, the rebuilt
libil2cpp ELF fingerprint (JNI_OnLoad / own DT_INIT / SHT_LOUSER), a container VM's block schedule,
driving String::NewLen over every literal index as an oracle, VMs that live in the managed layer,
array literals materialised by InitializeArray instead of .rodata, framework crypto primitives as
the hook target, a comparison gate as a prefix oracle, and the debugger's own stop policy
(SIGPWR/SIGXCPU suspend-to-crash, one database per activity).

One absorbed claim was wrong and is corrected: python-bytecode-recovery section 5 said an unset
nonce[15] decrypts the first block plausibly and then diverges. Counter mode has no such state --
the same nonce differing in that one byte changes the keystream from block 0, measured at 16/16
bytes.

verify_ref_claims_10c.py carries the three device-free checks. Its first draft was decorative -- the
comparison check counted work inside the loop it was measuring -- so the comparators are now
compiled at -O2, every check has a negative control that must come out empty, and the verdict
travels as a return value rather than through a global list. tests/unit/test_verify_ref_claims_10c.py
injects the wrong claim into each check and requires the failure.

Registration: two capability rows (il2cpp-managed-layer-bytecode-vm unverified,
comparison-cost-oracle observed for the host half), two evidence-summary rows, one new and three
extended route-inventory rows, three coverage bullets. SKILL.md and routing.md unchanged; the record
is EXTENSION-ref-absorption-2026-10c.md. Gates and pytest green (796 passed).
2026-10-27 00:33:49 +08:00
root 068280a180 Verify the absorbed claims on the host and label them per claim
Adds docs/tool-verification/fixtures/verify_absorbed_claims.py: seven device-free checks covering the mask identity, the PKCS#7 length law, zero-fill versus skipped offsets, the hidden-salt search, compression drift, Python percent-encoding, and AES CTR/CBC/ECB separation.

The AES run falsified an absorbed claim: zero prefix-XOR does not imply a stream cipher (CBC and ECB show it too). The discriminator is a one-byte flip -- 1 changed byte for CTR, all following blocks for CBC, one block for ECB -- and protocol-reverse section 7 now states that, with the capability row recording the correction.

Labels are now per claim rather than per section: observed where a host command produced output, inferred for rules derived from the mechanisms, unverified for anything needing a device, a JDK, a lz4 binding or a VM sample. native-vm-recovery's claim-strength paragraph is aligned with the repository definition, and the cipher row moves to inferred.

Gates and pytest green.
2026-10-25 12:19:37 +08:00
root 45ba13c0f3 Absorb three write-ups on dump timing, native VM devirtualization and encrypted bodies
vm1: dump window at android_dlopen_ext entry, raw-syscall reader, zero-filled holes; predicate-first patching with tiered ordering; module-filtered signal attribution.

vm2: devirtualization to a straight-line (op, args) program with constant table, output map and template; version binding; per-node validation.

vm3: three black-box cipher probes, involution wrappers, encoding/compression drift; a certificate-derived salt inside the signature digest.

Also adds pitfalls P49-P50, three capability rows (all partial/unverified), the evidence/route records and EXTENSION-ref-absorption-2026-10b.md. Renumbers native-vm-recovery section 11 to 12. Gates and pytest green.
2026-10-25 12:10:41 +08:00
dabao1955 f497180e35 Fix the corpus count, recalibrate the token estimate, add a PR template
- check_budget.py counted scripts/__pycache__/*.pyc in its corpus note, so the
  same commit reported 27 scripts on a machine that had run the suite and 16
  on a clean checkout. The routing gate said 16 throughout; two gates
  disagreeing about one tree was the finding.
- TOKENS_PER_CHAR was calibrated against a 67,011-character SKILL.md and the
  docstring's arithmetic (0.30 characters-to-tokens) did not describe that
  measurement. Re-measured here: 54,983 chars -> 12,906 tokens = 4.260; the
  constant and both comments now carry the number this tree measures.
- test_budget_measurement.py pins the corpus exclusion, so a bytecode cache
  cannot re-enter the count and quietly change it again.
- .github/PULL_REQUEST_TEMPLATE.md carries what CONTRIBUTING.md asks a
  contributor for: what was run, the four labels, what has to move with the
  change, and the boundary that was not exercised.
2026-10-24 14:55:10 +08:00
root f3863f070c Absorb sixteen write-ups on IL2CPP, linkers, VM protectors and Pyarmor
Add four references for protected IL2CPP metadata, linker-level SO repair, VM-protector idioms and Python bytecode recovery, plus the generalizable mechanisms they exposed in the existing topic files.

Register the routes in the symptom index, routing tables, capability matrix, evidence summary, coverage docs and both READMEs. Every absorbed claim stays unverified: no metadata was decrypted, no loader reimplemented, no VM traced and no Pyarmor sample unpacked here.
2026-10-24 14:17:54 +08:00
dabao1955 bd6dd0c59c Absorb the Unity and IDA debug-server write-ups
Two reference files, both absorbed rather than measured and labelled unverified
throughout:

- unity-runtime.md: Mono versus IL2CPP from the shipped files, Il2CppDumper over
  libil2cpp.so + global-metadata.dat with the metadata magic as the encryption
  check, the four-step IDA import order, frida-il2cpp-bridge, the
  dnSpy-Unity-mono patch set, and the audit probes for a report deliverable.
- ida-so-debugging.md: ABI-matched dbgsrv, root server, am start -D plus the
  JDWP handshake that actually releases the process, and the
  extractNativeLibs=false failure where the library is mapped from base.apk and
  no breakpoint can bind.

The registration surface moves with them: two symptom rows mirrored into
routing.md (with its stale row counts corrected), the reference index, a Unity
section in framework-runtimes.md, a debugger row in dynamic-frida.md's
alternatives table, pitfall P48 for the silent no-bind, the capability matrix
(blocked-unity-il2cpp-react-native-ios narrowed, two partial/unverified rows
added), evidence-summary, coverage-and-limits, route-inventory,
known-limitations and both READMEs.
2026-10-21 22:19:26 +08:00
dabao1955 aa9af54854 Absorb gaps from three public reverse-engineering skills
Batch 1 (full): Kotlin original-name recovery (new reference + zero-dep
kotlin_name_recovery.py mining @DebugMetadata/@Metadata.d2/jadx rename
comments, with -o/-p/--grep query modes); jadx advanced flags and a
Fernflower/Vineflower second-engine tier in toolchain.md; BuildConfig
sweep habit in recon.md; WebSocket/long-connection state-chain section
in protocol-reverse.md.

jsvmp-only (batches 2-3): A/B/C recovery ladder with black-box reuse
boundary and a wire-parameter family index in jsvmp-recovery.md; new
js-ast-deobfuscation.md pipeline layer (family detection, per-family
pass order, safe-rewrite rules, minimal bootstrap eval, residue metrics)
with js_obf_detect.py weighted detector.

Wiring: routing.md/SKILL.md symptom+index rows, coverage-and-limits,
route-inventory, evidence-summary, capability-matrix (+3 entries,
labels kept honest: scripts observed on fixtures, absorbed methodology
unverified). 12 new unit tests.

Also: silence two environment-dependent mypy errors (yaml/frida
sentinel assignments) and bump mypy python_version 3.9 -> 3.10 with the
trade-off recorded.

Gates: check_repo/check_refs/check_budget/check_commands/check_routing
PASS; pytest 787 passed; flake8 clean; mypy clean.
2026-10-20 11:54:59 +08:00
dabao1955 8f32bb5e29 Bump actions version 2026-10-20 10:35:15 +08:00
root 9c2b23f7ce Revert "[temp] Use codeberg machine"
This reverts commit 2a6d972a0f.
2026-10-20 10:27:53 +08:00
root 00e11ee9af Revert "[temp] Fix workflow error"
This reverts commit b8dbd60b02.
2026-10-20 10:27:44 +08:00
root caa981b7e7 Absorb the jsvmp series: JS VMP recovery, and a round-trip-tested loader decoder
A new documented route for logic protected as a private JS opcode stream (jsvmp):
recognition signals, the call-it-first route, stack- and register-machine reading,
AST instruction extraction, the four JS evaluation traps, constant folding and
control-flow recovery. Every procedure is inferred (absorbed from three public
write-ups, anonymized; none run on a real target) and labelled so.

The one shipped piece is the loader decoder (base64 -> varint -> ZigZag), measured
against its own round trip (2,016 values exact, canonical varint/ZigZag layouts
pinned, truncation raises) and it decodes the write-up's own sample literal end to
end. Wired into the symptom index, routing tables, coverage ledgers and the
capability matrix; RN/Hermes still not covered, with the jsvmp carve-out stated.

Also clears two warnings: an E302 in the new script, and the long-standing
check_commands warning where a tool-verification transcript quoted check_budget.py
with its result inline (annotations moved to a continuation line, content intact).

Ran: check_repo/check_refs/check_routing/check_commands/check_budget (all exit 0),
flake8 clean, pytest 763 passed / 199 skipped / 25 xfailed.
2026-10-19 22:33:01 +08:00
dabao1955 eca9c19ee4 Fourth audit pass: seccomp as anti-instrumentation, and the anti-debug sweep
Two focused audits: the seccomp article under the lens of seccomp as the thing
that blocks your tools (not just a sandbox fact), and a corpus-wide sweep for
anti-debug material against the detection file that owns the topic.

The seccomp audit's strongest finding was repo-internal: advanced-unpacking
claimed seccomp filters were among the 5.10-gated layers "closed" on the 4.14
reference device -- while the repo's own extension notes observed Seccomp: 2
active on that very device, and the hardening file says "any modern kernel".
The contradiction is resolved in favour of the measurement: seccomp is now
named as the one syscall-layer mechanism NOT closed there. The hardening row
gains the full decision set (TRACE hands a syscall to your tracer; KILL_PROCESS
is the action that impersonates a detector), the bionic-installs-at-init timing
with its unverified-network marker (the cnb.cool mirror carries frameworks/base,
libcore and art but not system/seccomp or bionic -- the URLs to retry are
recorded at the claim), the external-tracer-exempt mechanism note (a filter
evaluates the installing process's own syscalls, so "they seccomp-blocked my
attach" is structurally wrong), and Seccomp_filters>1 as the target-installed-
filter signal.

The detection funnel gains the fourth cause its environment table lacked: the
process's own filter denying the agent's syscall -- Seccomp: 2 is the normal
state of every zygote-forked app, and the discriminator is a SIGSYS/SYS_SECCOMP
tombstone naming YOUR syscall, vanishing in the control run. This also finally
interprets the Seccomp field anti_detect_probe.js has been capturing all along.
Snowblind (2024) lands as a named pattern only -- recognition strings in the
third-party-builds marker table and a Step-2C rationale row; the filter+handler
implementation stays out on the stated line: recovery changes the analyst's
observation channel, weaponization makes the target's policy stop applying.
svc_scan.py learns syscall 277; seccomp-tools joins the toolchain table as an
offline filter reader with unverified grades.

The anti-debug sweep's verdict was the opposite shape, stated plainly: on this
topic the corpus is the shallow party and the repo is the owner -- TracerPid,
loader discipline, Frida-detection specifics are all already covered deeper,
and no corpus-driven table was manufactured. What it did add: the
explain-the-target half of SELinux policy reading (wildcard grants, attribute
memberships, missing type transitions -- why the app reaches what you thought
was closed, with the read/inject boundary drawn), the magiskpolicy one-liner
for the measured frida-server denial, and the three kernel-observation gate
knobs (kptr_restrict, dmesg_restrict, perf_event_paranoid) in the ladder rule.

Gates re-run: routing coherent, 414 section references zero dangling, repo
clean (after check_repo caught a broken string literal this pass introduced --
the gate did its job), pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 22:08:14 +08:00
dabao1955 ce227a13c5 Third audit pass: WebView as a probing channel, source-verified against AOSP
Three re-audits under new lenses -- the WebView/JS-bridge as an active probe for
hidden APIs and core logic (not just a config risk surface), environment blind
spots, and jvm-art internals -- each instructed to verify claims against the
cnb.cool AOSP mirror. The subagents' network was denied, so the mirror checks
were run in the main session: WebView/WebView.java and WebSettings.java javadocs,
platform.xml, art/runtime/hidden_api.cc, ActivityThread.java, and
libcore's DexPathList.java were all fetched and cited.

The probing lens rewrote system-ipc-audit.md section 3 around what the audit
found: the bridge-inventory hook over-reported (it printed every declared method;
since API 17 only @JavascriptInterface-annotated public methods are exposed --
javadoc-verified, with the targetSdk<17 legacy caveat), the risk table gained a
defaults column so absence stops being read as off (setAllowFileAccess defaults
true through targetSdk 29; the FileURLs pair has been false-and-deprecated since
API 16), and the DevTools entry was split into its two channels (chrome://inspect
self-discovers; the forward is for /json, socket found via /proc/net/unix) with
the process-wide and debuggable-auto-enable gates stated. New: the five-step
probing playbook -- global diff, dictionary probe (enumeration of the injected
object returns empty on modern WebView), arity/type oracle with the parallel
logcat watch (a Java exception stack can name the handler class without any
hook), return-oracle calibration, and the origin-gate read -- each routed back to
the Java class for an ordinary hook.

jvm-art: the hidden-API boundary sentence in dynamic-frida.md was directionally
right and mechanically wrong; it now states the real policy (targetSdk>=28
gating; greylist warn-only; blocklist and greylist-max-X deny -- verified against
hidden_api.cc), the caller-domain mechanism that explains why Frida's bridge
passes where app reflection fails, and the debuggable/policy exemptions. The
classloader walk (pathList -> dexElements -> Element.dexFile, field names
verified against current main) joins the frida-dexdump route as the hand-rolled
fallback that also says which loader owns a dex.

Environment: wireless debugging/pairing (Android 11+, pairing vs connect ports,
plaintext-TCP caveat), the -d downgrade gate (INSTALL_FAILED_VERSION_DOWNGRADE is
a build-type fact), --user N multi-user handling, and run-as as the cheapest
non-root inspection route. One auditor correction was REJECTED by verification:
current-main platform.xml assigns the shell uid only INTERNET, so the proposed
"shell holds INSTALL_PACKAGES/INJECT_EVENTS" rewrite was itself wrong; the
existing measured claim stays, now with the platform fact recorded beside it.

Gates re-run: routing coherent, 412 section references zero dangling, repo clean,
pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 21:52:42 +08:00
dabao1955 2bb54a72fb Second audit pass: fill gaps and correct drift, with verification where possible
Five read-only re-audits of the source material under a different lens -- not "is
it covered" but gap-filling, drift correction, and a user-assisted framing in
which the AI names the hook point or command and the human builds, runs, and
pastes back. The lens change earned its keep: the audits found drift that the
coverage lens could not, including two errors in what this repository had itself
absorbed.

Drift corrected, worst first:

- native-and-so.md: the absorbed syscall example loaded #0x47 (71, sendfile) --
  the source article's "real libc fragment" mislabels its own bytes, and the
  absorption inherited it. Now #0x40 with the mislabel named, the bionic wrapper
  epilogue (cmn x0,#0x1,lsl#12; b.cs) added as the discriminator between libc's
  own svc sites and a protector's inline ones, and the "no X8 load means data"
  claim softened to match svc_scan.py's nr=? semantics.
- system-ipc-audit.md: the generated-proxy example named installPackage, dead on
  modern IPackageManager -- swapped for getPackageInfo (already this skill's own
  hook) and IPackageInstallerSession.commit. Transaction-code guidance now says
  read the TRANSACTION_* constants, do not count the .aidl. getCallingUid gains
  its app-process reading semantics (own uid; uid 1000 on relayed callbacks --
  the "the system is calling my app" misread). service call gains the full type
  tags, the automatic interface token, and the default-binder-context boundary.
  The binderfs path variant and binder_calls_stats enable are recorded.
- packers.md: "dlopen not found = your bug" was one cause wearing three faces --
  now the namespace/DT_NEEDED/ABI triage with the classloader-namespace logcat
  discriminator and the 7.0+/8.0 gates; plus the extractNativeLibs="false"
  caveat on add-a-file tests, matching what so_constpatch.py already refuses.
- lsposed-and-modules.md: LSPatch paragraph re-labeled per evidence -- the
  delivery-class reasoning stays repo reasoning, the absorbed facts now carry a
  network-verified marker (upstream README: dex+so insertion, rootless, min
  Android 9; LSPosed active as of 2026-10-14). The api:100 parenthetical no
  longer implies a rewrite requirement.
- dynamic-frida.md: the LD_PRELOAD row gains its version gates (7.0+, Treble 8.0).

Gaps filled: signed-vs-unsigned branch suffixes and PAC/BTI recognition with the
SIGILL-on-patch consequence (native-and-so); the on-disk oat/vdex artifacts
check with the InMemory and quickened-opcodes gates, cross-linked from the
"decoder you did not write" rule (advanced-unpacking); the hook-point map --
funnel vs hop, ATMS/install/session gates stated (system-ipc-audit); the
interactive gdbserver escape hatch in detection Step 2, with the
frida-specific-vs-tracer-generic discrimination, and the user-session command
core in the toolchain row; the Hook vocabulary table translating instructions
into MethodHookParam calls, javadoc-verified, closing the one point where the
user-assisted loop forced a repo exit (lsposed-and-modules); cross-links from
the neutralization and TLS hook-body tables to their delivery vehicles.

Gates re-run: routing coherent, section references zero dangling and zero
warnings, repo clean, pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 21:32:41 +08:00
dabao1955 8c00c88035 Add the AArch64 reading layer the native file assumed
native-and-so.md taught how to find and hook JNI calls in a stripped library but
never said what the listing itself means: registers were named only incidentally
(pitfalls P43 assumes "the AArch64 argument registers" as known), the frame
pattern appeared in examples without explanation, and the addressing shapes were
nowhere. The source notes' ARM64 essentials 00-02 are exactly that missing layer,
and the original scoping pass had filed the whole series under "language teaching"
after reading only its debugging chapter -- same silent-truncation failure mode
the article audit already caught twice.

New section "Reading AArch64 -- registers, addressing, frames", placed after the
call-site recipe it underlies: the register role/saved-by table with the Wn-
zeroes-the-high-half truncation trap, the AAPCS64 argument rules including the
separate floating-point channel and the JNI consequence (env X0, thiz X1, user
args X2 -- the reason the vtable shape above loads from X0), the canonical
prologue/epilogue with the X29 chain identified as what every backtrace walks,
the six addressing shapes on sight (including SXTW-vs-UXTW and the adrp+add PIC
pattern the source notes omit but every string xref wears), movz/movk immediates
with the byte-patching consequence, and the mov-x8-plus-svc syscall shape tied
back to what svc_scan.py actually locates -- including the data-not-code reading
of an svc hit with no X8 load nearby.

03 (GCC inline-asm syntax) and 05-07 (ROP, shellcode, overflow exploitation)
stay out by design: development and exploitation material, not lookup value for
reading a library during a reversing task. Provenance and strength labels at the
point of use, retrieval date included. Gates re-run: routing coherent, 409
section references zero dangling, repo clean, pytest 751 passed / 194 skipped /
25 xfailed.
2026-10-19 21:09:36 +08:00
dabao1955 2f6b26f4dd Close the gaps an independent audit of the source articles found
The milksu integration was audited a second time, independently: four read-only
passes, each taking a group of the source articles and verifying the coverage
claims against the whole repository (references and scripts), with instructions
to contradict rather than confirm. Their findings corrected the prior pass in
both directions and drove every change here.

The audit's most useful correction was against the integration itself: the
ActivityThread.currentApplication() Context idiom had been reported missing
while it ships working in scripts/rpc_template.js and scripts/sig_probe.py --
the pass had audited only references/. The fix is a cross-link, not absorption.
Two more claims were narrowed (advanced-unpacking covers the classloader lab,
not the dynamic-proxy lab; readelf coverage lives in toolchain.md, not the
files first proposed), one attribution was repaired, and one provenance note
was added: the absorbed Binder hook is not the article's script -- the source
hooks Binder.transact with server-side getCallingUid() semantics inside; the
form kept here is corrected and now says so.

What the audit found genuinely absent, now integrated (all labelled unverified
or inferred with the retrieval date at the point of use):

- system-ipc-audit.md: generated-proxy hooking (decoded arguments beside the
  raw transact), the debugfs binder node/ref view for "why does my hook never
  fire", two new Intent signature rows (intent-scheme handoff, ClipData URI
  grants), am start/broadcast action-data-extras driving forms, the Intent
  monitor with live nested-Intent detection, the deep-link getData triage,
  three config rows the earlier table silently truncated (JavaScript, DOM
  storage, mixed content), the loadUrl dynamic hook, the logcat Console
  fallback channel, the four-surface static WebView pass, and the attestation
  KeyDescription/OID reading with the teeEnforced extraction discriminator.
- lsposed-and-modules.md: LSPatch as the fourth route -- module-class
  authoring, repack-class delivery, runs on unrooted phones; plus existence
  proofs for the resource-hook and constructor/field/hook-all API surface.
- dynamic-frida.md: the scripts' own Context idiom cross-linked with the
  Android 9+ hidden-API reflection boundary; dynamic proxy as an interception
  primitive; the LD_PRELOAD-closed-on-Android row in the non-live table.
- toolchain.md: the lldb-server remote recipe, with the attach-is-detection
  pointer.
- java2c-and-jni-sinking.md: the __<proto> mangling decode route step 2
  silently depended on.
- advanced-unpacking.md: the local-reference cap hazard on active-invocation
  loops.
- native-and-so.md: the JNI width/type map beside the vtable shape.
- recon.md: the MODE_WORLD_READABLE/WRITABLE row the earlier table dropped.

Gates re-run: routing coherent, 409 section references with zero dangling,
repo clean, pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 21:05:08 +08:00
dabao1955 526d487f1a Fill the reading-layer gaps the IPC reference exposed
The first milksu integration only took the system-boundary material and dismissed the
workflow content as overlapping deeper files. That dismissal was asserted, not audited;
auditing it found five places where the repository owns the procedure but not the
reference material the procedure leans on:

- dex-patching.md: a reading-level smali cheat sheet (type descriptors, register
  conventions and the .registers coupling, the five instruction families that carry
  control flow, obfuscation signatures). The file taught how to edit a method you can
  already read; nothing taught the reading.
- recon.md: the sensitive-behavior grep table (shell-outs, JS bridges, mutable
  PendingIntents, WebView width, dynamic dex loading, intent redirection) -- the
  signature-check section had one pattern, the behaviour sweep had none.
- detection-and-anti-analysis.md: the named Java-level root checks and their one-line
  neutralizations, as the concrete form of Step 2A's "simple, localised check" --
  scoped to the named detector, never a blind stack.
- tls-and-cert.md: the two OkHttp-path client sites (CertificatePinner.check,
  SSLContext.init) that the OkHttp section previously pointed at without naming, each
  annotated with what it honestly buys.
- native-and-so.md: the JNIEnv vtable call shape for reading JNI calls in a stripped
  library, with the offset-calibration caveat.

All absorbed material is marked unverified with the retrieval date (milksu.org,
2026-10-19) at the point of use; syntax and layout facts that follow from documented
platform behaviour are marked inferred. Gates re-run: routing coherent, 409 section
references with zero dangling, repo clean, pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 20:29:03 +08:00
dabao1955 60224a26b9 Add the system-IPC audit reference (Binder, Intent, WebView, SELinux, attestation)
The reference set owned the app's own wire (protocol-reverse.md) and the in-process
runtime (dynamic-frida.md), but not the platform boundary between them: what the app
asks system_server to do over Binder, which Intent/JS-bridge inputs an unmodified
build exposes, why an avc: denied is blocking instrumentation, and what a Keystore
attestation check means for a rooted-device workflow. That gap is where several
long detours start -- a hook that could never fire because SELinux says the domain
cannot reach the target, or a "detection" that is actually a server-verified
attestation no client patch can satisfy.

Everything here is absorbed from an external notes source (milksu.org, Android
internals notes, retrieved 2026-10-19) and is labelled accordingly: the commands and
hook scripts are unverified in the coverage-and-limits.md sense -- reported by someone
else, never run by this repository -- while the platform mechanisms they rest on
(AIDL codegen arithmetic, kernel-filled caller identity, FLAG_IMMUTABLE since
Android 12) are inferred from documented AOSP behaviour, with a note that each fails
loudly if wrong. The strength note at the top of the file states this before any
content, and each script carries its own unverified marker, so a reader cannot
mistake a starting point for a measured procedure.

Routing gains one row next to server-api.md. Gates re-run: check_routing.py
coherent (53 rows / 51 files), check_refs.py 0 dangling over 408 section
references, check_repo.py clean, pytest 751 passed / 194 skipped / 25 xfailed.
2026-10-19 20:25:12 +08:00
dabao1955 cd1df50a2a Complete the xvmp IR virtualizer end to end and measure the de-virtualization chain on a real fixture
The public xvmp tree ships a compiler half that was never compiled (no TU
includes the virtualizer headers; on dev trees they do not build), a weak
empty vm_exec stub, silent skips for unsupported IR, and a companion article
describing an earlier prototype that is not in the tree. This change completes
and measures the chain:

- Completed toolchain, merged into all four omp branches of that tree: gated
  new-PM pass wiring (-mllvm -irobf-irvm, section .irvm), FORMAT v3 bytecode
  (8-byte aligned slots, explicit load/store widths, stable CC_ cast kinds,
  per-index GEP byte scales, branch condition = operand 0), a strong-symbol
  vm_exec interpreter with a 23-check unit suite, and a VMP.h user header.
  Virtualized vs native output identical at -O0/-O1/-O2 on all four
  branches. One branch's ungated IRVM call in Obfuscation::runOnModule
  (rewrote .irvm functions in plain native builds) removed; IRVM is
  strictly flag-gated.

- Fixture measured end to end (fco+bcfobf+subobf+IRVM build): native-identical
  output; 17,961-step guest trace via VMP_TRACE; 24.6M-instruction host trace
  via a ptrace single-stepper; vm_handler_slice yields 95,184 segments / 18
  unique signatures; the fla outer state machine separates as a shuttle class,
  round-boundary segments split the trajectory, positional alignment names
  every handler segment (59/59 in a round; counts match the guest histograms
  exactly), zero unmapped with --opcode-map.

- Tooling hardening measured on the real fixture: opcode maps key by
  signature (first-block keys collide under a shared dispatch successor);
  apply_map keeps first-block keys as fallback, regression tests added.

- Environment boundary recorded: frida stalker does not work in these
  containers (measured past the syscall layer: primitives pass, agent loads,
  zero denied syscalls; the failure is inside the injected agent's hook
  machinery), an outer ptrace tracer conflicts with frida spawn, and the
  ptrace stepper is the working host capture path. Design lesson: a pure
  virtualized call can still be LICM-hoisted by the compiling optimizer.

Records: EXTENSION-sampling-crash.md SS5-SS6 (final-state rewrite),
known-limitations.md, ete-diff-tracing.md SS5, vm_handler_slice.py header,
capability matrix.
2026-10-16 14:45:03 +08:00
root ab22b225ff Hardware pass: hardware watchpoints, ETE differential tracing, kernel-side event injection
Add the layer under the software tooling, in the repository's shape: what runs
on a host is measured, and every device-bound or kernel-bound piece is a gated,
labelled template.

- scripts/hw_watch.py: arm64 hardware watchpoints/execution breakpoints. WCR/
  BCR encoders with the 8-byte-window and alignment rules (unit-tested to the
  canonical 0x1FFD/0x3F05), a self-contained on-device ptrace helper that
  compiles clean as a static aarch64 ELF (observed: cross gcc 16.2), adb
  orchestration, and hit decoding to module+offset. The stealth ledger is
  stated three times on purpose: the ptrace route leaves TracerPid visible.
- scripts/ete_capture.py: CoreSight ETE capture with the five gates (kernel
  era, coresight sysfs, cs_etm PMU, perf-with-CORESIGHT, permission), the
  perf/OpenCSD build recipe, and the per-thread record wrapper whose
  --control one-instruction run must pass before any real capture.
- scripts/trace_diff.py: differential reduction of two execution traces into
  first-divergence / divergent regions / blocks-unique-to-each-side.
  Producer-agnostic: Stalker BLK logs (raw or run_probe-wrapped) and decoded
  cs_etm address streams alike, host-tested on synthetic flattened-dispatcher
  fixtures.
- scripts/kernel_instrument_scaffold.py: KPM/LKM watchpoint + register-rewrite
  templates plus an honest userspace carrier; every kernel file carries a
  NOT COMPILED AND NOT LOADED banner that verify enforces, and the
  register-rewrite action is fenced as experimental in the template itself.
- references/hardware-watchpoints.md, references/ete-diff-tracing.md,
  references/kernel-event-injection.md: the mechanism, the gates, the traps,
  and the composition recipes (watch the key buffer; diff two runs; flip the
  decision at the trap), with hand-offs instead of duplication.
- Registration: 3 symptom rows (SKILL.md + routing mirror), 3 reference rows,
  4 script rows, coverage/route-inventory/evidence rows, capability-matrix
  entries, known-limitations entry, eval case 4, README trees and coverage
  paragraphs in both languages, and three EXTENSION evidence records stating
  exactly what was measured on this host (encoders, compile, fixtures,
  generate/verify) and what was not (no watchpoint armed, no cs_etm stream,
  nothing kernel-side compiled or loaded anywhere).

Hardware pass 2: SPE/BRBE crash forensics, address symbolization, VM de-virtualization

Calibrated against the two public obfuscator implementations the user supplied
(dpkg123/ollvm-aosp-toolchain: Hikari-family and Pluto-family flattening, the
xvmp IR virtualizer at 63fec41f/9b7cf75e; fetched read-only into
tools/_work/refs, git-ignored). Source facts observed, runtime inferred.

- scripts/trace_addr2sym.py: runtime addresses -> symbol + static offset,
  zero-dependency ELF64 (PT_LOAD vaddr<->file-off conversion, .dynsym/.symtab,
  stripped section+off fallback). Host-verified against a real cross-compiled
  aarch64 .so with readelf as the independent cross-check, plus a hand-built
  minimal ELF covering vaddr!=offset; accepts hw_watch hits, trace mod+off
  keys, or raw address lists. Fixes on the way: --base int coercion, and
  nearest-below symbol semantics for PCs in inter-symbol gaps.
- scripts/vm_handler_slice.py: slice an interpreter trace into handler
  segments (dispatcher detection = histogram top + predecessor diversity; the
  first 4x-margin rule refused the calibrated fixture itself and was replaced),
  signature clustering, open-tail handling, and the guest-opcode trajectory via
  an optional handler->opcode map. Calibrated against xvmp's documented shape:
  vm_exec(code,size,vm_args,num) stubs, boxed arguments observable before
  interpretation, 11 opcodes + 19 arithmetic sub-ops, const-materialization
  dispatch as a distinct segment.
- references/hardware-sampling-and-crash.md: SPE (data flow without a known
  address; PC + data address per sample), BRBE (branch records when a crash
  stack cannot be trusted), the crash loop (tombstone -> branch records ->
  symbolize), and what each adds to the OLLVM/VMP routes. All
  documented-and-gated: no SPE sample or BRBE record was captured here.
- Flattening-recipe corrections from source: Hikari keeps a frame-resident
  switchVar written through an indirect pointer with scramble32-permuted cases;
  Pluto stores switchVar/switchXor rolling-XOR so memory only ever holds noise
  -- hardware-watchpoints.md's state-variable recipe now distinguishes the
  families, and ete-diff-tracing.md carries the family table plus the xvmp
  shape. AntiDebugging injects raw svc inline asm with randomized fields, so
  byte signatures cannot survive it; semantic site-location can.
- Registration: 3 symptom rows (untrustworthy crash stack; runtime addresses
  needing symbols; interpreter loop reading as noise), reference/script rows,
  coverage/evidence/capability-matrix entries, README trees in both languages,
  and EXTENSION-sampling-crash.md recording exactly what was measured (real .so
  symbolization, slicer fixtures, the slicer's self-found dispatcher-rule bug)
  and what was not (no SPE/BRBE capture, no hardened binary ever traced).

Fix all PR #1 review findings by severity; un-entrench the tests that pinned them

Major (device-breaking / wrong results):
- hw_watch: match the arm64 user_hwdebug_state slot ABI (address register
  first, control second -- the swap armed nothing correctly)
- hw_watch: every post-seize error path now clears slots and detaches;
  PTRACE_O_EXITKILL turned an analysis failure into a SIGKILL of the target
- hw_watch: forward genuine target SIGTRAPs (raise/tgkill/int3); only ptrace
  event stops are consumed -- the reference's signal-preservation promise
- hw_watch: run checks push/build/chmod and the helper's exit status; a dead
  capture is RESULT=blocked, never ok-no-hits
- hw_watch: decode offsets from the module base, not each mapping's start
- ete_capture: --control now requires the control record to DECODE
  (perf script event lines), the documented gate, not just a zero exit
- ete_capture: -o before the -- workload separator in --cmd mode; all
  values shell-quoted into su -c; stale remote perf.data removed first;
  perf exit status checked (timeout's 124 is the normal window end)
- kernel scaffold: --set-reg restricted to x0..x30; the rewrite is gated by
  its own breakpoint event so a watchpoint hit cannot run it; LKM pins the
  task (get/put_task_struct) across registration and calls the four-argument
  register_user_hw_breakpoint; --break rows initialize .addr/.len/.bp_type
  (there is no .pc member); --id validated against the module-id grammar
- trace_addr2sym: exact module matching (path or basename, never substring);
  load bias aligned against the PT_LOAD (bias = start - (foff - p_offset)
  - p_vaddr); PCs outside the ELF span are refused instead of landing on the
  last symbol; --json stdout is a pure document (RESULT= in text mode only)
- trace_diff: block keys need 0x or >=8 hex digits (PIDs/counts no longer
  parse); vm_handler_slice: dispatcher needs predecessor diversity, no
  frequency-margin fallback; both JSON outputs pure (check_commands' rule)

Minor/nitpick:
- capability-matrix + evidence-summary: trace reduction status ok->partial
  (no real-target producer ran it; the file's own definition of ok)
- hardware-sampling-and-crash.md and the script examples carry --elf
- kernel-event-injection.md no longer claims the callback's first statement
  is a filter (it prints unfiltered; the filter is a required change)
- Elf64 caches symbol addresses for per-row bisect
- docstring coverage of the touched surface: 16.67% -> 100%

Tests: every json.loads workaround stripping RESULT= is gone; new regression
tests cover the slot ABI, release-on-error, SIGTRAP forwarding, non-first
mapping offsets, -o placement and su -c quoting, the control decode gate,
x31/--id refusals, the guarded rewrite, outside-ELF PCs and bias math,
short-token refusal and the dispatcher margin rule. The minimal-ELF fixture
now packs a full 8-field Elf64_Phdr (its 7-field pack silently shifted
p_memsz onto p_align). 739 passed; flake8/mypy and all five gates clean.

Address the follow-up review on 0bd8dfe (6 findings)

- ete_capture: two-layer quoting for the control-record, decode and cleanup
  commands -- shlex.quote spliced between literal single quotes broke out of
  su -c for any spaced output name; --seconds must be positive (timeout 0
  disables the timer), refused before any adb check
- kernel scaffold: --set-reg now refuses sp/pc as well (the template has no
  rewrite path for them; a generate that silently drops the action is the
  misleading kind of success); both templates arm with a sampling period
  (LKM via hw_breakpoint_init, KPM spells out sample_period=1) -- a zero
  period is a non-sampling event whose callback never fires: armed, silent
- trace_addr2sym: contains_vaddr tests each PT_LOAD's loaded span instead
  of the whole-file extent; a PC in the unmapped gap between segments is
  refused rather than named after the nearest symbol below
- trace_diff: a bare all-digit token is indistinguishable from a date or
  count, so block keys need 0x or a non-decimal hex digit; a date-only log
  stays refused as a capture failure

Tests: two-layer quoting with a spaced control name, --seconds refusal,
sp/pc in the rejection list, sampling-period assertions for both templates,
a two-segment gap fixture, and a date-only parser case. 743 passed; flake8,
mypy and all five gates clean.
2026-10-15 15:33:28 +08:00