一、目標
之前我們介紹過 某酒店App sign、appcode簽名決議(一) 帶殼分析 r0tracer,
帶殼分析也是迫不得已,誰不希望零距離接觸呀,
App升級了 5.3.3,我們的工具也升級了,
今天的新朋友是 BlackDex
https://github.com/CodingGay/BlackDex
- 脫殼
- 延時Hook
二、步驟
BlackDex脫殼
- 安裝BlackDex
- 在顯示的行程串列中選擇 com.platexx.boxxoota
- 是的,殼已經脫好了,脫殼后的檔案在 /sdcard/Android/data/top.niunaijun.blackdexa32/dump/com.platexx.boxxoota
分析下
根據上次的分析結果,趕緊去到 com.besxxxhotel.app.whnetcomponent.utils.SignUtil 看看,

熱淚盈眶呀,看到源代碼的感覺真好,
啥也不說了,hook它,
var signCls = Java.use("com.besxxxhotel.app.whnetcomponent.utils.SignUtil");
console.log(TAG + "signCls: " + signCls);
signCls.getSignString.implementation = function(a1,a2,a3,a4,a5,a6){
var result = this.getSignString(a1,a2,a3,a4,a5,a6);
console.log(TAG + "a1 = " + a1);
console.log(TAG + "a2 = " + a2);
console.log(TAG + "a3 = " + a3);
console.log(TAG + "a4 = " + a4);
console.log(TAG + "a5 = " + a5);
console.log(TAG + "a6 = " + a5);
console.log(TAG + "sign rc = " + result);
return result;
}
signCls.getAppCode.implementation = function(a1,a2,a3,a4){
var result = this.getAppCode(a1,a2,a3,a4);
console.log(TAG + "a1 = " + a1);
console.log(TAG + "a2 = " + a2);
console.log(TAG + "a3 = " + a3);
console.log(TAG + "a4 = " + a4);
console.log(TAG + "AppCode rc = " + result);
return result;
}
signCls.decodeASCII.implementation = function(a){
var result = this.decodeASCII(a);
console.log(TAG + a.entrySet().toArray());
console.log(TAG + "decodeASCII: " +result);
return result;
}
掛上心愛的frida跑一下,
[Redmi 6A::platexx.boxxoota]-> Process crashed: Illegal instruction
怎么會掛呢,沒道理呀,我們是好朋友呀,上一個版本都還愉快的玩耍過?
再試試老版本,一樣crash
延時Hook
深呼吸,冷靜一下,
. 老版本也Crash,說明不是新版本升級了防護策略
. spawn模式下會Crash,attach模式下正常
那就好辦了,spawn模式下我們可以加個延時試試,
function main() {
Java.perform(function () {
var threadef = Java.use('java.lang.Thread');
var threadinstance = threadef.$new();
// ...... xxxHook code ......
});
}
setTimeout(main, 1000);
// setImmediate(main);
這次沒問題了,

三、總結
分析脫殼軟體的時候,可以考慮hook 殼代碼里面的 attachBaseContext getApplicationContext 函式來找到hook真實代碼的時機,
frida被搞的時候記得試試 XcubeBase

尼采說過,殺不死你的東西會讓你變得更加強大,但他沒說清楚的是,那東西差點殺死你,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/293102.html
標籤:其他
上一篇:[MRCTF2020]Ezpop
