forked from MobSF/Mobile-Security-Framework-MobSF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from MobSF/master
June 2024 update
- Loading branch information
Showing
229 changed files
with
258,045 additions
and
201,278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
sonar.sources=. | ||
sonar.exclusions=mobsf/static/**/*,mobsf/templates/**/* | ||
sonar.sourceEncoding=UTF-8 | ||
sonar.python.version=3.7, 3.8, 3.9, 3.10, 3.11 | ||
sonar.python.version=3.10, 3.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""File upload to iOS form.""" | ||
from django import forms | ||
|
||
|
||
class UploadFileForm(forms.Form): | ||
file = forms.FileField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
mobsf/DynamicAnalyzer/tools/frida_scripts/android/auxiliary/string_compare.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//String comparison | ||
Java.perform(function () { | ||
send('[AUXILIARY] [String Compare] capturing all string comparisons') | ||
let Exception = Java.use('java.lang.Exception'); | ||
let javaString = Java.use('java.lang.String') | ||
let objectClass = 'java.lang.Object'; | ||
var skiplist = ['android.app.SystemServiceRegistry.getSystemService'] | ||
javaString.equals.overload(objectClass).implementation = function (obj) { | ||
var response = javaString.equals.overload(objectClass).call(this, obj); | ||
if (obj && obj.toString().length > 5) { | ||
var stack = []; | ||
var calledFrom = Exception.$new().getStackTrace().toString().split(','); | ||
// Otherwise capture string comparisons | ||
let i = 0; | ||
do { | ||
i = i + 1; | ||
stack.push(calledFrom[i]); | ||
} while (i <= 5); | ||
var skipClass, skipMethod = false; | ||
skiplist.forEach(function (toSkip) { | ||
if (calledFrom[4].includes(toSkip)) | ||
skipClass = true; | ||
}); | ||
if (!skipClass) { | ||
var data = { | ||
caller: stack, | ||
string1: javaString.toString.call(this), | ||
string2: obj.toString(), | ||
return: response, | ||
} | ||
send('[AUXILIARY] [String Compare] ' + JSON.stringify(data, null, 2)); | ||
} | ||
} | ||
return response; | ||
} | ||
}); | ||
|
File renamed without changes.
198 changes: 198 additions & 0 deletions
198
mobsf/DynamicAnalyzer/tools/frida_scripts/android/default/debugger_check_bypass.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
Java.perform(function () { | ||
try { | ||
// Bypass isDebuggerConnected() check | ||
var Debug = Java.use('android.os.Debug'); | ||
Debug.isDebuggerConnected.implementation = function () { | ||
send('[Debugger Check] isDebuggerConnected() check bypassed'); | ||
return false; | ||
} | ||
} catch(e){} | ||
}); | ||
// Following are based on: https://github.com/apkunpacker/FridaScripts | ||
try { | ||
/* Bypass Frida Detection Based On Port Number */ | ||
Interceptor.attach(Module.findExportByName("libc.so", "connect"), { | ||
onEnter: function(args) { | ||
var memory = Memory.readByteArray(args[1], 64); | ||
var b = new Uint8Array(memory); | ||
if (b[2] == 0x69 && b[3] == 0xa2 && b[4] == 0x7f && b[5] == 0x00 && b[6] == 0x00 && b[7] == 0x01) { | ||
this.frida_detection = true; | ||
} | ||
}, | ||
onLeave: function(retval) { | ||
if (this.frida_detection) { | ||
send("[Debugger Check] Frida Port detection bypassed"); | ||
retval.replace(-1); | ||
} | ||
} | ||
}); | ||
} catch(e){} | ||
try { | ||
Interceptor.attach(Module.findExportByName(null, "connect"), { | ||
onEnter: function(args) { | ||
var family = Memory.readU16(args[1]); | ||
if (family !== 2) { | ||
return | ||
} | ||
var port = Memory.readU16(args[1].add(2)); | ||
port = ((port & 0xff) << 8) | (port >> 8); | ||
if (port === 27042) { | ||
send('[Debugger Check] Frida Port detection bypassed'); | ||
Memory.writeU16(args[1].add(2), 0x0101); | ||
} | ||
} | ||
}); | ||
} catch(e){} | ||
try { | ||
/* Bypass TracerPid Detection Based On Pid Status */ | ||
var fgetsPtr = Module.findExportByName("libc.so", "fgets"); | ||
var fgets = new NativeFunction(fgetsPtr, 'pointer', ['pointer', 'int', 'pointer']); | ||
Interceptor.replace(fgetsPtr, new NativeCallback(function(buffer, size, fp) { | ||
var retval = fgets(buffer, size, fp); | ||
var bufstr = Memory.readUtf8String(buffer); | ||
if (bufstr.indexOf("TracerPid:") > -1) { | ||
Memory.writeUtf8String(buffer, "TracerPid:\t0"); | ||
send("[Debugger Check] TracerPID check bypassed"); | ||
} | ||
return retval; | ||
}, 'pointer', ['pointer', 'int', 'pointer'])) | ||
} catch(e){} | ||
|
||
try { | ||
/* Bypass Ptrace Checks */ | ||
Interceptor.attach(Module.findExportByName(null, "ptrace"), { | ||
onEnter: function(args) {}, | ||
onLeave: function(retval) { | ||
send("[Debugger Check] Ptrace check bypassed"); | ||
retval.replace(0); | ||
} | ||
}) | ||
} catch(e){} | ||
|
||
try { | ||
/* Watch Child Process Forking */ | ||
var fork = Module.findExportByName(null, "fork") | ||
Interceptor.attach(fork, { | ||
onEnter: function(args) {}, | ||
onLeave: function(retval) { | ||
var pid = parseInt(retval.toString(16), 16) | ||
send("[Debugger Check] Hook fork child process PID: " + pid) | ||
} | ||
}) | ||
} catch(e){} | ||
|
||
|
||
/* Xposed Detection Bypass */ | ||
Java.perform(function() { | ||
try { | ||
var cont = Java.use("java.lang.String"); | ||
cont.contains.overload("java.lang.CharSequence").implementation = function(checks) { | ||
var check = checks.toString(); | ||
if (check.indexOf("libdexposed") >= 0 || check.indexOf("libsubstrate.so") >= 0 || check.indexOf("libepic.so") >= 0 || check.indexOf("libxposed") >= 0) { | ||
var BypassCheck = "libpkmkb.so"; | ||
send("[Debugger Check] Xposed library check bypassed"); | ||
return this.contains.call(this, BypassCheck); | ||
} | ||
return this.contains.call(this, checks); | ||
} | ||
} catch (erro) { | ||
console.error(erro); | ||
} | ||
try { | ||
var StacktraceEle = Java.use("java.lang.StackTraceElement"); | ||
StacktraceEle.getClassName.overload().implementation = function() { | ||
var Flag = false; | ||
var ClazzName = this.getClassName(); | ||
if (ClazzName.indexOf("com.saurik.substrate.MS$2") >= 0 || ClazzName.indexOf("de.robv.android.xposed.XposedBridge") >= 0) { | ||
send("[Debugger Check] Debugger detection check bypassed for class: " + this.getClassName()); | ||
Flag = true; | ||
if (Flag) { | ||
var StacktraceEle = Java.use("java.lang.StackTraceElement"); | ||
StacktraceEle.getClassName.overload().implementation = function() { | ||
var gMN = this.getMethodName(); | ||
if (gMN.indexOf("handleHookedMethod") >= 0 || gMN.indexOf("invoked") >= 0) { | ||
send("[Debugger Check] Debugger detection check bypassed for method: " + this.getMethodName()); | ||
return "bye.pass"; | ||
} | ||
return this.getMethodName(); | ||
} | ||
} | ||
return "com.android.vending" | ||
} | ||
return this.getClassName(); | ||
} | ||
} catch (errr) { | ||
console.error(errr); | ||
} | ||
}) | ||
/* VPN Related Checks */ | ||
Java.perform(function() { | ||
var NInterface = Java.use("java.net.NetworkInterface"); | ||
try { | ||
var NInterface = Java.use("java.net.NetworkInterface"); | ||
NInterface.getName.overload().implementation = function() { | ||
var IName = this.getName(); | ||
if (IName == "tun0" || IName == "ppp0" || IName == "p2p0" || IName == "ccmni0" || IName == "tun") { | ||
send("[Debugger Check] Bypassed Network Interface name check: " + JSON.stringify(this.getName())); | ||
return "Bypass"; | ||
} | ||
return this.getName(); | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
// HTTP(s) Proxy check | ||
try { | ||
var GetProperty = Java.use("java.lang.System"); | ||
GetProperty.getProperty.overload("java.lang.String").implementation = function(getprop) { | ||
if (getprop.indexOf("http.proxyHost") >= 0 || getprop.indexOf("http.proxyPort") >= 0) { | ||
var newprop = "CKMKB" | ||
send("[Debugger Check] HTTP(s) proxy check bypassed") | ||
return this.getProperty.call(this, newprop); | ||
} | ||
return this.getProperty(getprop); | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
// NetworkCapabilities check | ||
try { | ||
var NCap = Java.use("android.net.NetworkCapabilities"); | ||
NCap.hasTransport.overload("int").implementation = function(values) { | ||
if (values == 4){ | ||
send("[Debugger Check] HasTransportcheck bypassed") | ||
return false; | ||
} else | ||
return this.hasTransport(values); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
}) | ||
/* Developer Mod Check Bypass */ | ||
Java.perform(function() { | ||
try{ | ||
var SSecure = Java.use("android.provider.Settings$Secure"); | ||
SSecure.getStringForUser.overload('android.content.ContentResolver', 'java.lang.String', 'int').implementation = function(Content, Name, Flag) { | ||
if (Name.indexOf("development_settings_enabled") >= 0) { | ||
send("[Debugger Check] Developer mode check bypassed for: " + Name) | ||
return this.getStringForUser.call(this, Content, "bypassed", Flag); | ||
} | ||
return this.getStringForUser(Content, Name, Flag); | ||
} | ||
} catch(e){} | ||
}) | ||
|
||
/* Playstore install source check */ | ||
Java.perform(function() { | ||
try{ | ||
var Installer = Java.use("android.app.ApplicationPackageManager"); | ||
Installer.getInstallerPackageName.overload('java.lang.String').implementation = function(Str) { | ||
var playPkg = "com.android.vending"; | ||
if (Str.toString().indexOf(playPkg) < 0) { | ||
send("[Debugger Check] Play Store install source check bypassed. Original value: "+ Str.toString()); | ||
return playPkg; | ||
} | ||
} | ||
} catch(e){} | ||
}) |
Oops, something went wrong.