question

dush-1804 avatar image
0 Votes"
dush-1804 asked dush-1804 edited

Detect jailbroken bypass(shadow,A-bypass) in Xamarin forms

My Xamarin based iOS application should not run in jailbroken devices. This is due to a IS audit. I have implemented the jailbroken detect mechanism. But I cannot find a way to detect whether someone using a jailbroken bypass method like for example A-bypass, shadow tweaks. Below is the code that I used for detecting jailbreak. But when we use tweaks these getting bypassed. I have also used nugets like BreachDetector and RootCheck . Those are also getting bypassed by tweaks.

Code....

 [assembly: Dependency(typeof(CheckHardware))]
     namespace CustApp.iOS
     {
         public class CheckHardware : IHardwareSecurity
         {
        
             public CheckHardware()
             {
             }
        
             public bool IsJailBreaked()
             {
        
                 if (isPath() || canCreateFile() || isOpenLink())
                 {
                     return true;
        
                 }
                 else
                 {
        
                     return false;
        
                 }
        
             }
        
             private bool isPath()
             {
        
                 bool res = false;
        
                 List<string> pathList = new List<string>
                  {
                      "/Applications/Cydia.app",
                      "/Applications/Checkra1n.app",
                      "/Applications/FakeCarrier.app",
                      "/Applications/Icy.app",
                      "/Applications/IntelliScreen.app",
                      "/Applications/MxTube.app",
                      "/Applications/RockApp.app",
                      "/Applications/SBSettings.app",
                      "/Applications/WinterBoard.app",
                      "/Applications/blackra1n.app",
                      "/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",
                      "/Library/MobileSubstrate/DynamicLibraries/Veency.plist",
                      "/Library/MobileSubstrate/MobileSubstrate.dylib",
                      "/System/Library/LaunchDaemons/com.ikey.bbot.plist",
                      "/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
                      "/etc/apt",
                      "/private/var/lib/apt",
                      "/private/var/lib/apt/",
                      "/private/var/lib/cydia",
                      "/private/var/mobile/Library/SBSettings/Themes",
                      "/private/var/stash",
                      "/private/var/tmp/cydia.log",
                      "/usr/bin/sshd",
                      "/var/cache/apt",
                      "/var/lib/apt",
                      "/usr/libexec/sftp-server",
                      "/usr/sbin/sshd",
                      "/bin/bash",
                      "/Library/MobileSubstrate/MobileSubstrate.dylib",
                      "/var/lib/cydia"
                  };
        
                 foreach (var fullPath in pathList)
                 {
                     if (File.Exists(fullPath))
                     {
                         res = true;
                     }
                 }
        
                 return res;
        
             }
        
             private bool canCreateFile()
             {
        
                 try
                 {
                     File.WriteAllText("/private/jailbreak.txt", "This is a test.");
                     return true;
                 }
                 catch (UnauthorizedAccessException)
                 {
                     return false;
                 }
        
             }
        
             private bool isOpenLink()
             {
        
                 if (UIApplication.SharedApplication.CanOpenUrl(NSUrl.FromString("cydia://package/com.example.package")))
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
        
             public bool IsInEmulator()
             {
                 bool isSimulator = Runtime.Arch == Arch.SIMULATOR;
                 return isSimulator;
             }
        
        
         }
        
     }

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers