admin管理员组

文章数量:1585967

1、最近一直在搞工控设备方面的漏洞挖掘,其中遇到一个应用程序进行渗透时遇到请求参数被加密或者签名的情况, 在请求数据被修改后提示异常, 导致无法有效地进行漏洞挖掘,因此把最近关于脱壳的方法做个记录,逆向反编译应用进行查看

 


2、通过查壳和上面分析是360加固,经过加固后的apk,通过常规方法反编译无法获取到源码

3、配置环境并启动frida服务

4、端口转发

5、相关命令

 --version             show program's version number and exit				
 -h, --help            show this help message and exit						
 -D ID, --device=ID    connect to device with the given ID					
 -U, --usb             connect to USB device							
 -R, --remote          connect to remote frida-server						
 -H HOST, --host=HOST  connect to remote frida-server on HOST			
 -f FILE, --file=FILE  spawn FILE									
 -n NAME, --attach-name=NAME                   attach to NAME				
 -p PID, --attach-pid=PID                         attach to PID					
 --debug               enable the Node.js compatible script debugger			
 --disable-jit         disable JIT									
 -I MODULE, --include-module=MODULE     include MODULE				
 -X MODULE, --exclude-module=MODULE   exclude MODULE				
 -i FUNCTION, --include=FUNCTION               include FUNCTION			
 -x FUNCTION, --exclude=FUNCTION             exclude FUNCTION			
 -a MODULE!OFFSET, --add=MODULE!OFFSET     add MODULE!OFFSET		
 -T, --include-imports                                          include program's imports		
 -t MODULE, --include-module-imports=MODULE       include MODULE 		imports													
 -m OBJC_METHOD, --include-objc-method=OBJC_METHOD     include 		OBJC_METHOD												

6、脚本编写并把libart.so 拿出来.然后IDA逆向OpenMemory的对应签名函数名.

 

Interceptor.attach(Module.findExportByName("libart.so", "_ZN3art7DexFile10OpenMemoryEPKhjRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEjPNS_6MemMapEPKNS_10OatDexFileEPS9_"), {

    onEnter: function (args) {

   

        //dex起始位置

        var begin = args[1]

        //打印magic

        console.log("magic : " + Memory.readUtf8String(begin))

        //dex fileSize 地址

        var address = parseInt(begin,16) + 0x20

        //dex 大小

        var dex_size = Memory.readInt(ptr(address))

 

        console.log("dex_size :" + dex_size)

   

        var packageName = "com.********" 

        var file = new File("/data/data/"+packageName+"/" + dex_size + ".dex", "wb")

 

        file.write(Memory.readByteArray(begin, dex_size))

        file.flush()

        file.close()

    },

    onLeave: function (retval) {

        if (retval.toInt32() > 0) {

            /* do something */

        }

    }

});

7、上面利用脚本配置好后进行脱壳如下

8、可以看到下面是我们脱壳的dex文件

 

本文标签: 脱壳实战