用途:在确认样本为 Rust 编译产物后,进行符号解译、泛型实例识别、所有权/析构模式理解,以及 async/await 状态机与 tokio、serde 等库模式分析;也可用于 Rust 恶意样本的静态还原。非 Rust 原生程序、已确认带壳样本不适用本技能。
主要能力:通过 _ZN(legacy)或 _RNv(v0)前缀、panic 基建符号、__rust_alloc/__rust_dealloc 等特征识别 Rust;用 rustfilt 批量 demangle(v0 与 legacy 通吃),Ghidra 11+ 内置 Rust demangler 可自动解;按泛型名分组统计 monomorphization 重复实例;沿 drop_in_place、Box/Arc/Vec/String 等符号定位生命周期与分配行为;识别 tokio::runtime::block_on、serde::de/ser 等库入口。
使用方式:先做识别,如 file sample、nm sample | head -20、strings sample | grep -iE 'rustc|rust_begin_unwind|panicking|__rust_alloc',并可用 readelf -p .comment 读取 rustc 版本指纹;再 demangle,如 nm sample | rustfilt > symbols.txt;随后按泛型分组、drop 调用、库符号逐项分析。工具安装示例:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh、apt install rustfilt、cargo install rustfilt。
限制与注意:符号被 strip 后恢复极难,Rust 无类似 Go pclntab 的恢复结构;monomorphization 会产生大量重复代码;panic 路径与正常路径交织;async fn 展开为状态机;v0 命名 c++filt 无法解析;panic=abort 产物缺少 unwind 表;no_std 产物无 std 运行时符号。动态步骤默认沙箱,静态优先。具体平台与版本细节以资料为准,未提供的信息暂未提供。