[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109771":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":13,"stars30d":13,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":15,"rankGlobal":10,"rankLanguage":10,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":10,"pushedAt":28,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":13,"starSnapshotCount":13,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},109771,"Exuvia","Huai-Tian\u002FExuvia","Huai-Tian","Deterministic Android unpacking pipeline for AI agents: zero-token mechanical analysis, LLM-outsourced bottlenecks, Rust-side verdicts.","https:\u002F\u002Ft.me\u002FHuaiTiann",null,"Rust",52,0,1,40,"GNU Affero General Public License v3.0",false,"main",true,[21,22,23,24,25,26,27],"ai-agents","android-reverse-engineering","android-security","deobfuscation","dex","security-research","unpacker","2026-11-08 05:50:42","2026-11-08 05:50:46","# Exuvia\n\n[简体中文](README_ZH.md) | English | [AI collaboration doc](README_AGENT.md)\n\n## 📖 Introduction\n\n**Exuvia** (蝉蜕) is a deterministic Android unpacking \u002F repair pipeline built for AI agents, aimed at the new generation of enterprise-grade packers. **Two product lines, one binary**:\n\n- **Unpacking (dissection + debt outsourcing)**: `exuvia packed.apk` produces the full dissection handoff (L1 skeleton + debt list + evidence slices); genuine intelligence gaps are compressed into work packages for an external LLM, settled back through the four-gate merge. Zero token cost on the tool side — it never calls a model and never pretends to understand; the word \"passed\" is one only Rust gets to say. Unpacking has two means, one goal: **static** dissection of the package as above, and **dynamic** extraction at runtime — the shell must eventually hand the legitimate DEX to ART, so a standalone collector binary lifts it there, shell-family agnostic by design (root required; kernel-driver physical memory I\u002FO with zero ptrace\u002Finjection traces in passive mode; coupled to Exuvia only through the versioned workorder \u002F manifest \u002F hygiene contracts trio, SKILL §10; transport is a single E2EE-encrypted TCP session — the on-device daemon reverse-dials the host, no adb anywhere; zero built-in scan strategy, zero built-in driver protocol, with a ditPro KPM profile shipped as the default). Static recon writes the collection work order through the same outsourcing loop; whichever means produced the DEX, it flows into repair below.\n- **Repair (dump → runnable APK)**: `exuvia repair packed.apk dumped.dex -o out.apk` — third-party dumpers are everywhere, but nobody repairs the dumped DEX back into an APK that actually launches (the shell's wrapper Application, stub dex, native loader assets, woven bytecode and frozen native stubs are still in the package). Pipeline: dump triage → class cleaning → deweaving → method-body restoration → manifest surgery → zipalign → v2 signing.\n\nThe ontology is deliberate: **body** (a single binary — including the embedded sandbox runner, fed to `python3 -I` via stdin, zero disk writes; and the embedded repair toolchain, extracted to a temp dir at runtime), **soul** (a single SKILL.md file carrying the methodology, the format fixtures that double as CI golden files, and the profile fence), **interface** (three protocol streams: handoff \u002F goal \u002F proposal, plus the collector contracts trio: workorder \u002F manifest \u002F hygiene). There is no schema file — the serde types are the format; `exuvia schema --dump` derives machine-readable views on demand.\n\n**Zero learning curve by design**: Exuvia does not rely on accumulated experience. The first analysis of an unknown packer already runs at peak performance because the judgment is injected through architecture (structured starting point, preloaded common sense, per-stub work packages, dual-anchor verification) — not through a fingerprint database that grows with history. When a new packer generation appears, that is once again \"a first time that feels like a second time\".\n\n> **Using an AI assistant (Copilot \u002F Claude \u002F GPT ...) for development on this project?** Read [README_AGENT.md](README_AGENT.md) first — it is written specifically for AI and contains the project's many **counter-intuitive design decisions and hard red lines**. Skipping it and editing code directly is very likely to reintroduce a decision that was deliberately overturned.\n\n## ✨ Features\n\n- **One-command repair: dump → installable, runnable APK** (product line b)\n  `exuvia repair packed.apk dumped.dex -o restored.apk [--dump third_party_dump.dex]...` — dump triage (dexdoctor heals the known dump pathology catalog P0-P11) → class cleaning (shell\u002Fforeign classes, zero false kills) → deweaving (bridge invokes restored to the framework calls they replaced) → method-body restoration (shell-extracted native stubs merged back from any source that carries the body; with no source, a framework-contract fallback guarantees install+launch+no-crash, with the boundary reported honestly; the dex2c translation family has a fourth source — bodies synthesized straight from JNI-semantics traces, recoverable with no dump at all) → manifest surgery (wrapper Application removed) → zipalign (the R+ install gate) → fresh v2 signature. **Closed through 12 rounds of on-device feedback on a real enterprise-packed sample — dumps from two different dumpers both run on real devices; the dex2c family's closed-loop APK (rebuilt with no dump, no reference) is device-confirmed as well.**\n\n- **Drag in, get a map — zero questions, zero tokens**\n  `exuvia packed.apk` produces the full dissection handoff: `REPORT.json` + `REPORT.md` (human half), `debt.json` (the honest blocklist), `evidence\u002F` (hash-anchored byte slices), `workspace\u002F`, `attempts.log`. Non-interactive is a hard constraint — any prompt would kill the agent scenario.\n\n- **Two debt kinds, both machine-decided**\n  `method-native-stub`: every `ACC_NATIVE` stub is located mechanically — JNI short-name and mangled-signature derivation → dynsym lookup → the method body sliced out of the `.so` (VA → file offset via PT_LOAD). `encrypted-payload`: every claimed-DEX file whose bytes are not DEX becomes an automatic debt entry — no entropy thresholds, just the mechanical fact — with a 64-KiB head slice, raw asset entropies listed as facts, and decrypt-routine candidates located mechanically (`JNI_OnLoad` symbol table hits, `.init_array` section positions).\n\n- **hunt: mechanical search for ciphertext coordinates (desktop runtime facts)**\n  Once the cipher family and key are established by facts (symbol tracing \u002F LLM reproduction), the segment's offset and length are a mechanically searchable finite space: `exuvia hunt --carrier \u003Cfile> --rc4 \u003Chex> [--rc4-stride\u002F--rc4-seed\u002F--rc4-jbias variants]` scans the full offset space while a verdict chain (zlib header → inflate → DEX magic → full-table parse) decides the length itself — a hit hands you exact coordinates, a miss is an honestly recorded negative fact. On-device frida hooks are thus removed from the main path.\n\n- **The outsourcing loop — the only place tokens burn**\n  `exuvia next --goal goal.json` packs a work package (scope-gate source + evidence references + guidance). An external LLM returns a `proposal\u002F` package: a pure decryption function plus test pairs whose expected values must come from independent format facts, never from the submitter's own output. The loop's driver always lives outside the tool.\n\n- **Four merge gates, verdict in Rust**\n  ① syntax\u002Fformat (serde with unknown fields rejected) → ② reconciliation (scope gate: only debt ids from the work package; byte-exact hashes; `accepts_equivalent` routing) → ③ semantics (**dual anchor**: structural assertions parse the DEX on the trusted side × byte tests in the sandbox — the two anchors never depend on the untrusted layer at the same time) → ④ settle: archive the artifact, drop the debt, append `attempts.log`. Rejections are structured `code + detail + hint` for agents to read, and they increment `attempts` on the claimed debt.\n\n- **L1 recovery on merge, and the onion loop opens the next layer**\n  A `recovered` claim whose output has DEX shape is archived as `workspace\u002F\u003Cdebt_id>\u002Frecovered.dex` — open it in jadx immediately; `exuvia analyze --dex` re-dissects it into the next layer's debt map (packers defend in layers: shell → strings → methods → VMP — the same outsourcing loop reuses each layer).\n\n- **Hardened sandbox, zero persistence**\n  The glue runner lives inside the binary as a string resource and is fed via stdin to `python3 -I` — no unpacking to disk (a security tool must not look like malware). Environment is cleared; CPU 10 s \u002F address space 512 MB \u002F fd 64 rlimits backstop a 5 s soft timeout; a text-level import whitelist guards misuse.\n\n- **Hostile-input hardened**\n  Every size\u002Foffset field is bounds-checked against the data length before any allocation — the DEX parser was battle-tested against a forged 126-GB allocation attack. A corrupt DEX is a *fact* (`magic_ok`\u002F`parse_ok`), never a crash of the whole run.\n\n- **Byte-deterministic outputs**\n  No timestamps, stable debt ordering, entropy rounded to 3 decimals: identical input produces byte-identical handoffs. Determinism is a protocol requirement, not a nicety — the double-anchored CI fixtures depend on it.\n\n- **CLI is the API (deliberately no MCP)**\n  Output is JSON across the board, with structured error codes documented in SKILL.md §5; exit codes split into exactly two semantic worlds — `installation-broken` (own components damaged: refuse to run, code 2) vs `unavailable` (external capabilities absent: annotate, never fail). `--profile` overrides the judgment embedded in the SKILL fence; `--resume` skips re-dissection idempotently; `--json` makes even `--version` machine-readable.\n\n- **Honest debt, vendor-neutral naming**\n  Debt entries carry facts and difficulty signals only — no cost estimates (a deterministic binary does not know token prices; you price them). Fingerprints, SOPs and processors are named by *technical family* (\"whole-file encryption — single segment\", \"JNI translation idiom\") — never by vendor name, by design and enforced in contributions.\n\n## 📐 The outsourcing loop\n\n```\nexuvia packed.apk ──► handoff\u002F   (REPORT.json+md · debt.json · evidence\u002F · workspace\u002F)\n        │                          all mechanical, zero tokens\n        │\n        │   read REPORT + debt, write goal.json          (semantic targeting is\n        ▼    — yours; the tool only matches machine facts          yours too)\n  exuvia next --goal goal.json ──► workpackage.json      (scope-gate source)\n        │\n        │   solve the package: pure decrypt function\n        ▼    + test pairs from independent facts         the only token-burning step\n  external LLM ──► proposal\u002F\n        │\n        ▼\n  exuvia unpack merge proposal\u002F\n        │   gate ① serde  ② scope+hash  ③ dual-anchor semantics  ④ settle\n        ▼\n  debt settled · workspace\u002F\u003Cdebt_id>\u002Frecovered.dex ──► validate, or loop again\n```\n\nTwo output paths per debt, chosen by cost comparison (yours): `recovered` (restore the original bytes) vs `equivalent` (write a functionally equivalent implementation) — the latter requires `accepts_equivalent` in the goal and passes behavioral differential tests instead of byte-level ones.\n\n## 🚀 Quick Start\n\nBuild from source (no release binaries yet — the planned release form is two platform binaries + SKILL.md + checksums, nothing else):\n\n```bash\ncargo build --release\n```\n\nPrerequisite: a system `python3` on PATH — it is the sandbox executor for merge-gate semantic verification and the runtime for the embedded repair toolchain, a *bound* component of the design (IDA-style assumption), never bundled; missing or fake = `installation-broken`, and the tool refuses to run rather than degrade. The repair pipeline's heavy dependency (`java` + dexlib2 jars) stays user-side (sources ship in-repo under `tools\u002Fdexlib\u002F`; the jar policy matches apktool.jar) — absent, the pipeline degrades honestly and reports it.\n\n```bash\n# 0) Repair a dump (the most common path; independent of the outsourcing loop)\n#     All shell markers removed + method-body restoration + v2 signing, one command:\nexuvia repair packed.apk dumped.dex -o restored.apk \\\n  --dump third_party_dump.dex    # optional: body-carrying third-party dump, repeatable\n\n# 1) Dissect (zero tokens)\nexuvia packed.apk\n\n# 2) Read handoff\u002FREPORT.json + handoff\u002Fdebt.json, then write goal.json.\n#    Semantic targeting is yours; every field is machine-decidable:\ncat > goal.json \u003C\u003C'EOF'\n{\n  \"$schema\": \"exuvia.goal\",\n  \"goal_version\": 1,\n  \"targets\": [{ \"kind\": \"payload\" }],\n  \"levels\": { \"default\": \"L2\" },\n  \"tracks\": [\"A\"],\n  \"accepts_equivalent\": true,\n  \"stop\": \"targets-satisfied\"\n}\nEOF\n\n# 3) Pack the stub work package (mechanical filtering, no ranking, no verdict)\nexuvia next --goal goal.json\n\n# 4) External LLM reads the package, returns proposal\u002F\n#    (pure functions bytes→bytes, test pairs built from independent format facts)\n\n# 5) Return flow: four gates, dual-anchor verification, Rust-side verdict\nexuvia unpack merge proposal\u002F\n\n# 6) Downstream self-check of the handoff\nexuvia unpack validate handoff\u002F\n```\n\n## 🧩 CLI Reference\n\n| Command \u002F flag | Semantics |\n|---|---|\n| `exuvia packed.apk` | Drag-and-drop dissection → handoff\u002F |\n| `--resume` | Idempotent: skip re-dissection when the handoff's APK sha256 matches |\n| `--profile \u003Cfile>` | Override the judgment embedded in the SKILL.md fence (TOML; parse failure = installation-broken) |\n| `--json` | Output is JSON anyway; this flag JSON-ifies `--version` too |\n| `--version` | Version + supported protocol versions |\n| `exuvia repair \u003Cpacked.apk> \u003Cdumped.dex> -o \u003Cout.apk> [--dump \u003Cdex>]... [--reference \u003Cdex>]` | **Repair pipeline**: dump → runnable APK (triage → cleaning → deweaving → body restoration → surgery → zipalign → v2 sign); `--dump` = body-carrying third-party dumps (production path, complementary), `--reference` = the unpacked original (internal testing only) |\n| `exuvia next --goal \u003Cfile>` | Pack the work package (scope-gate source) |\n| `exuvia analyze --dex \u003Cfile> [--out \u003Cdir>]` | Onion re-analysis: feed a recovered DEX back → the next layer's debt map (default handoff-2\u002F) |\n| `exuvia hunt --carrier \u003Cfile> [--rc4 \u003Chex>]... [--xor \u003Chex>]... [--rc4-stride N --rc4-seed A:B --rc4-jbias N] [--out \u003Cdir>]` | L2 parameter-space search: known algorithm+key → mechanical recovery of ciphertext coordinates (hunt.json + hits\u002F; negative facts recorded honestly) |\n| `exuvia schema --dump \u003Chandoff\\|goal\\|proposal>` | Derive machine-readable format views on demand (no static schema files) |\n| `exuvia unpack merge \u003Cdir>` | Proposal return flow: four gates → settle |\n| `exuvia unpack validate \u003Cdir>` | Handoff self-check before downstream consumption |\n\nExit codes: **2** = `installation-broken` (own components; refuse to run — there is no degraded mode); **1** = a merge rejection with a structured `code + detail + hint` on stderr; **0** = success — and a handoff with remaining debt *is* success (debt is a deliverable, not a failure).\n\n## ⚙️ Requirements\n\n- **OS**: Linux x64 (current CI baseline). A Windows exe is a planned release target; the OS-level sandbox currently implements Linux rlimits, with the Windows Job Object path scheduled for the release engineering phase.\n- **Build**: Rust stable (edition 2024).\n- **Runtime**: a system `python3` (sandbox verification layer + runtime for the embedded repair toolchain — bound, never bundled); the repair pipeline additionally needs user-side `java` + dexlib2 jars (sources ship in-repo under `tools\u002Fdexlib\u002F`; the jar policy matches apktool.jar); no root required; expect hostile inputs by default and prefer a disposable snapshot environment.\n- **trackb\u002F user-side toolkit** (so_emulator \u002F jnitrace \u002F trace2smali \u002F dexcontainer \u002F disasm — 21 tools, sources shipped with the repo): heavy dependencies (unicorn, capstone) install user-side via pip; absence = `unavailable` annotation, never a failure.\n- **No other runtime is shipped or required**: the pipeline carries no Python distribution of its own.\n\n## ⚠️ Project Status\n\nResearch-grade, v0.1. Both product lines have been battle-tested against a real enterprise-packed sample:\n\n- **Repair pipeline**: closed through **12 rounds of on-device feedback** — dumps from two different dumpers (compact-repacked \u002F memory-expanded layouts), repaired by the same pipeline, **both run normally on a real device** (install, launch, no crash). A local five-gate acceptance suite (zip \u002F pathology \u002F strict decompilation \u002F content residue·multi-dex union \u002F signature) must be ALL GREEN before anything ships.\n- **dex2c translation family (second battle)**: the family whose method bodies are translated into JNI C++ with the original Dalvik absent from every in-package carrier — recovered **with no dump and no reference**: tail-container DEX rebuild (dexcontainer, sha1+adler self-check oracle) → JNI call-sequence tracing (jnitrace: runtime warm-up \u002F clinit static-field seeding \u002F null-guard dual-arm enumeration, all automatic; TLS-built strings materialize offline) → smali synthesis (trace2smali, ART verifier rules built in) → closed-loop APK **device-confirmed** (2026-10). Family knowledge entered into SKILL §8.\n- **Unpacking**: the reference shell's full crypto chain is solved (variant RC4, SM4-CFB, key derivation, runtime-table permutation; the tail-container key is confirmed runtime-constructed — static exhaustion found zero hits, honestly recorded as the one remaining blocker — coordinates in [README_AGENT.md](README_AGENT.md) §0.5); the protocol loop (`packed.apk` → next → merge → validate) graduated on synthetic samples (CI-enforced fixture↔serde double anchoring, byte-deterministic outputs).\n\nHonest scope notes — static\u002Fsimulated analysis cannot solve these, and the debt list says so instead of pretending: device-environment-derived keys (IMEI, build fingerprint), network-fetched payloads, streamed DEX assembly, and full semantic recovery of VMP (Track C \u002F L3 territory — \"equivalent semantics\", not original bytes). One known semantic boundary of the repair line, reported honestly: **when a shell-extracted method has no body-carrying source at all, the framework-contract fallback guarantees install + launch + no crash, but that method's own business logic is absent** (the output JSON reports the synthesized count).\n\nThe end state is defined behaviorally, not byte-exactly: an installable, runnable APK with behavioral parity. Restoring the original bytes is the most reliable *means* for one- and two-generation packers; equivalent implementations serve where original bytes never existed.\n\n## 🚫 Non-Commercial Statement\n\nThis project is initiated by the developer out of personal interest and for technical research purposes, and is **non-commercial** in nature:\n\n- **Permanently Free**:\nThis project is completely free, with **no paid features, memberships, subscriptions, or in-app purchases**. All features are fully accessible to all users.\n\n- **No Sponsorship Channels**:\nThe author has **never opened any sponsorship channels**, nor does the author **accept any financial donations** — to maintain the project's neutrality and purity.\n\n- **Non-Profit Purpose**:\nThis project involves no commercial operations, and the author derives no direct or indirect financial benefit from it.\n\n- **Research-Oriented**:\nThis project is consistently positioned for **security research, packer adversarial research, software testing and education** — providing a research tool for the community, not a commercial product. Any commercial use of this project is the user's own initiative and is unrelated to this project.\n\n- **License is AGPL-3.0-only — no commercial exceptions.**\nThis project is offered under the terms of the AGPL-3.0 (see LICENSE),\nand every use must comply with that license in full. AGPL was chosen over\nGPL deliberately: it closes the \"wrap it as a paid API without releasing\nthe modifications\" loophole. The author does not offer, and will not\nnegotiate, dual licensing, commercial exceptions, or proprietary\nredistribution. Reselling this project for profit while ignoring AGPL\nobligations is copyright infringement.\n\n- **Attribution and statement integrity (AGPL section 7(b) additional term):**\nUnder AGPL-3.0 section 7(b) — the license's own mechanism for\n\"requiring preservation of specified reasonable legal notices or author\nattributions\": redistributing this project (modified or not) requires\npreserving this non-commercial statement and the author's attribution;\nremoving, altering, or obscuring it is a license violation. This is not\na further restriction on AGPL rights — it is the notice-preservation\nchannel AGPL explicitly provides.\n\n- **Official channels only:**\nObtain this project only from this repository (GitHub) or other\nofficially designated channels. Builds from any other source are\nunofficial, unverified, and used entirely at the downloader's own risk.\n\n## ⚖️ Disclaimer\n\n- **Purpose Limitation**:\nThis project is intended for **security research, packer\u002Fprotector adversarial research, auditing applications you own or are authorized to test, and educational purposes** only.\nDo not use this project for any illegal purposes (including but not limited to software piracy, cracking and redistributing third-party applications, or circumventing technical protection measures to infringe copyright).\n\n- **Analyze only what you legitimately hold.**\nThe user is responsible for having lawful access to any sample analyzed. This project does not target any specific hardening vendor: packers may be *identified* (industry practice), but fingerprints, SOPs and processors are named by technical family — vendor names are never written, and community contributions are held to the same rule.\n\n- **Validation corpus provenance (zero third-party samples):**\nEvery validation sample of this project is **the author's own open-source application**, packed by the author (the \"original + packed\" pairs are held privately) — the repository distributes no sample binaries and publicly analyzes no third-party app; the comparison logic is public (`ci\u002Fverify\u002F`), the samples stay private.\n\n- **No vendor code:**\nThis project contains and distributes no packer vendor's code, library, or SDK — shells are analyzed, never bundled; shell components in repair output are removed, not redistributed.\n\n- **A recovery tool, not a patcher — by design and by law:**\nExuvia restores or faithfully reproduces behavior; it does not tamper. Signature self-check logic is treated like any other logic and faithfully restored — an \"always-true\" patch is permanently outside the feature surface. That line is also the legal boundary between research recovery and cracking.\n\n- **Consequences Warning**:\nUnpacking and repackaging may violate the terms of service of third-party software and the laws of your jurisdiction. The developer and contributors **are not responsible for any legal liabilities or other consequences** arising from such use.\n\n- **Research Quality**:\nThe pipeline is research-grade and validated so far against two real enterprise packer families (plus synthetic fixtures); results may be incomplete (the debt list is a deliverable, not a failure). Run analysis on samples in an appropriate isolated environment.\n\n- **No Warranty**:\nThis software is provided under the terms of its license, **without any express or implied warranties**, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.\n\n- **Limitation of Liability**:\nTo the fullest extent permitted by applicable law, **in no event shall the author or contributors be liable** for any direct, indirect, incidental, special, or consequential damages arising out of or in connection with the use or inability to use this software, even if advised of the possibility of such damages.\n\n- **User Responsibility**:\nUsers assume all legal responsibilities arising from the use of this project.\n\n- **Final Interpretation**:\nThe final interpretation of this disclaimer belongs to the author of this project.\n\n## 💬 Contact\n\nYou are welcome to submit issues, suggestions, and bug reports via GitHub Issues.\n\n## ⭐ Support the Project\n\nIf you find this project helpful, or if you recognize its value in technical research, consider giving it a ⭐ on GitHub.\n\nYour support helps more people discover this project, and also lets the author feel the significance of continued maintenance.\n\nThank you for your recognition.\n","Exuvia 是一个面向 AI 代理的确定性 Android 应用脱壳与修复流水线，专为应对新一代企业级加固壳设计。其核心采用 Rust 实现，提供静态反编译分析（生成结构化拆解报告与待外包任务清单）和动态内存提取（基于物理内存 I\u002FO 的 root 级 DEX 提取，零 ptrace\u002F注入痕迹）双路径 unpacking，并支持将任意来源的 DEX dump 修复为可运行 APK（含 manifest 修正、字节码解交织、方法体恢复、v2 签名等完整流程）。所有 LLM 调用完全外置，工具端零 token 消耗，判断逻辑由 Rust 代码严格裁决。适用于安卓安全研究、自动化逆向分析平台集成及 AI 驱动的移动应用威胁评估场景。",2,"2026-11-24 04:37:25","CREATED_QUERY"]