i茅台app逆向分析frida反调试

这篇具有很好参考价值的文章主要介绍了i茅台app逆向分析frida反调试。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

文章仅供思路参考,请勿用作非法攻击

环境:

i茅台 1.3.7

frida 14.2.17

安卓 9 系统


frida注入

常规frida不注入任何脚本

frida -U -f com.moutai.mall --no-pause
    / _  |   Frida 14.2.17 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
Spawned `com.moutai.mall`. Resuming main thread!                        
[MI 8::com.moutai.mall]-> Process terminated
[MI 8::com.moutai.mall]->

这种情况就是有frida反调试,frida的反调试可以写在java层或者so层,搜罗网上的方法,比较

普遍的就是:使用葫芦娃版本的frida、改frida_server的名称,修改frida_server的端口,文章中的frida_server均已满足以上条件,情况比较严峻。

反调试定位:

这个app是有壳的,防护大概率会是在so层,毕竟java层的反调试已经过时了,我们可以通过hook安卓系统的libdl.so中的android_dlopen_ext来定位问题出现在哪个so,定位到具体so再定位so里面的反调试线程,找出来反调试线程最终把反调试线程替换成空函数以达到绕过frida检测的目的,以下是hook 安卓系统libdl.so中的android_dlopen_ext函数代码

function hook_dlopen(soName = '') {
    Interceptor.attach(Module.findExportByName(null, "android_dlopen_ext"),
        {
            onEnter: function (args) {
                var pathptr = args[0];
                
                if (pathptr !== undefined && pathptr != null) {
                    var path = ptr(pathptr).readCString();
                    console.log(path);
                    
                }
            }
        }
    );
}

setImmediate(hook_dlopen,"");

 以上hook代码的作用用于定位反调试出现在哪个so文件

└─# frida -U -f com.moutai.mall -l imoutai.js --no-pause
     ____
    / _  |   Frida 14.2.17 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
Spawned `com.moutai.mall`. Resuming main thread!                        
[MI 8::com.moutai.mall]-> /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/oat/arm64/base.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libnesec.so
Process terminated
[MI 8::com.moutai.mall]->

Thank you for using Frida!

 通过将js代码注入到目标app,根据以上显示可以发现 libnesec.so 的可能性非常大,注入多次后仍然是停留在这个so,说明这个so内部有函数做了反调试处理。我们修改修改js代码,以便能定位反调试线程,新的js代码如下:

var soaddr = null;
function hook_dlopen(soName = '') {
    Interceptor.attach(Module.findExportByName(null, "android_dlopen_ext"),
        {
            onEnter: function (args) {
                var pathptr = args[0];
                
                if (pathptr !== undefined && pathptr != null) {
                    var path = ptr(pathptr).readCString();
                    if (path.indexOf(soName) != -1) {
                        
                        this.hook = true;
                        
                    }
                    console.log(path);
                    
                }
            },
            onLeave:function(ret){
                if (this.hook = true) {
                  
                    soaddr = Module.findBaseAddress("libnesec.so");
                    hook_pthread_create();
                }
            }
        }
    );
}
function printNativeStack(context, name) {
    var trace = Thread.backtrace(context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n");
   console.log(trace)
  }
function hook_pthread_create() {
    
    Interceptor.attach(Module.findExportByName("libc.so", "pthread_create"), {
        onEnter(args) {
            var func_addr = args[2]
            
            var offes = func_addr.sub(soaddr);
            console.log("The thread function address is " + offes);
           
            
            
        }
    })
}
setImmediate(hook_dlopen,"libnesec.so");

 注入以上代码返回以下

──(root💀r0env)-[~/Desktop/frida_js]
└─# frida -U -f com.moutai.mall -l imoutai.js --no-pause
     ____
    / _  |   Frida 14.2.17 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
Spawned `com.moutai.mall`. Resuming main thread!                        
[MI 8::com.moutai.mall]-> /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/oat/arm64/base.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libnesec.so
The thread function address is 0x8abb4
The thread function address is 0x8abb4
The thread function address is 0x8abb4
The thread function address is 0x7598c
The thread function address is 0x7598c
The thread function address is 0x7598c
The thread function address is 0x6e348
The thread function address is 0x6e348
The thread function address is 0x6e348
The thread function address is 0x9baef4fc
The thread function address is 0x9baef4fc
The thread function address is 0x9baef4fc
The thread function address is 0x8ac9c
The thread function address is 0x8ac9c
The thread function address is 0x8ac9c
The thread function address is 0x88e04
The thread function address is 0x88e04
The thread function address is 0x88e04
Process terminated
[MI 8::com.moutai.mall]->

 根据以上结果配合分析得知:0x88e04 这个偏移地址就是frida反调试线程,我们再次修改js代码为如下,把反调试的函数替换成空的函数,达到绕过的目的。

var soaddr = null;
function hook_dlopen(soName = '') {
    Interceptor.attach(Module.findExportByName(null, "android_dlopen_ext"),
        {
            onEnter: function (args) {
                var pathptr = args[0];
                
                if (pathptr !== undefined && pathptr != null) {
                    var path = ptr(pathptr).readCString();
                    if (path.indexOf(soName) != -1) {
                        
                        this.hook = true;
                        
                    }
                    console.log(path);
                    
                }
            },
            onLeave:function(ret){
                if (this.hook = true) {
                  
                    soaddr = Module.findBaseAddress("libnesec.so");
                    hook_pthread_create();
                }
            }
        }
    );
}
function printNativeStack(context, name) {
    var trace = Thread.backtrace(context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\n");
   console.log(trace)
  }
function hook_pthread_create() {
    
    Interceptor.attach(Module.findExportByName("libc.so", "pthread_create"), {
        onEnter(args) {
            let func_addr = args[2]
            
            var offes = func_addr.sub(soaddr);
  
            if (offes == 0x88e04) {
            
                
                Interceptor.replace(func_addr,new NativeCallback(function(){
                    console.log("0x891b8 replaces");
                },'void',[]));
                
            }
            
            
        }
    })
}
setImmediate(hook_dlopen,"libnesec.so");
─# frida -U -f com.moutai.mall -l imoutai.js --no-pause
     ____
    / _  |   Frida 14.2.17 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
Spawned `com.moutai.mall`. Resuming main thread!                        
[MI 8::com.moutai.mall]-> /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/oat/arm64/base.odex
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libsecsdk.so
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libc++_shared.so
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libmmkv.so
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libproperty_get.so
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libBugly.so
/data/app/com.moutai.mall-ZqwkhQsJ0Sxyv7X-FRkGlw==/lib/arm64/libCryptoSeed.so
/system/framework/oat/arm64/gson.odex
/data/dalvik-cache/arm64/system@app@MiuiContentCatcher@MiuiContentCatcher.apk@classes.dex
/data/dalvik-cache/arm64/system@app@CatcherPatch@CatcherPatch.apk@classes.dex
/vendor/lib64/hw/gralloc.sdm845.so
/vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl-qti-display.so
[MI 8::com.moutai.mall]-> Frida
{
    "version": "14.2.17"
}
[MI 8::com.moutai.mall]->

完结:

至此本文就结束了,大佬轻喷.。。。交流群:613707164

 文章来源地址https://www.toymoban.com/news/detail-658344.html

到了这里,关于i茅台app逆向分析frida反调试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • android frida 逆向 自吐加密算法

    前言: ♛  frida  hook   android   Android  逆向神器 前几天在学习 Android 逆向的时候发现了一个神器:通过  frida hook  我们可以 “劫持”   一些 函数 为我们所用, 今天就和大家上手一个  加密函数的劫持 让打印出: 加密秘钥 密文 效果如下:可以很直观的看出 加密算法以

    2024年02月11日
    浏览(28)
  • MacOS微信逆向分析-Frida

    PC下的微信二次开发相信大家都会了,那么本篇文章将带领大家使用Frida框架对Mac下微信来进行 二次开发 ! PS:还有一种静态注入的方式也不错,但是考虑到大家xcode安装包太大就不在这里展开啦。 PS:frida如何去使用大家得自己去学,本文不过多展开。 主要功能涉及如下:

    2024年02月04日
    浏览(29)
  • Android APP逆向分析工具和方法汇总

    受益于移动设备的广泛普及,移动应用近年来得到了蓬勃发展。基于移动设备集成的各类传感器,众多功能丰富的移动应用被开发出来,聚集了大量高价值用户隐私数据,包括用户身份信息、地理位置信息、账户资料信息等。用户在享受移动应用带来便利的同时,其隐私安全

    2024年02月12日
    浏览(38)
  • Web逆向、软件逆向、安卓逆向、APP逆向,关于网络安全这些你必须懂

    逆向工程是网络安全行业里面一项很重要的技术。 逆向是一个相对正向而言的解释,相对正向来说,对一个程序来讲,正向就是开发的过程,从0到1。 就是在一个软件诞生的整个生命周期中的一个过程, 也就是按照需求通过编码把需求实现,产生一个程序,当然这个程序可

    2024年02月07日
    浏览(30)
  • Android,ios,安卓app推送消息通知,java后台向手机推送app的通知教程

    个推是商用级的移动应用消息推送云服务供应商,客户端 SDK 支持 Android 和 iOS 两大平台,开发者集成 SDK 后,可以通过个推强大的 web 端及丰富的 API 开放接口,发送推送消息、统计分析推送效果。可有效提高 App 活跃度,增加用户留存率。 如果您还没有个推 账号,可在 个推

    2024年02月04日
    浏览(32)
  • 0003Java安卓程序设计-springboot基于Android的学习生活交流APP

    编程技术交流、源码分享、模板分享、网课教程 🐧裙:776871563 网络的广泛应用给生活带来了十分的便利。所以把学习生活交流管理与现在网络相结合,利用java技术建设学习生活交流APP,实现学习生活交流的信息化。则对于进一步提高学习生活交流管理发展,丰富学习生活交

    2024年02月05日
    浏览(37)
  • Web攻防--JS算法逆向--断点调试--反调试&&代码混淆绕过

    在进行渗透测试过程中,在一些功能点进行参数注入或者枚举爆破等过程中,会出现参数进行加密的情况,但是我们输入参数并不是加密状态,即便测试点存在漏洞也不可能测试成功,这时候便需要将所提交参数进行加密后在进行注入,针对JS应用我们可以采用JS断点调试的方

    2024年02月10日
    浏览(28)
  • Android安卓实战项目(12)—关于身体分析,BMI计算,喝水提醒,食物卡路里计算APP【支持中英文切换】生活助手类APP(源码在文末)

    B站演示 【Android安卓实战项目(12)—生活助手类APP—关于身体分析,BMI计算,喝水提醒,食物卡路里计算APP【支持中英文切换】】 https://www.bilibili.com/video/BV1Wu4y1C76j/?share_source=copy_webvd_source=b2e9b9ed746acda34f499009647748ed 这段代码是一个Android应用程序的主要活动(Activity),它是一

    2024年02月10日
    浏览(35)
  • APP攻防--安卓逆向&JEB动态调试&LSPosed模块&算法提取&Hook技术

    安装java环境变量(最好jdk11) 安装adb环境变量 设置adb环境变量最好以Android命名 启动开发者模式 设置--关于平板电脑--版本号(单机五次) 开启USB调试 设置--系统--高级--开发者选项--USB调试 开启USB调试目的是为了后续让JEB能够获取模拟器上的进程 安装激活JEB 软件安装包和破解参

    2024年02月05日
    浏览(37)
  • 【粉丝福利社】Android应用安全实战:Frida协议分析(文末送书-完结)

    🏆 作者简介,愚公搬代码 🏆《头衔》:华为云特约编辑,华为云云享专家,华为开发者专家,华为产品云测专家,CSDN博客专家,CSDN商业化专家,阿里云专家博主,阿里云签约作者,腾讯云优秀博主,腾讯云内容共创官,掘金优秀博主,51CTO博客专家等。 🏆《近期荣誉》:

    2024年04月09日
    浏览(45)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包