APP版本:V8.2.4.2961
工具:burpsuite,xposed,frida,儿童手表
0x1.接口分析这里我们设置好burp和模拟器的代理
但是当我们通过短信验证码登录时会一直卡死登录不上,当关闭代理后成功登录,猜测这里肯定有问题。
登录成功后,我们再开启代理看看如何!
这里我们之间点开了计步,可以看到显示网络连接异常,猜测这里进行代理的防护等保护。我们使用xposed的JustTrustMe模块成功突破SSL Pinning!
这时可以看到我们已经成功抓取到流量!
0x2.数据解密
通过上面的分析我们已经可以成功抓取数据包了,但是通过分析request和response,我们可以看出报文及逆行了加密
这里我们猜测使用了AES对报文进行了加密,可以使用hook的方式获得AES加解密使用的key和iv。我们这里使用frida hook框架完成对java中aes加解密的函数的hook,获得加解密使用的key和iv。frida的hook代码如下:
#coding: utf-8 from __future__ import print_function import frida import sys import json import time # 对结果进行输出 def on_message(message, payload): if(message['type'] == 'send'): rec_data = json.loads(message['payload']) if rec_data['my_type'] == 'IV': print("偏移 :: {}".format(payload.decode('utf-8'))) print(" ") elif rec_data['my_type'] == 'KEY': print("密钥 :: {}".format(payload.decode('utf-8'))) else: print(message) else: print(message) # 使用js hook key和iv相关的代码 js_code = """ Java.perform(function x() { var secret_key_spec = Java.use("javax.crypto.spec.SecretKeySpec"); secret_key_spec.$init.overload("[B", "java.lang.String").implementation = function (x, y) { send('{"my_type" : "KEY"}', new Uint8Array(x)); return this.$init(x, y); } var iv_parameter_spec = Java.use("javax.crypto.spec.IvParameterSpec"); iv_parameter_spec.$init.overload("[B").implementation = function (x) { send('{"my_type" : "IV"}', new Uint8Array(x)); return this.$init(x); } }); """ giao= frida.get_usb_device().attach('com.qihoo360.antilostwatch') # 这里attach要进行hook的应用 script = giao.create_script(js_code) script.on("message", on_message) script.load() sys.stdin.read()android开启frida的服务端
adb connect 127.0.0.1:21503 adb shell cd data/local/ ./frida-server-14.1.3 # 成功开启frida的服务端程序电脑端开启frida hook代码
adb forward tcp:27042 tcp:27042 python3 aes.py
这时我们运行应用就可以hook出当前接口的aes的iv和key
可以看到我们每次请求都能获得对应的key和iv