LLVM-Obfuscator C/C++ 混淆编译的深入研究(ios 和android双平台)

本文详细探讨了LLVM-Obfuscator,一个用于C/C++代码混淆的开源工具,旨在增强代码安全性。介绍了LLVM-Obfuscator的混淆方法,包括InstructionsSubstitution、BogusControlFlow和ControlFlow Flattening,并提供了在iOS和Android平台上集成和使用LLVM-Obfuscator的步骤,包括在Xcode和NDK中的配置、解决遇到的问题以及针对不同平台的特定编译选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
 
 
一、 LLVM是什么?
(1)LLVM是lowlevel virtual machine的简称,是一个编译器框架。苹果公司的Xcode 4.0之后用的都是LLVM编译器。
(2)LLVM 诞生于2003.10伊利诺伊大学香槟分校,创始人ChrisLattner,现任苹果公司『开发者工具』部门的主管。
1513394186-1194-    1513394187-6318-
二、 LLVM-Obfuscator 是什么?
(1)LLVM-Obfuscator 是瑞士西北应用科技大学安全实验室针对LLVM编译组件开发的代码混淆工具,该工具完全开源,目的是为了增加逆向工程的难度,保证代码的安全性。
(2)Obfuscator-llvm最新版本集成了LLVM-3.4编译器,并且兼容LLVM支持的所有语言(C,C++, Objective-C, Ada and Fortran)和平台(x86, x86-64, PowerPC, PowerPC-64,ARM, Thumb, SPARC, Alpha, CellSPU, MIPS, MSP430, SystemZ,and XCore)。
1513394186-2143-
1. 混淆方法一: InstructionsSubstitution
-mllvm -sub: activate instructions substitution -mllvm -funcSUB="func1,func2,func3": if instructions substitution is activated, apply it only on functions func1, func2 and func3 -mllvm -perSUB=20: if instructions substitution is activated, apply it with a probability of 20% on each function
2. 混淆方法二: BogusControlFlow
-mllvm -bcf: activates the bogus control flow pass -mllvm -funcBCF="func1,func2,func3": if the pass is activated, applies it only on functions func1, func2, func3 -mllvm -perBCF=20: if the pass is activated, applies it on all functions with a probability of 20%. Default: 100 -mllvm -boguscf-loop=3: if the pass is activated, applies it 3 times on a function. Default: 1 -mllvm -boguscf-prob=40: if the pass is activated, a basic bloc will be obfuscated with a probability of 40%. Default: 30 3. 混淆方法三: ControlFlow Flattening
-mllvm -fla: activates control flow flattening -mllvm -funcFLA="func1,func2,func3": if control flow flattening is activated, apply it only on functions func1, func2 and func3 -mllvm -perFLA=20: if control flow flattening is activated, apply it with a probability of 20% on each function 4. 如何用开源 source code 编译出混淆器O-LLVM ?
$ git clone -b llvm-3.5 https://github.com/obfuscator-llvm/obfuscator.git $ mkdir build $ cd build $ cmake -DCMAKE_BUILD_TYPE:String=Release ../obfuscator/ $ make -j5
编译后的结果只有bin 和 lib 是有用的,其余的都可以删除:
1513394186-5118-
三、 LLVM-Obfuscator for iOS: Xcode + Obfuscator
从Xcode-5.0之后苹果就将Clang-LLVM作为Xcode的默认编译器,因此O-llvm也可以与Xcode友好地集成。通过编写插件直接集成:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值