Introduction :
What is frida:
1
https://frida.re/
Frida Scripting:
1
2
https://frida.re/docs/javascript-api/#java
Note we will write our script in “javascript”
Hard code:
1
2
3
4
5
6
7
8
9
if (c.a() || c.b() || c.c()) {
a("Root detected!");
}
if (b.a(getApplicationContext())) {
a("App is debuggable!");
}
super.onCreate(bundle);
setContentView(2130903040);
}
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
28
29
30
package sg.vantagepoint.a;
import android.os.Build;
import java.io.File;
/* loaded from: UnCrackable-Level1-dex2jar.jar:sg/vantagepoint/a/c.class */
public class c {
public static boolean a() {
for (String str : System.getenv("PATH").split(":")) {
if (new File(str, "su").exists()) {
return true;
}
}
return false;
}
public static boolean b() {
String str = Build.TAGS;
return str != null && str.contains("test-keys");
}
public static boolean c() {
for (String str : new String[]{"/system/app/Superuser.apk", "/system/xbin/daemonsu", "/system/etc/init.d/99SuperSUDaemon", "/system/bin/.ext/.su", "/system/etc/.has_su_daemon", "/system/etc/.installed_su_daemon", "/dev/com.koushikdutta.superuser.daemon/"}) {
if (new File(str).exists()) {
return true;
}
}
return false;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Java.perform(()=>{
const rootcheck = Java.use("sg.vantagepoint.a.c");
rootcheck.a.implementation = function(){
console.log("--Bypass done -- ");
return flase;
}
rootcheck.b.implementation = function(){
console.log("--Bypass done -- ");
return false;
}
rootcheck.c.implementation = function(){
console.log("--Bypass done -- ");
return false;
}
});
Note To Learn more about Frida-Scripting Here : https://frida.re/docs/javascript-api/#java
Note you sholud run frida-server first in you emulator
1
2
frida-ps -Uai
1
2
frida-ps -U - f owasp.mstg.uncrackable1 -l rootcheckBypass.js
Some advice:
- Learn javascript basics
1
https://www.w3schools.com/js/
- Learn Java
1
https://www.w3schools.com/java/default.asp
- Learn how to Build you first App and try hook function you creat
1
https://www.youtube.com/watch?v=fis26HvvDII
- Read about Frida [Java Api ] and you use it in your javascript hook
1
2
https://frida.re/docs/javascript-api/#java
Tools
- UnCrackable-Level1
1
https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level_01/UnCrackable-Level1.apk
- dex2jar
1
https://github.com/pxb1988/dex2jar
- jadx
1
https://github.com/skylot/jadx
- frida
1
https://frida.re
- Nox emulator
1
https://www.bignox.com/
References:
https://frida.re/docs/javascript-api/#java
https://www.youtube.com/watch?v=fis26HvvDII
https://www.w3schools.com/java/default.asp
https://www.w3schools.com/js/
https://www.youtube.com/watch?v=KeWcZ-Dd6tA&t=490s
Author:
Twitter :
1
https://twitter.com/xcode0x