Files
apk-reverse/skills/apk-reverse/references/precedents/README.md
T
inliver233 6cffc3d2ac Absorption pass: take the mechanics from four external skill repositories, keep our discipline
Four projects were cloned for comparison (reverse-skill, awesome-game-security,
android-reverse-engineering-claude-skill, MobileRE-Skill) and read for what they do that this
repository does not. None is vendored and none becomes a runtime dependency: what crosses over is a
phase order, a checklist or a command pattern, with the source URL and the retrieval date recorded in
the file that absorbed it.

The rule applied to every candidate: does this make a judgement easier or a verification harder? The
repository is a decision-and-verification layer, and the four things kept are all of that kind.

  new  scripts/scan_leaks.py            target identity scanned before publishing, with an explicit
                                        do-not-anonymize list and four RESULT=/exit states
  new  references/precedents/           the positive half of the record: route including dead ends, a
                                        grade per assertion, measured pits, and a write-back checklist
  new  scripts/svc_scan.py              does a libc-level hook structurally see this call at all
  new  scripts/anti_detect_probe.js     observer-only: name the check, and report the environment it reads
  new  references/desensitization-and-leak-scans.md
  new  references/dart-aot.md sections   the 32-bit snapshot's real string-record format

  check_repo.py now delegates the identity scan to scripts/scan_leaks.py and runs it over
  git ls-files, so the gate reads content instead of layout for the first time. An explicit file list
  cannot be narrowed by the default work-area exemptions -- that defect was caught by the gate itself.

Two claims that this repository had already written down turned out to be wrong, and both are
recorded as refuted rather than quietly rewritten:

  dart-aot.md   the armv7 string table was documented as [len*2 u32le][UTF-16LE]. It is not. The same
                extractor keeps 4,980 chained entries on arm64 and zero on armv7, and the byte layer
                shows the 32-bit record is [header u32][byte-count u32le][UTF-8 payload]: two adjacent
                literals carry 0x46 (70) and 0x48 (72), exactly their byte lengths. The zero was a
                format mismatch, not an empty table. The engine-version banner on the same target is
                66 bytes of "0.0.1" with a blank build id, so the documented regex returns a
                version-shaped lie.
  leak scan     the pass that added the scanner found 26 strong hits inside its own evidence file on
                the day it was written -- the fixture's literal match values, quoted to prove the
                rules fire. The corpus may contain values; the published surface may not.

Measured, not asserted. The check that fires was named on a public MASTG target: three arms with one
variable, the control alive at the end and the probe arm dead in about 300 ms, with strstr("frida") at
t=303 ms and no tombstone. Reproducibility is bounded honestly -- one full sequence in three arms, on
a target whose whole window is sub-second. svc_scan.py's two independent decoders agree on an
identical 214-site set, and ptrace-free dumping gained a negative boundary: a target whose dex is
deflated inside its APK has no whole-image dex in memory to export, for reasons that say nothing about
protection.

Also in this pass: the detector-locating pipeline (detection-and-anti-analysis.md Step 3) with its
branch conditions; the layered Java-to-svc descent and the dump's honesty boundary in
advanced-unpacking.md; a sourced capability-gap list in toolchain.md where every row is graded
URL-verified or measured; the RESULT=-token convention; and SKILL.md opening with an immediate-action
block, because the symptom index and the gates were sitting in the part of a long file nobody reads.

Gates: check_repo.py 0 problem, check_refs.py 0 dangling / 0 warning, check_budget.py 0 failure /
0 warning / 1 pre-existing note. The scan reports RESULT=leaks_found_strong_only, exit 0: four
endpoint/weak hits, all of them addresses from the RFC 5737 documentation range in usage examples.
2026-09-21 22:51:09 +08:00

6.1 KiB

Precedent library — what a pass got right, and how it got there

pitfalls.md is the negative catalogue: what went wrong. This directory is the other half — cases where the work actually converged, recorded so the route can be walked again instead of re-derived. The two do not overlap on purpose: a case here points at pitfalls.md by entry number rather than restating the failure, and a pitfall that already has a case does not need a second copy in prose.

Read a case when you are about to do this kind of work again — not when you are stuck. A case answers "what sequence produced a defensible result, and what did it cost"; when you are stuck the symptom index in SKILL.md is the faster route.

Why this exists at all

This repository's most expensive recurring loss is not ignorance. It is a conclusion that was correctly retracted and then re-adopted, because the retraction lived in a conversation while only the original claim was ever written to a file. Three of the cases below are exactly that shape: an attribution that was wrong, corrected by measurement, and corrected again. In each one the wrong version is the one that reads as more coherent, which is why it is the one that would be believed by a reader who only saw the summary.

A case therefore records the execution chain including the dead ends — the wrong turn, and the measurement that killed it. Without that part, the case is a success story, and success stories teach nothing that survives the next surprise.

The cases

Case Route it establishes Strongest claim in it Grade
flutter-plus-shell-case-1.md classify a hardened Flutter sample before trusting any dynamic result: a pid that keeps moving has to be attributed before it is explained the same drift was attributed to frida, then to memory pressure, then to the sample's own root-environment check — only the third survived observed (drift and its cause), unverified (that this generalises)
frida-spawn-hangs-zero-events-case-2.md a harness can manufacture the very negative result it is looking for: spawn leaves the process suspended, and CONFIG.autoStart follows before your configuration lands a zero-event trace was produced by two independent harness defects, not by the target observed (the mechanism, and the warning that now fires)
logd-broken-module-never-ran-case-3.md decide whether a hooking module ran at all, on a device whose log daemon is broken nine successful injections produced zero logcat lines; the only evidence was a file under /data/adb/lspd/log/ observed (both channels), inferred (the framework-bridge explanation)
l1-equal-length-patch-case-4.md the full chain from a two-byte dex edit to a visible change on screen, with a control build the dialog disappeared and the control build failed the same way first, which is what makes the four bytes responsible observed end to end
manual-grep-finds-what-nobody-grepped-case-5.md why a leak scan is a gate and not a document, told from this repository's own near-miss a shipped pass had to be corrected after the fact for identity a human grep found observed (the omission and the correction), inferred (that a scanner would have caught it)

Each case ends with an action checklist naming the repository files that should be written back to if you hit the same thing. A case that does not produce a file edit has not finished.

Template

Copy this skeleton. Keep the headings — the read-back check depends on them, and the grade column is the part that stops a hypothesis from drifting upward into a fact.

# <Title> — one line naming the conclusion, not the activity

## Metadata
| Field | Value |
|---|---|
| Context | what was being done, in one line |
| Cost | what it cost before it converged, measured |
| Outcome | what artifact or conclusion exists now |
| Evidence | the evidence files, by path |
| Related | `pitfalls.md` entries, and the neighbouring reference files |

## Assertions and grade
| # | Assertion | Grade | Evidence |
|---|---|---|---|
| 1 | ... | observed / inferred / unverified | exact command, file, or line |
Reserve `observed` for a claim with a command and its output behind it. An assertion whose
evidence is "the mechanism implies it" is `inferred`, and saying so is not hedging.

## Execution chain (including the dead ends)
The wrong turn, the measurement that killed it, and only then the route that held. Numbered,
because the order is the information: a reader who starts from the conclusion will pick the
wrong sequence.

## Pits
| Pit | Cost | What it was mistaken for |
|---|---|---|
| ... | measured number, or a count of re-runs | ... |
Use a cost you measured. "Two round trips" is a measurement; "a while" is not.

## Reusable pattern
The part that transfers to a different target with no editing. If it needs this target's names,
it belongs in the chain above instead.

## Write back to the repository
- [ ] `<file>` — <what to add to it, so the next reader does not pay this again>
- [ ] `<file>` — <index line, if a new file was created>

Rules

  • Grade every assertion, and grade it down when in doubt. observed means a command was run and its output is in docs/tool-verification/. "I reasoned it out" is inferred. This is the same standard references/long-task-discipline.md §Grade your own conclusions sets for a live record, and it is the reason a case is worth reading a year later.
  • Record the retraction with the claim. If an earlier conclusion was wrong, both versions belong in the case: the wrong one, why it was wrong, and what replaced it. Deleting the mistake loses the most transferable thing here.
  • Do not restate pitfalls.md. Point at the entry. A duplicated failure mode drifts out of sync with its original and then contradicts it.
  • One case, one route. A case that establishes three unrelated things establishes none of them; split it.
  • A case with no write-back checklist is a diary entry. The last section is what makes it knowledge the repository holds rather than knowledge the author had.