攻防世界安卓逆向app2
阿新 • • 發佈:2021-02-01
這道題lib資料夾當中有東西,因此我們可能需要待會兒逆向so檔案,先放在這裡
首先反編譯classes.dex得到原始碼
在MainActivity當中我們鎖定這部分,簡單分析後這部分是獲取str1與str2並實現頁面的跳轉
public void onClick(View paramView) {
switch (paramView.getId()) {
default:
return;
case 2131165187:
break;
}
if (this.c.getText ().length() == 0 || this.d.getText().length() == 0) {
Toast.makeText((Context)this, ", 1).show();
return;
}
String str1 = this.c.getText().toString();
String str2 = this.d.getText().toString();
Log.e("test", str1 + " test2 = " + str2);
Intent intent = new Intent((Context)this, SecondActivity.class);
intent.putExtra("ili", str1);
intent.putExtra("lil", str2);
startActivity(intent);
}
接下來我們跟進SecondActivity
裡面有個關鍵的
if (Encryto.doRawData(this, str1 + str2).equals("VEIzd/V2UPYNdn/bxH3Xig==")) {
intent. setAction("android.test.action.MoniterInstallService");
intent.setClass((Context)this, MoniterInstallService.class);
intent.putExtra("company", "tencent");
intent.putExtra("name", "hacker");
intent.putExtra("age", 18);
startActivity(intent);
startService(intent);
}
大概意思是加密以後等於VEIzd/V2UPYNdn/bxH3Xig==
,但是這裡還不要被騙了哈,如果條件成立發現他又進行了跳轉,跟進MoniterInstallService這個類,掃了一下發現是廣播開啟和接收的Activity,與解題無關,之後便啥都沒有了你敢信???
最後看了WP發現一個從未使用過的類FileDataActivity
protected void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
setContentView(2130903042);
this.c = (TextView)findViewById(2131165184);
this.c.setText(Encryto.decode(this, "9YuQ2dk8CSaCe7DTAmaqAA=="));
}
我只能說有毒好吧
跟進Encryto.doRawData方法,看到首行靜態方法,載入JNIEncrypt檔案,也知道了接下來我們要去反編譯so檔案
static {
System.loadLibrary("JNIEncrypt");
}
發現關鍵的
if ( checkSignature(a1, a2, a3) == 1 )
{
v14 = 0;
v13 = '==ye';
v12 = 'ktse';
v11 = 'tasi';
v10 = 'siht';
v4 = (char *)(*(int (__cdecl **)(int, int, _DWORD))(*(_DWORD *)a1 + 676))(a1, a4, 0);
v5 = AES_128_ECB_PKCS5Padding_Encrypt(v4, (int)&v10);
(*(void (__cdecl **)(int, int, char *))(*(_DWORD *)a1 + 680))(a1, a4, v4);
result = (*(int (__cdecl **)(int, int))(*(_DWORD *)a1 + 668))(a1, v5);
}
採用AES加密,猜測v4應該是我們輸入的變數,v10那裡根據我撇腳的彙編水平猜測是thisisatestkey==
鍛鍊下指令碼能力看網上說的寫了個AES解密指令碼(順便想起了當時反編譯so檔案時候裡面那個說了是AES_128_ECB)
#coding:utf-8
import base64
from Crypto.Cipher import AES
def AES_DECRYPT(key,data):
cryptos = AES.new(key, AES.MODE_ECB)
decrpytBytes = base64.b64decode(data)
meg = cryptos.decrypt(decrpytBytes).decode('utf-8')
print(meg[:-ord(meg[-1])])
AES_DECRYPT("thisisatestkey==","9YuQ2dk8CSaCe7DTAmaqAA==")
得到flag
是Cas3_0f_A_CAK3