unhusk finds the author's own functions in a stripped Rust binary. No symbols, no debug info, no signature database.
It reads metadata the Rust compiler leaves in every binary and cannot easily
remove. For each place the program can panic, the compiler records the source
file, line, and column, so a crash can print panicked at src/main.rs:42. That
data survives strip. unhusk reads it back, classifies each path, maps it to
the function that references it, and ranks the functions the author most likely
wrote.
It is meant to complement library-identification tools, not replace them. FLIRT and Microsoft's RIFT work from the other side: they label library code so the remainder is the author's. unhusk labels the author's code directly, from a positive signal. Run both and less of the binary is left unlabelled.
Every recovered path is one of three kinds:
| Path | Owner |
|---|---|
src/… |
the author's code |
…/cargo/registry/… |
a third-party dependency |
/rustc/…/library/… |
the standard library |
A function is scored by how many distinct author panic-sites it contains. A
library function that inlined one of the author's closures picks up one; a real
author function usually references several of its own. The default keeps
functions with at least two. --rule-nodep and --rule-c are stricter
variants on the same curve.
cargo build --release # Rust 1.70+, no C dependenciesOr Docker:
docker build -t unhusk .
docker run --rm -v "$(pwd)":/work -w /work unhusk <binary>unhusk <binary> # ELF or PE, auto-detected
unhusk <binary> --precision # high-confidence tier only
unhusk <binary> --min-anchors 3 # stricter
unhusk <binary> --min-anchors 1 # every anchored function
unhusk <binary> --rule-nodep # also reject functions carrying dep paths
unhusk <binary> --crate <name> # name the root crate (usually auto-detected)
unhusk <binary> --json # machine-readable
unhusk <binary> --validate <unstripped> # score against debug-info ground truth--boundaries, --locations, and --json --tier-from feed
unhusk-plugin, which annotates
the binary in Ghidra or IDA. unhusk --help lists every flag.
--json emits one record per function:
{
"start": "0xd25af",
"end": "0xd38a5",
"size": 4854,
"tier": "strong",
"anchor_count": 6,
"anchor_files": ["akiranew/src/path_finder.rs"]
}This one is from a stripped Akira ransomware sample: six author panic-sites in one function, recovered with no symbols and no debug info. winnow turns functions like it into YARA-X rules.
Measured on 168 crates, 667 builds, ~14.6M labelled functions, ground truth
from debug info. The corpus was split by crate before the rule search and 36
crates were held out. Default cargo build --release; 95% intervals
bootstrapped over crates.
| rule | precision | author functions named | author code covered |
|---|---|---|---|
--min-anchors 1 |
86.2% [82.7, 88.8] | 18.2% | 52.5% |
--min-anchors 2 (default) |
90.5% [87.5, 92.9] | 8.5% | 40.6% |
--rule-nodep |
92.8% [90.1, 94.9] | 6.8% | 25.6% |
Read the last column. Panic-sites collect in functions with enough control flow to fail, which are the large ones, so naming 8.5% of the author's functions puts 40.6% of the author's code in front of you. The base rate is 6.1%, so even the loosest setting is a 14x lift over guessing.
Coverage is capped by the mechanism: only 18.2% of author functions contain a panic-site at all (52.5% by bytes), and no rule can exceed that. Precision is strongest on synchronous CLI and systems code, weaker on async and generic-heavy code.
- A function that cannot panic has no anchor and is not found. Recall is partial by design.
- A library function that absorbed an author's inlined closure (
sort_by, rayon, futures combinators) can be misread as author code. Same rate on ELF and PE, no general fix. - Code reached only through trait objects or function pointers reads as library code; the scan follows static call edges.
--remap-path-prefixrewrites the paths unhusk classifies on, and a hostile build can swap author and dependency labels. unhusk reports when a binary looks scrubbed rather than returning nothing.panic_immediate_abortremoves the metadata but changes how the program runs. One ransomware family already ships remapped.- x86-64 only, ELF and Windows PE. PE is strong/single tier only. No Mach-O, no aarch64.
- Precision is measured on open-source crates. There is no debug info for real malware, so results on wild samples report behaviour, not accuracy.
docs/architecture.md— the full system design.docs/panic-location-internals.md— the compiler mechanics and what they mean for what you can trust.docs/rule-taxonomy.md— what each rule name means and which predicate the tool implements.bench/run1/REPORT.md— every rule against every build configuration, with intervals.unhusk_pe_poc.py— the whole PE method in one dependency-light file (pip install pefile iced-x86).
Cindy Xiao's write-up on panic metadata and SentinelLabs' Project
0xA11C (RECON 2024) established that Rust's panic-location data survives strip
and identifies authorship. unhusk automates it for x86-64 ELF and PE without
IDA and adds a ranked classifier with a measured false-positive rate.
GoReSym does the same job for Go's
pclntab.
Apache-2.0. See LICENSE.