Skip to content

unpack: FART capture on self-libart-patching extraction shells (+ props docs) - #6

Merged
1013503897 merged 2 commits into
masterfrom
unpack-fart-self-patching-shells
Sep 3, 2026
Merged

1013503897 merged 2 commits into
masterfrom
unpack-fart-self-patching-shells

Conversation

@1013503897

Copy link
Copy Markdown
Owner

Three fixes to the stealth unpacker so ArtMethod-level FART capture survives 51job's s.h.e.l.l, a method-extraction shell that maps a private libart copy and inline-hooks it at startup.

  • worker_delay_ms (new prop, default 0): sleep before the worker's first ART touch so the shell finishes patching libart before AttachCurrentThread/art::Get(). Without it the main thread SEGVs in the shell's own code (pc in its anon clone, writing libart .text, x27=PACIASP) before any hook is even installed.
  • KPM-gating: engage the shpte KPM (set_process_name/ghost/fshide) only for KPM paths (stealth/traceless/gcashfix/openat). A pure-Dobby run no longer targets the process — the KPM PTE-managing the target's libart collided with the shell's own libart patching (same SEGV).
  • multi-region dex read: DumpRegionsForPointers reads dexes by header.file_size, not just the VMA, so the app's multi-VMA structure dexes reconstruct whole (the burst scan's i+fsize<=rsize bound truncated them before).

Also: DumpMethodCaptures dumps the regions its captures reference, and native/src/unpack/README.md now documents the full runtime prop set + shell recipes.

Result: dexfind+trigger on 51job captured 364k+ CodeItems and the offline disassembly recovered the app's request-sign algorithm (HMAC-SHA256 + per-host keys) end to end.

Default behavior is unchanged for every other packer: worker_delay_ms defaults to 0, and the KPM is still engaged whenever a KPM path is used.

🤖 Generated with Claude Code

1013503897 and others added 2 commits September 3, 2026 16:15
51job's s.h.e.l.l extraction shell maps a PRIVATE libart copy at startup and
inline-hooks ~7 libart functions into it. That routine faults SEGV_ACCERR
(killing the app <1s in) the instant the unpacker worker touches ART, and the
app's dexes exceed a single VMA -- both defeated the dexfind+trigger path.
Three fixes let FART run and reassemble here; default behavior is unchanged for
every other packer:

- unpacker.cpp: add persist.kpmhook.unpack.worker_delay_ms (default 0). Sleep
  before AttachCurrentThread/art::Get() so the shell's startup libart-patching
  routine finishes before the worker touches ART. Without it the main thread
  SEGVs in the shell's own code (pc in its anon clone, writing libart .text,
  x27=PACIASP) before any hook is even installed.

- unpacker.cpp: engage the KPM (set_process_name/ghost/fshide) ONLY for runs
  that use a KPM path (stealth/traceless/gcashfix/openat). A pure-Dobby run
  merely targeting the process makes the shpte KPM PTE-manage its libart pages,
  which collides with the shell's own libart patching (same SEGV). Dobby-only
  runs now leave the process off the KPM's radar.

- codeitem_sink.cpp: DumpRegionsForPointers reads multi-region dexes by
  header.file_size (not just the VMA). The app's dexes span multiple VMAs; the
  plain VMA read and the burst scan's i+fsize<=rsize bound both truncated them,
  so big dexes never reconstructed.

Also: DumpMethodCaptures dumps the regions its captures reference (classdef
pointers) before keying captures.txt, so splice.py has a matching fixed.dex for
capture regions the pre-restore defs pass missed.

With these, dexfind+trigger on 51job captured 364k+ CodeItems and the offline
disassembly recovered the app's request-sign algorithm end to end.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@1013503897
1013503897 merged commit 1707c1e into master Sep 3, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant