rustrip 0.1.1

Make stripped Rust binaries readable again: recover slice-string boundaries, demangle symbols, and reconstruct panic source locations from release/stripped ELF/PE binaries.
Documentation

rustrip

CI Fuzz CodeQL SonarCloud Codacy Coverage Mutants MSRV License

Make stripped Rust binaries readable again.

rustrip recovers three classes of artifacts that disassembly tools miss on stripped, release-mode Rust binaries:

  1. String boundaries — &str fat pointers (ptr, len) are reconstructed into individual labeled strings instead of one stretching blob of bytes.
  2. Demangled symbol names — both legacy _ZN...E and v0 _R... mangling, including generic-parameter context, are rendered as core::fmt::write instead of <core::fmt::Write as core::fmt::Write>::write_fmt.
  3. Panic site source paths — every core::panic::Location is recovered as path/to/source.rs:line:col, letting you map a binary back to its source tree.

Output goes to a CLI table, JSON, or a Ghidra / Binary Ninja Python script that re-applies the annotations to whichever view you open it in.


Demo

rustrip terminal demo

$ rustrip target/release/rustrip.exe

  vaddr               kind     label
  ------------------  -------  --------------------------------------------------------
  0x1400b87d0         panic    /rustc/.../library/std/src/io/stdio.rs:854:20
  0x1400b9728         string   /rustc/.../library/alloc/src/wtf8/mod.rs
  0x1400b9888         string   /rustc/.../library/alloc/src/fmt.rs
  0x1400b9b40         string   BOLD
  0x1400b9b48         string   DIMMED
  0x1400b9b52         string   ITALIC
  0x1400b9b69         string   UNDERLINE
  0x1400b9b93         string   DOTTED_UNDERLINE
  ...
  0x1400c2100         symbol   rustrip::binary::Binary::parse
  0x1400c2280         symbol   rustrip::analyzers::strings::StringsAnalyzer::analyze
  0x1400c2450         symbol   rustrip::output::table::Table::render

  131 annotations recovered in 0.02s
$ rustrip target/release/my_app -f ghidra -o annotations.py
$ # paste annotations.py into Ghidra: Window > Script Manager > New > Python

Install

cargo install rustrip

Or grab a prebuilt binary from Releases.

Use

# Default: CLI table

rustrip path/to/binary


# JSON for scripting / piping

rustrip foo.exe -f json -o foo.json


# Ghidra script (paste into Script Manager)

rustrip foo.exe -f ghidra -o foo_ghidra.py


# Binary Ninja script (paste into Python console)

rustrip foo.exe -f binja  -o foo_binja.py


# Read from stdin

cat suspicious.bin | rustrip - -f json


# Skip analyzers you don't need

rustrip foo.exe --no-strings --no-symbols


# Limit string recovery length

rustrip foo.exe --max-string-len 256

Open the generated script in Ghidra (Window > Script Manager > New > Python > paste), or in Binary Ninja's Python console, and run it on the open view.


How it works

                    rustrip pipeline

  ┌─────────────┐     ┌──────────┐     ┌──────────────┐     ┌────────────┐
  │   goblin    │────▶│  Binary  │────▶│  Analyzers   │────▶│  Output    │
  │ ELF/PE/Mach │     │  vaddr↔  │     │  strings     │     │  table     │
  │   parser    │     │  offset  │     │  symbols     │     │  json      │
  └─────────────┘     │  readers │     │  panics      │     │  ghidra    │
                      └──────────┘     └──────────────┘     │  binja     │
                                                             └────────────┘
  • binary.rs — goblin-backed model with vaddr <-> file-offset translation and size-aware readers (read_ptr, read_at_vaddr). All pointer arithmetic uses checked_add — malicious binaries with u64::MAX vaddrs can't overflow.
  • analyzers/ — independent passes. Each walks the binary and emits typed annotations. Add a new analyzer without touching the others.
  • output/ — backends receive only the merged annotation list and render it. Add a new backend without touching analyzers.

The architecture is intentionally narrow: only data analysis, no full disassembly in v0.1. That keeps the tool fast (sub-second on multi-MB binaries) and reliable on stripped output where disassembly is messy.


Verification

rustrip is verified by 14 free tools across 8 CI workflows:

Tool What it checks Result
cargo test 188 tests across 6 test suites 0 failed
cargo clippy Lints (pedantic + nursery) 0 warnings
cargo fmt Format consistency 0 diffs
cargo audit Dependency vulnerabilities 0 advisories (49 deps)
cargo-deny Supply chain: licenses + bans all ok
cargo-mutants Mutation testing kill rate 88.4% (222/274)
cargo-fuzz Coverage-guided fuzzing (6 targets) 0 crashes
cargo-llvm-cov Line + function coverage 94% lines, 98% functions
cargo-nextest Flaky test detection (3 retries) 0 flaky
MIRI Undefined behavior detection 0 UB
CodeQL SAST (GitHub) 0 alerts
semgrep Custom SAST rules 0 findings
SonarCloud Code quality + coverage dashboard link
Codacy Second-opinion static analysis dashboard link

CI runs on Linux, Windows, and macOS for every push and PR.

A bug this suite actually caught

Verification isn't just a badge wall. In v0.1.1, adversarial-input testing found a real script-injection bug before it shipped to a tagged release:

Recovered strings were embedded into Ghidra/Binary Ninja scripts as Python raw literals (r'''...'''). Raw strings can't end in a backslash — and a recovered &str ending in \ (trivial in a Windows path, and trivially craftable in a hostile binary) desynced the closing quote and corrupted the entire generated script, silently dropping every annotation.

Fixed by switching both backends to fully-escaped normal string literals, then verified end-to-end by compiling the generated scripts under CPython — see CHANGELOG.md. This is exactly the class of bug cargo-fuzz and the property/metamorphic suites exist to catch on a tool whose whole job is parsing untrusted, potentially adversarial binaries.


Roadmap

  • v0.1 (now): string-slice recovery, symbol demangling, panic-site recovery. ELF, PE, Mach-O. CLI + table / JSON / Ghidra / Binary Ninja.
  • v0.2: instruction-aware slice recovery via iced-x86 (catches slices that aren't stored as static (ptr, len) pairs).
  • v0.3: enum discriminant and monomorphized generic-type recovery.
  • v1.0: native Ghidra and Binary Ninja plugins; type propagation.

Reliability & threat model

rustrip is intended for reverse-engineering and malware triage. It must not panic on adversarial input. The pipeline returns an empty or parser-error result rather than crashing — verified by 6 fuzz targets running 4 hours nightly in CI with zero crashes found.


Contributing

PRs welcome. See CONTRIBUTING.md. CI must pass before review — all 8 workflows are required.


License

MIT OR Apache-2.0 — pick whichever you prefer.