.NET MAUI Jailbreak and root detection

banditoth.MAUI packages just got a new package: banditoth.MAUI.JailbreakDetector. 2022 was a great year for me in a software development perspective, my MAUI packages got downloaded over more than 1500 times, which is a great achievement for me. I’m keeping up the work, and having a new package on my palette: A lightweight root and jailbreak detection algorithm for Android and iOS with .NET MAUI.

What is jailbreaking?

Jailbreaking is the process of removing the limitations imposed on iOS devices by Apple. It allows users to install apps and tweaks that are not available on the App Store, customise the appearance of the operating system, and access features that are otherwise restricted. Jailbreaking an iOS device is considered to be a violation of Apple’s terms of service, and it can also make the device more vulnerable to security risks.

What is rooting?

Rooting is the process of allowing users of smartphones, tablets and other devices running the Android mobile operating system to attain privileged control (known as root access) over various Android subsystems. Rooting is often performed with the goal of removing limitations that hardware manufacturers or carriers place on some devices, thereby providing the latest versions of Android to devices that no longer receive official updates, or unlocking features which are otherwise unavailable to the user. Rooting is also often used to remove pre-installed apps, known as bloatware, that the manufacturer or carrier included on the device and which the user may not have wanted.

Why jailbreak and root protection is important?

When a device is jailbroken or rooted, it can become more vulnerable to security risks because the jailbreak process involves disabling certain security measures and exposing the device to potentially malicious software. This can compromise the security and stability of the operating system, and it can also make the device more susceptible to being hacked or compromised in other ways. By implementing jailbreak protection, software developers can help to ensure that their apps and systems are running on a secure and stable platform, which can help to protect the device and its users from various types of attacks and vulnerabilities.

Use jailbreak and root protection in .NET MAUI

Install the banditoth.MAUI.JailbreakDetector NuGet in order to protect your apps against vulnerabilities.

Initalize the library in the MauiApp.cs file within the CreateMauiApp method, like this:

public static MauiApp CreateMauiApp()
			var builder = MauiApp.CreateBuilder()
				.ConfigureJailbreakProtection(configuration =>
					configuration.MaximumPossibilityPercentage = 20;
					configuration.MaximumWarningCount = 1;
					configuration.CanThrowException = true;
			return builder.Build();

You can dependency inject the jailbreak detector instance, by resolving an instance of IJailbreakDetector. Store the instance in a private readonly field in your class, or use it directly.

    public async Task CheckJailbreakOrRoot()
            if(await _jbDetector.IsRootedOrJailbrokenAsync())
                // Code when jailbroken or rooted
                // Code when clear

By calling ScanExploitsAsync you can process the discovered exploits and warnings during the scan – It returns a ScanResultScanResult has a property named PossibilityPercentage. This percentage tells you how confidently you can tell whether a device has been jailbroken or rooted. Different types of tests contribute different weights to the final result.

    public async Task CheckJailbreakOrRoot()
        ScanResult scan = await _jbDetector.ScanExploitsAsync();
        if(scan == null)
        foreach(var exploit in scan.Exploits)
            // Get detailed information about the exploits here
        if(scan.PossibilityPercentage < 5)
            // Custom code when only 5% possible that the device is rooted or jailbroken


Please note that there are many different kinds of jailbreaks and roots. It is possible that this package does not properly support the detection of these different techniques. If you find that filtering does not work on your device, please help by expanding the code repository.

This content has 1 year. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

4 thoughts on “.NET MAUI Jailbreak and root detection”

    • Hi Manjunatha,

      Please ensure that . ConfigureJailbreakProtection(xxxxx); have been called when initializing your MAUI app, and you use the dependency injection in a correct way (by populationg ur class with DI).
      If you have further problems, please reach out by filling a bug ticket on the MAUI.Packages repo @ https://github.com/banditoth/MAUI.Packages/issues


  1. Hi,

    I am trying to use this, but I am lost in the dependency injection part, when I try to do this for resolving the dependency, I get a null object:
    IJailbreakDetector _jbDetector => DependencyService.Get();

    How do I register the service?

    I did initialized the ConfigureJailbreakProtection part in MauiProgram.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.