android逆向进阶,Android逆向——Android逆向进阶(2)

0x00 前言

有价之宝:戳这里

无价之宝:戳这里

说明

最近同步分析ELF文件格式分析。

本文在大佬教学后进行笔记整理以及个人体会进行一个记录。

并且以后的博客中可能会使用英文,顺便对英文进行一个练习。

然后可能会将一些文字用英文代替。

相信你们会见证我的成长。

ELF文件格式分析(1)

内容

1.实例练习。使用软件调试器。

0x01 实例练习

The first step

对demo进行签名,然后安装测试。

o_1c6mq6is51jspjb3fve1fp16s5a.png-j.jpg

Here we find signature verification.

The second step

First,we connect to the virtual appliance.

Open the CMD.

Type the command.

adb connect 127.0.0.1:62001

Open the Android Killer and click 运行。(用的中文的Android Killer,所以还是用运行能说明问题,暂时还没有找英文版的Android Killer,也不知道有没有)

o_1c6mrut7dhh6o7vdug1bvi19b6a.png-j.jpg

And then click 运行.

open demo.

Get log information(得到日志信息).

o_1c6msd6274nfva11hghmo97aba.png-j.jpg

The first thing to notice is here.(第一个需要注意的地方是这里)

Here we know which so it's calling,and then we're going to look down.这里我们就知道它调用的是哪个so,然后接着往下看。

The second thing to notice is here.

o_1c6mthepr1kd8d1cnps1rptri0a.png-j.jpg

So here we know that the demo stops here.so this is a function of the signature verification

The third step

Open IDA.

Open Exports.

Search the verifyHash string.

o_1c6mu0e6f1brfs3m1fan31c1qk4a.png-j.jpg

Double click to open and observe.

o_1c6muf5861n2m1gas1vp112br12sla.png-j.jpg

Find a string."GetApkMFData"。

This string represents the apk signature verification.

o_1c6mujnia1diudqi1cuhf83ol8a.png-j.jpg

We search for where this function is.

o_1c6mumd1g5oq1dgn1ie41m9l7pa.png-j.jpg

We see this strings.

Previously,the files in this folder are signature files.之前说过这种文件夹里放的文件是签名文件

The way we modify it is ti get rid of this string.我们修改的方法就是更改掉这个字符串即可

Open the so file with hex .用hex打开so文件

跳转到0017F590

然后修改,记得这里是16进制要进行一个转换。

o_1c6mvg4t05podig194mqlg1brfa.png-j.jpg

The fourth step

保存,回编译进行测试。

save,compile,and test.

0x02 IDA动态调试

准备工作

Androidmanifest.xml 设置

application android:debuggable="true"

在Androidmanifest.xml文件中把false改成true

build.prop

ro.debuggable=true

ps:以上两个条件满足其一即可。

start

第一步

首先把dex文件拖到IDA中。

o_1c6nfp2dv1fa018i31roat391t3sa.png-j.jpg

第二步

Debugger——Debugger Options

在打开的界面选择:

o_1c6ng0jbeo2siu106113qn0ha.png-j.jpg

然后设置 set specific options

o_1c6ng4an7k6qc2alaoa6b1isua.png-j.jpg

设置好包名

o_1c6ngcd1pjiluot3dt1jhgueua.png-j.jpg

第三步

Debugger —— Process Options

端口号设置成8700。

然后继续调试即可。

0x03 IDA动态调试远程运行原生可执行程序

连接手机

adb shell进行测试

o_1c6ni5e73s4kb39682s1e2v3a.png-j.jpg

push android_server

这里不得不说一句,这篇博客是前两天开始写的,但是因为手机的问题,所以一直没有成功,最后还是重新刷新了下手机,获取root权限才完成的。

首先 push android_server

一定要用真机,不要用虚拟机。不然坑太多,填不完。

用小米手机的。用刷机精灵刷吧。反正我rom好了。如果是红米note 4x 我这里还有6块钱买的rom包,可以找我要哈。

具体流程

adb devices

adb push d:\android_server  /data/local/tmp/android_server

adb shell

su

cd  /data/local/tmp

chmod 777 android_server

./android_server

o_1c6sbarov2941b5i1ns71dgvflda.png-j.jpg

重新打开一个cmd 转发端口

adb forward tcp:23946 tcp:23946

然后打开IDA

IDA操作

Debugger——attach——Remote ARMLinux/Android debugger

配置默认即可

o_1c6sbm5271aho96ffc1nah1kcha.png-j.jpg

cluck ok

o_1c6sbtnb3nm11t8p16f118kk21ta.png-j.jpg

就换显示手机上的进程。

所以我们现在就要选择需要attach的进程

wite

o_1c6sdq6rl1qh313b3peu1er31g4ha.png-j.jpg

调试开始

找到modiles,然后找到我们需要找的so

o_1c6sdrsiv4r9dpfjjsvct6ila.png-j.jpg

然后选择合适的函数,当然这个是静态分析的时候的。

双击进入函数即可

o_1c6sdvsd71qgmomqbvi1k33v7oa.png-j.jpg

在这里设置断点,然后进行运行。

o_1c6se21ji1g425v7g7lofp16lna.png-j.jpg

变成蓝色的时候就代表断点成功了。

然后f8继续运行。

o_1c6se4ee51pfd1nq4umg3elkba.png-j.jpg

这里最重要的就是R0寄存器。

所以我们需要修改的内容就是这里。那么我们将数值改变。

从64 改成 ff,换成10进制就是从100改变成255。

o_1c6se7b481o1vvkrpnkoh1bika.png-j.jpg

然后开始运行。

o_1c6sec0085jautl193cvlu1lksa.png-j.jpg

测试成功。

0x04 结束语

IDA动态attach 在这里就成功了。那么现在要做的就是巩固练习。

恩,先横扫一下网上能看的到的so动态调试。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值