Skip to content

Commit e9d92b6

Browse files
committed
404.html
1 parent a1cd33a commit e9d92b6

9 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
author: Devilsharu
3+
layout: post
4+
date: 2024-05-15 22:37:01 +0200
5+
tags: reverse android
6+
title: "Uncrackable2"
7+
excerpt_separator: <!--more-->
8+
---
9+
10+
This android challenge is the second one of a series of challenges offered by *OWASP Mobile Application Security*.
11+
12+
**Make sure to check the writeup for the first one here, as some of its elements will be referred to and will lack of details in the current writeup : [Uncrackable1](https://basilics.github.io/2024/05/15/Uncrackable1.html)**
13+
14+
<!--more-->
15+
16+
17+
## Understanding the app
18+
19+
This app is pretty much like the first one.
20+
21+
The same text field is awaiting for our secret string behind an anti-root wall.
22+
23+
![](/assets/OWASP-MASTG/unck2-0.jpg)
24+
25+
Let's dissect the app under Jadx :
26+
27+
![](/assets/OWASP-MASTG/unck2-1.jpg)
28+
29+
![](/assets/OWASP-MASTG/unck2-2.jpg)
30+
31+
Once again, MainActivity is the entrypoint.
32+
33+
![](/assets/OWASP-MASTG/unck2-3.jpg)
34+
![](/assets/OWASP-MASTG/unck2-4.jpg)
35+
36+
37+
We still have an anti-root detection that's done in `onCreate` and `MainActivity.a`. We will try to bypass it with the same method as for the first app.
38+
39+
There also is the `verify` method that probably checks the user input.
40+
41+
There still are a few differences here :
42+
43+
* The native library `libfoo` is loaded.
44+
* The native function `init` is called at the beginning of `onCreate`
45+
46+
## Finding the secret string
47+
48+
This time, an instance of `CodeCheck` is created as `m`
49+
50+
The verify function calls `m.a` with the user input as argument.
51+
52+
Let's see the `CodeCheck` class :
53+
54+
![](/assets/OWASP-MASTG/unck2-5.jpg)
55+
56+
The `a` method calls the native function `bar`.
57+
58+
### Diving into the native library
59+
60+
After unzipping the apk and opening the `libfoo` library with `ida`, we can try to find some information about `bar`.
61+
62+
![](/assets/OWASP-MASTG/unck2-6.jpg)
63+
64+
This function, most importantly, stores the string `Thanks for all the fish` into a variable that is then compared to the the returned value of another function.
65+
66+
As we are ~~lazy~~ efficient people, let's assume that is the secret string.
67+
68+
69+
## Let's thank for all the fish
70+
71+
In order to bypass the anti-root detector, we can use frida with the same script as in the first app.
72+
73+
```
74+
Java.perform(function() {
75+
const badMethod = Java.use("sg.vantagepoint.uncrackable1.MainActivity").a.overload("java.lang.String");
76+
badMethod.implementation = function(str){
77+
console.log("Bypassing MainActivity.a");
78+
return;
79+
//return badMethod.call(this,str);
80+
}
81+
});
82+
```
83+
84+
And then after launching frida
85+
86+
```
87+
┌──(devilsharu㉿Kali)-[~/Documents/OWASP-Mobile]
88+
└─$ frida -U -f owasp.mstg.uncrackable2 -l uncrack2.js
89+
```
90+
91+
Now, we can thank for all the fish !
92+
93+
![](/assets/OWASP-MASTG/unck2-7.jpg)
94+

assets/OWASP-MASTG/unck2-0.jpg

20.5 KB
Loading

assets/OWASP-MASTG/unck2-1.jpg

21.6 KB
Loading

assets/OWASP-MASTG/unck2-2.jpg

32.3 KB
Loading

assets/OWASP-MASTG/unck2-3.jpg

44.6 KB
Loading

assets/OWASP-MASTG/unck2-4.jpg

108 KB
Loading

assets/OWASP-MASTG/unck2-5.jpg

19.3 KB
Loading

assets/OWASP-MASTG/unck2-6.jpg

36.2 KB
Loading

assets/OWASP-MASTG/unck2-7.jpg

21 KB
Loading

0 commit comments

Comments
 (0)