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)
相关推荐
vipbic5 分钟前
我也该升级了,陪伴了我7年的博客
前端
Lee川25 分钟前
RAG 实战:从一篇掘金文章出发,拆解检索增强生成的全链路
前端·人工智能·后端
Lee川38 分钟前
MCP 高德地图实战:当 AI 学会使用工具,一个协议如何重塑大模型的行动边界
前端·人工智能·后端
楼田莉子1 小时前
C++17新特性:__had_include/属性/求值顺序规则
开发语言·c++·后端
ZC跨境爬虫1 小时前
跟着 MDN 学CSS day_14:(尺寸调整技能测试与实战解析)
前端·css·ui·html·tensorflow
kyriewen1 小时前
用魔法打败魔法:我让AI替我去面试前端岗,AI面试官给我打了92分,还发了offer
前端·javascript·面试
IT_陈寒1 小时前
Redis批量删除踩了坑,原来DEL命令不是万能的
前端·人工智能·后端
lichenyang4531 小时前
鸿蒙聊天 Demo 练习 06:AI 思考气泡与 MVVM + Controller 结构重构
前端
香蕉鼠片1 小时前
Python进阶学习
开发语言·python
500841 小时前
昇腾 CANN 的五层架构,到底分了哪五层
java·人工智能·分布式·架构·ocr·wpf