Skip to content

Instantly share code, notes, and snippets.

@tothi
Created September 15, 2019 09:06
Show Gist options
  • Save tothi/3d7628f402af2bb36df57856f994c513 to your computer and use it in GitHub Desktop.
Save tothi/3d7628f402af2bb36df57856f994c513 to your computer and use it in GitHub Desktop.
simple jailbreak check bypass (frida hook for a custom app)
// simple jailbreak check bypass (frida hook for a custom app)
//
// launch app with frida hook:
// frida -U -l frida-bypass-jb-check.js -f ... --no-pause
var fileExistsAtPath = ObjC.classes.NSFileManager["- fileExistsAtPath:"];
var hideFile = 0;
var jailbreakFiles = ["/Applications/Cydia.app",
"/bin/bash",
"/bin/sh",
"/etc/apt/sources.list.d/sileo.sources",
"/etc/apt/sillyo/sileo.sources",
"/Library/MobileSubstrate/MobileSubstrate.dylib",
"/usr/sbin/sshd",
"/etc/apt",
"/usr/bin/ssh"];
Interceptor.attach(fileExistsAtPath.implementation, {
onEnter: function(args) {
var path = ObjC.Object(args[2]);
if (jailbreakFiles.indexOf(path.toString()) > -1) {
console.log("Checking jailbreak file: " + path.toString());
hideFile = 1;
} // else { console.log("[NSFileManager fileExistsAtPath:] " + path.toString()); }
},
onLeave: function(retval) {
if (hideFile) {
console.log("Hiding jailbreak file...");
retval.replace(0);
hideFile = 0;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment