/Core

WIP LLVM Obfuscator CoreLibrary

Primary LanguageC++OtherNOASSERTION

Hikari

Hikari is a port of Obfuscator-LLVM with a few custom built passes.

Install

For macOS,Download from Releases page,Extract Hikari.xctoolchain to ~/Library/Developer/. Note that I do not personally use Xcode as such I'm not able to help with issues regarding Xcode Intergration

For other platforms, compile and install accordingly. See BuildScript Note that this repo currently contains only the LLVM Core, see Getting Started with the LLVM System for installing other components like Clang

Note that C++11 is required

Usage

Add one of the following to CFLAGS

enable-symobf Enable Symbol Obfuscation.Use with LTO  
enable-bcfobf Enable BogusControlFlow  
enable-cffobf Enable Flattening  
enable-splitobf Enable BasicBlockSpliting  
enable-subobf Enable Instruction Substitution  
enable-allobf Enable All Non-LTO Obfuscation  
enable-adb Enable AntiDebugging Mechanisms

An example of invoking everything from command line would be:
/PATH/TO/OUR/clang -mllvm -enable-allobf -Xlinker -mllvm -Xlinker -enable-fco main.m -flto
For Xcode, add something like -Wl,-mllvm,-enable-fco to Other linker flags

TODO

  • StringEncryption
  • Generate unobfuscated dSym
  • Improved CFG Obfuscation Algorithm
  • Complete Anti-Debuging

Pass Options

FunctionCallObfuscate

Pass -enable-fco to enable.FCO uses a json configuration to resolve symbols.For example {"AAAA":"BBBB"} means the pass should replace a call to function AAAA with a call to the result of dlsym(RTLD_DEFAULT,"BBBB")

By default configuration is loaded from ~/Hikari/SymbolConfig.json Pass fcoconfig=PATH to override

Intergrating with Xcode

  • Compile From Scratch or Download XcodeToolchain From Releases
  • Download Hikari.xcplugin from HikariProject/Resources
  • Install Hikari.xcplugin to /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
  • Under Project Settings. Search for Enable Index-While-Building Functionality to NO. As mentioned by obfuscator-llvm/obfuscator/issues/86
  • EDIT CFLAGS as you wish.
  • In Xcode->Toolchains, select Hikari

Troubleshooting

  • You might run into errors like ld: file not found: /Library/Developer/Toolchains/Hikari.xctoolchain/usr/lib/arc/libarclite_macosx.a. this is due to Xcode's Default Toolchain, located at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ contains stuff not packed into Hikari.Just copy corresponding directories over