前言
加密方式分析
如果没有明显的加密或者编码特征,根据经验,大多APP数据包加密会采用AES
或者DES
,可以先Hook一下对应的基础类或方法(使用objection)
// hook基础类
android hooking watch class javax.crypto.spec.IvParameterSpec
android hooking watch class javax.crypto.Cipher
// 核心关注 doFinal getInstance update方法
android hooking watch class_method javax.crypto.Cipher.getInstance --dump-args
android hooking watch class_method javax.crypto.Cipher.update --dump-args --dump-return
android hooking watch class_method javax.crypto.Cipher.doFinal --dump-args --dump-return --dump-backtrace
如果不行,那可以直接搜类的关键词然后监听(使用objection)
android hooking search classes AES
android hooking search classes DES
如果都找不到,那就尝试脱壳反编译,根据一些特征字符串(URL、参数),定位到加密的类,再去hook;或者监控操作时实时的方法函数,从中定位到加密的方法,再去hook。
签名方式分析
根据经验,签名一般会采用哈希算法
MD5
:MD5算法是一种常用的哈希算法,生成的摘要长度为32个字符。SHA-1
:SHA-1是一种安全散列算法,生成的摘要长度为40个字符,但可以截取前32个字符作为签名。SHA-256
:SHA-256是一种比SHA-1更安全的哈希算法,生成的摘要长度为64个字符,但可以截取前32个字符作为签名。HMAC
:HMAC算法是一种使用密钥进行哈希的消息认证码算法,常用的哈希算法包括MD5和SHA-256,生成的签名长度为32个字符。RIPEMD-160
:RIPEMD-160是一种欧洲安全标准组织(ECBS)推荐的哈希算法,生成的摘要长度为40个字符,但可以截取前32个字符作为签名。
可以先尝试hook一下对应的类,看看有没有用到这些方法(使用objection)
// md5类
android hooking watch class java.security.MessageDigest
// md5方法
android hooking watch class_method java.security.MessageDigest.getInstance --dump-args
android hooking watch class_method java.security.MessageDigest.update --dump-args --dump-return --dump-backtrace
// HMAC类
android hooking watch class javax.crypto.spec.SecretKeySpec
android hooking watch class javax.crypto.Mac
// HMAC方法
android hooking watch class_method javax.crypto.spec.SecretKeySpec.$init --dump-args --dump-backtrace
android hooking watch class_method javax.crypto.Mac.getInstance --dump-args
android hooking watch class_method javax.crypto.Mac.doFinal --dump-args --dump-return --dump-backtrace
如果不行,可以尝试搜索一些方法,如
android hooking search methods getSign
还是找不到,那就尝试脱壳反编译,根据一些特征字符串(URL、参数),定位到签名的类,再去hook;或者监控操作时实时的方法函数,从中定位到签名的方法,再去hook。
启动
frida -U -l emulator_detection_bypass.js -l root_detection_bypass.js -l intercept_crypto.js -l ssl_pinning_multiple_bypass.js -l system_exit_bypass.js -f com.xxx.xxx