Repository navigation
unpack: FART capture on self-libart-patching extraction shells (+ props docs) - #6
Merged
Merged
Conversation
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]>
…recipes Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, default0): sleep before the worker's first ART touch so the shell finishes patching libart beforeAttachCurrentThread/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.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).DumpRegionsForPointersreads dexes byheader.file_size, not just the VMA, so the app's multi-VMA structure dexes reconstruct whole (the burst scan'si+fsize<=rsizebound truncated them before).Also:
DumpMethodCapturesdumps the regions its captures reference, andnative/src/unpack/README.mdnow documents the full runtime prop set + shell recipes.Result:
dexfind+triggeron 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_msdefaults to0, and the KPM is still engaged whenever a KPM path is used.🤖 Generated with Claude Code