Thanks to visit codestin.com
Credit goes to github.com

Skip to content

out-of-tree llvm obfuscation pass plugin (dynamically loadable by rustc). || rust toolchain with obfuscation llvm pass.

Notifications You must be signed in to change notification settings

undef-i/ollvm-rust

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

ollvm-pass

基于 0xlane/ollvm-rust 修改,适配 LLVM 21 的 LLVM 混淆插件。通过 rustcopt 动态加载,无需重新编译 LLVM/Rust。

功能

支持以下混淆方式:

  • 间接跳转 (-irobf-indbr):加密跳转目标地址。
  • 间接函数调用 (-irobf-icall):加密目标函数地址。
  • 间接全局变量引用 (-irobf-indgv):加密全局变量地址。
  • 字符串加密 (-irobf-cse):加密 C 风格字符串(Rust 中不生效,已知问题)。
  • 控制流平坦化 (-irobf-cff):平坦化控制流。
  • 全部混淆:组合以上方式。

注意:仅在 GNU/Linux 测试,其他平台未验证。

安装

  1. 安装 LLVM 21 和 clang-21clang++-21
  2. 编译插件:
    cmake -G "Ninja" -S . -B build \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_C_COMPILER=clang-21 \
          -DCMAKE_CXX_COMPILER=clang++-21 \
          -DLLVM_DIR=/usr/lib/llvm-21/cmake
    cmake --build build -j $(nproc)

使用

Rust 动态加载

需要 Rust nightly 工具链:

rustup toolchain install nightly
cargo new helloworld --bin
cd helloworld
 cargo +nightly rustc --release -- -Zllvm-plugins="/path/to/libLLVMObfuscationx.so" -Cpasses="irobf(irobf-indbr,irobf-icall,irobf-indgv,irobf-cse)"

Opt 动态加载

clang -emit-llvm -c input.c -o input.bc
opt -load-pass-plugin="/path/to/LLVMObfuscationx.so" --passes="irobf(irobf-indbr,irobf-icall,irobf-indgv,irobf-cse)" input.bc -o output.bc
llc -filetype=obj output.bc -o output.o
clang output.o -o output

已知问题

  • 字符串加密 (-irobf-cse) 在 Rust 中不生效(参考)。
  • 控制流平坦化 (-irobf-cff) 未修复。
  • 仅 GNU/Linux 测试,Windows/macOS 未验证。

参考

致谢

About

out-of-tree llvm obfuscation pass plugin (dynamically loadable by rustc). || rust toolchain with obfuscation llvm pass.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.5%
  • CMake 0.5%