Skip to content

Commit 7e0355c

Browse files
authored
June 22nd 2025 updates (#2530)
* Breaking change: Frida 17+ support and script updates * Breaking change: Corellium iOS device must install frida >=17 * Updated Frida scripts for logging, ssl/cert pinning bypass * Added bridges support to frida * Poetry dependency updates * Fix Frida Code Editor code alignment issues * Fix Google Play Scrapper timeout issues behind proxy * Apply MobSF proxy settings to standalone tools_download.py
1 parent 6987a94 commit 7e0355c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1584
-873
lines changed

mobsf/DynamicAnalyzer/tools/frida_scripts/android/default/debugger_check_bypass.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ Java.perform(function () {
1111
// Following are based on: https://github.com/apkunpacker/FridaScripts
1212
try {
1313
/* Bypass Frida Detection Based On Port Number */
14-
Interceptor.attach(Module.findExportByName("libc.so", "connect"), {
14+
const libc = Process.getModuleByName("libc.so");
15+
Interceptor.attach(libc.getExportByName("connect"), {
1516
onEnter: function(args) {
16-
var memory = Memory.readByteArray(args[1], 64);
17-
var b = new Uint8Array(memory);
18-
if (b[2] == 0x69 && b[3] == 0xa2 && b[4] == 0x7f && b[5] == 0x00 && b[6] == 0x00 && b[7] == 0x01) {
19-
this.frida_detection = true;
20-
}
17+
try{
18+
var memory = Memory.readByteArray(args[1], 64);
19+
var b = new Uint8Array(memory);
20+
if (b[2] == 0x69 && b[3] == 0xa2 && b[4] == 0x7f && b[5] == 0x00 && b[6] == 0x00 && b[7] == 0x01) {
21+
this.frida_detection = true;
22+
}
23+
} catch(e){}
2124
},
2225
onLeave: function(retval) {
2326
if (this.frida_detection) {
@@ -28,30 +31,31 @@ try {
2831
});
2932
} catch(e){}
3033
try {
31-
Interceptor.attach(Module.findExportByName(null, "connect"), {
34+
Interceptor.attach(Module.getGlobalExportByName("connect"), {
3235
onEnter: function(args) {
33-
var family = Memory.readU16(args[1]);
36+
var family = args[1].readU16();
3437
if (family !== 2) {
3538
return
3639
}
37-
var port = Memory.readU16(args[1].add(2));
40+
var port = args[1].add(2).readU16();
3841
port = ((port & 0xff) << 8) | (port >> 8);
3942
if (port === 27042) {
4043
send('[Debugger Check] Frida Port detection bypassed');
41-
Memory.writeU16(args[1].add(2), 0x0101);
44+
args[1].add(2).writeU16(0x0101);
4245
}
4346
}
4447
});
4548
} catch(e){}
4649
try {
4750
/* Bypass TracerPid Detection Based On Pid Status */
48-
var fgetsPtr = Module.findExportByName("libc.so", "fgets");
51+
const libc = Process.getModuleByName("libc.so");
52+
var fgetsPtr = libc.getExportByName("fgets");
4953
var fgets = new NativeFunction(fgetsPtr, 'pointer', ['pointer', 'int', 'pointer']);
5054
Interceptor.replace(fgetsPtr, new NativeCallback(function(buffer, size, fp) {
5155
var retval = fgets(buffer, size, fp);
52-
var bufstr = Memory.readUtf8String(buffer);
56+
var bufstr = buffer.readUtf8String();
5357
if (bufstr.indexOf("TracerPid:") > -1) {
54-
Memory.writeUtf8String(buffer, "TracerPid:\t0");
58+
buffer.writeUtf8String("TracerPid:\t0");
5559
send("[Debugger Check] TracerPID check bypassed");
5660
}
5761
return retval;
@@ -60,7 +64,7 @@ try {
6064

6165
try {
6266
/* Bypass Ptrace Checks */
63-
Interceptor.attach(Module.findExportByName(null, "ptrace"), {
67+
Interceptor.attach(Module.getGlobalExportByName("ptrace"), {
6468
onEnter: function(args) {},
6569
onLeave: function(retval) {
6670
send("[Debugger Check] Ptrace check bypassed");
@@ -71,7 +75,7 @@ try {
7175

7276
try {
7377
/* Watch Child Process Forking */
74-
var fork = Module.findExportByName(null, "fork")
78+
var fork = Module.getGlobalExportByName("fork")
7579
Interceptor.attach(fork, {
7680
onEnter: function(args) {},
7781
onLeave: function(retval) {

mobsf/DynamicAnalyzer/tools/frida_scripts/android/default/root_bypass.js

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -205,39 +205,49 @@ Java.performNow(function () {
205205

206206
// Native Root Check Bypass
207207

208-
Interceptor.attach(Module.findExportByName("libc.so", "fopen"), {
209-
onEnter: function (args) {
210-
var path = Memory.readCString(args[0]);
211-
path = path.split("/");
212-
var executable = path[path.length - 1];
213-
var shouldFakeReturn = (RootBinaries.indexOf(executable) > -1)
214-
if (shouldFakeReturn) {
215-
Memory.writeUtf8String(args[0], "/notexists");
216-
send("[RootDetection Bypass] native fopen");
217-
}
218-
},
219-
onLeave: function (retval) {
208+
try {
209+
const libc = Process.getModuleByName("libc.so");
210+
211+
Interceptor.attach(libc.getExportByName("fopen"), {
212+
onEnter: function (args) {
213+
try{
214+
var path = Memory.readCString(args[0]);
215+
path = path.split("/");
216+
var executable = path[path.length - 1];
217+
var shouldFakeReturn = (RootBinaries.indexOf(executable) > -1)
218+
if (shouldFakeReturn) {
219+
args[0].writeUtf8String("/notexists");
220+
send("[RootDetection Bypass] native fopen");
221+
}
222+
} catch(e){}
223+
},
224+
onLeave: function (retval) {
220225

221-
}
222-
});
223-
Interceptor.attach(Module.findExportByName("libc.so", "system"), {
224-
onEnter: function (args) {
225-
var cmd = Memory.readCString(args[0]);
226-
send("[RootDetection Bypass] SYSTEM CMD: " + cmd);
227-
if (cmd.indexOf("getprop") != -1 || cmd == "mount" || cmd.indexOf("build.prop") != -1 || cmd == "id") {
228-
send("[RootDetection Bypass] native system: " + cmd);
229-
Memory.writeUtf8String(args[0], "grep");
230-
}
231-
if (cmd == "su") {
232-
send("[RootDetection Bypass] native system: " + cmd);
233-
Memory.writeUtf8String(args[0], "justafakecommandthatcannotexistsusingthisshouldthowanexceptionwheneversuiscalled");
234226
}
235-
},
236-
onLeave: function (retval) {
237-
238-
}
227+
});
228+
229+
Interceptor.attach(libc.getExportByName("system"), {
230+
onEnter: function (args) {
231+
try{
232+
var cmd = Memory.readCString(args[0]);
233+
send("[RootDetection Bypass] SYSTEM CMD: " + cmd);
234+
if (cmd.indexOf("getprop") != -1 || cmd == "mount" || cmd.indexOf("build.prop") != -1 || cmd == "id") {
235+
send("[RootDetection Bypass] native system: " + cmd);
236+
args[0].writeUtf8String("grep");
237+
}
238+
if (cmd == "su") {
239+
send("[RootDetection Bypass] native system: " + cmd);
240+
args[0].writeUtf8String("justafakecommandthatcannotexistsusingthisshouldthowanexceptionwheneversuiscalled");
241+
}
242+
} catch(e){}
243+
},
244+
onLeave: function (retval) {
239245

240-
});
246+
}
247+
});
248+
} catch (err) {
249+
send('[RootDetection Bypass] Error hooking libc.so: ' + err);
250+
}
241251
/*
242252
243253
TO IMPLEMENT:

0 commit comments

Comments
 (0)