Frida辅助分析OLLVM虚假控制流程(下)

OLLVM虚假控制流程简介

地址:https://github.com/obfuscator-llvm/obfuscator/wiki/Bogus-Control-Flow

此方法通过在当前基本块之前添加基本块来修改函数调用图。这个新的基本块包含一个不透明谓词,然后条件跳转到原始基本块。

原始基本块也被克隆并填充随机选择的垃圾指令
可用的编译器选项
-mllvm -bcf:激活伪造的控制流通道

  • -mllvm -bcf_loop=3:如果激活了通行证,则将其应用于某个功能 3 次。默认值:1
  • -mllvm -bcf_prob=40:如果激活通行证,基本块将被混淆,概率为 40%。默认值:30

有跳转

有2个全局变量 x和y

3到7分看视频

这一批函数我们hook看看

javascript 复制代码
  sub_12B44
  sub_12BF8
  sub_1391C
  sub_1391C
  sub_18AB0
  sub_12CF4
  sub_12CF4

写应该hook脚本 2个地方出现我们的输出结果,出现地址0x18cec

地址0x18cec

把这几个函数也hook一下

javascript 复制代码
 sub_15FAC((unsigned __int64 *)&v13, v8, v9);
 sub_15FAC((unsigned __int64 *)&v13, a1, a2);
 sub_16214(&v13, a3);
 sub_16900

第一次完整的出现输出是在这个0x16214,第一个参数是加密过程,第二个参数是结果

javascript 复制代码
unsigned __int64 *__fastcall sub_16214(unsigned __int64 *a1, __int64 a2)

看第2个的引用。

在sub_1531C里面找到了下面的函数

javascript 复制代码
function hex_dump(p) {
    try {
        return hexdump(p) + "\r\n";
    } catch (error) {
        return ptr(p) + "\r\n";
    }
}    

function hook_nttive_addr(addr,idb_addr){
    var base_hell_jni=Module.findBaseAddress("libhello-jni.so");
Interceptor.attach(addr,{
    onEnter:function(args){
       
        this.arg0=args[0];
        this.arg1=args[1];
        this.arg2=args[2];
        this.arg3=args[3];
        this.lr=this.context.lr;
    },onLeave:function(retval){
        console.log("ptr"+ptr(addr)+"idb_addr:"+ptr(idb_addr)+"LR:"+ptr(this.lr).sub(base_hell_jni)+"\r\n",
       "this.arg0:\r\n",hex_dump(this.arg0),
        "this.arg1:\r\n",hex_dump(this.arg1),
        "this.arg2:\r\n",hex_dump(this.arg2),
        "this.arg3:\r\n",hex_dump(this.arg3),
        "retval:\r\n",    hex_dump(retval));
    }
})
}
function  hook_Native(){

 var hook_hellojni=Module.findBaseAddress("libhello-jni.so");
 //var  addr_0xF620= hook_hellojni.add(0xF620);

hook_nttive_addr(hook_hellojni.add(0x12B44),0x12B44);
hook_nttive_addr(hook_hellojni.add(0x12BF8),0x12BF8);
hook_nttive_addr(hook_hellojni.add(0x1391C),0x1391C);
hook_nttive_addr(hook_hellojni.add(0x18AB0),0x18AB0);
hook_nttive_addr(hook_hellojni.add(0x12CF4),0x12CF4);
hook_nttive_addr(hook_hellojni.add(0x15FAC),0x15FAC);
hook_nttive_addr(hook_hellojni.add(0x16214),0x16214);
hook_nttive_addr(hook_hellojni.add(0x16900),0x16900);
}
function mian(){
    hook_Native();
} 
setImmediate(mian)
相关推荐
计算机安禾几秒前
【C语言程序设计】第37篇:链表数据结构(一):单向链表的实现
c语言·开发语言·数据结构·c++·算法·链表·蓝桥杯
阿贵---15 分钟前
C++构建缓存加速
开发语言·c++·算法
Dxy123931021615 分钟前
CSS常用样式详解:从基础到进阶的全面指南
前端·css
IT_陈寒26 分钟前
SpringBoot自动配置揭秘:5个让开发效率翻倍的隐藏技巧
前端·人工智能·后端
Moment26 分钟前
前端工程化 + AI 赋能,从需求到运维一条龙怎么搭 ❓❓❓
前端·javascript·面试
没有bug.的程序员31 分钟前
Serverless 弹性扩容引发的全线熔断:Spring Boot 启动耗时从 1s 压缩至 0.3s 的物理级绞杀
java·spring boot·kubernetes·serverless·扩容·线上
紫丁香33 分钟前
pytest_自动化测试3
开发语言·python·功能测试·单元测试·集成测试·pytest
bearpping34 分钟前
java进阶知识点
java·开发语言
杰杰79836 分钟前
Python面向对象——类的魔法方法
开发语言·python
Joker Zxc36 分钟前
【前端基础(Javascript部分)】6、用JavaScript的递归函数和for循环,计算斐波那契数列的第 n 项值
开发语言·前端·javascript