Android
拿到了两个文件,disk image和apk
首先用jeb分析了apk,提供了登录注册功能,将用户名密码以加密的形式保存在数据库里,其他的没有什么内容。

接着开始分析磁盘文件,通过file命令得知文件格式为.xz,解压后发现是FAT文件系统。

安装fatcat进行分析
apt-get install fatcat
使用-l参数列出目录

添加-d参数列出删除的文件,使用-r参数读取文件内容

拿到了password的内容。
然后继续分析那个.git目录,使用mount加载磁盘镜像到/mnt目录

切换到master分支
git checkout -f master
git log查看commit记录

切换到Temp test file的分支
git checkout -f 55bb1750d984691c154aa7b8a4877e2e6ac3e055
查看该分支下的文件

找到了vault.db,使用sqlite3打开,找到了flag的加密形式

配合前面的password,就可以解密了。
使用Android Studio编写解密代码。
关键代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { Toast.makeText(this, decrypt("J0yGSBs5EaApkR67G/iZjK12kkTk1XBMzWdy7P58iqGUDfLjLlGOZf/nryFXQqBh"), Toast.LENGTH_LONG).show(); }catch (Exception e){
}
}
public String decrypt(String arg6) throws Exception { byte[] v0 = Base64.decode(arg6.getBytes(), 2); Log.d("Status", v0.toString()); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); SecretKeySpec key = getKey("I</3Porgis!"); cipher.init(2, key); return new String(cipher.doFinal(v0), "UTF-8"); }
public SecretKeySpec getKey(String arg10) throws Exception { return new SecretKeySpec(SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1").generateSecret(new PBEKeySpec(arg10.toCharArray(), "SampleSalt".getBytes(), 1000, 128)).getEncoded(), "AES"); } }
|
安装应用并打开,即可弹出flag
