• Hello
Search Results for

    Show / Hide Table of Contents

    iOS - Jailbreak - Detector (Pro)

    A jailbreak removes Apple's limits on an iPhone or iPad. The player can then add code to your app, change it, read its files, or run cheat tools. This detector looks for common signs of a jailbreak.

    This detector needs the Pro version.

    Walkthrough: Jailbroken iOS devices.

    What it does

    IOSJailbreakDetector (namespace GUPS.AntiCheat.Detector.IOS) scans the device when the game starts, and again every few seconds. It has no monitor. One scan can run up to five checks:

    Check What it looks for
    URL schemes Known jailbreak apps such as Cydia or Sileo that the device can open
    Suspicious paths Files and folders that only exist on a jailbroken device
    Sandbox Whether the app can write a file outside its own folder. A normal app cannot
    Dyld injection Extra code that was loaded into your app when it started
    Suspicious dylibs Loaded libraries of known tweak tools, such as MobileSubstrate or Frida

    You turn each check on or off in the project settings.

    Do you need to add it?

    No, if you use the predefined Anti-Cheat-Monitor prefab. It already includes this detector.

    If you use your own monitor prefab, drag the iOS Jailbreak Detector prefab onto the monitor so it becomes a child.

    The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.

    Settings

    The IOSJailbreakDetector settings.

    • Is Active (isActive, bool, default true): Turns the detector on or off.
    • Possibility Of False Positive (possibilityOfFalsePositive, 0 to 1, default 0.01): How likely a find is a false alarm. A normal iPhone does not show these signs.
    • Threat Rating (threatRating, default 250): How much one find adds to the threat score. It is moderate because a jailbreak makes cheating possible, but it is not cheating by itself. Raise it if your game must not run on a jailbroken device.
    • On Cheating Detection Event (OnCheatingDetectionEvent): Methods to call on every find.
    • Check Only On Game Start (CheckOnlyOnGameStart, bool, default false): On means scan once. Off means scan again on the interval. Off is recommended, because extra code can be loaded later.
    • Recheck Interval For Possible Cheating (RecheckIntervalForPossibleCheating, seconds, 0.1 to 600, default 30): The wait between two scans.

    Project settings

    Open Edit > Project Settings > GuardingPearSoftware > AntiCheat and select the iOS tab. Go to iOS - Jailbreak - Settings.

    iOS jailbreak settings.

    All five checks are on by default. Each list below already holds the common entries. You can add your own.

    • Detect URL schemes: Turns the URL scheme check on.
      • Suspicious URL schemes: The schemes to ask for, such as cydia and sileo.
    • Detect suspicious paths: Turns the path check on.
      • Suspicious paths: The files and folders to look for, such as /Applications/Cydia.app.
    • Detect sandbox violation: Turns the sandbox check on.
    • Detect dyld injection: Turns the injected code check on.
      • Allowed library prefixes: Paths that are fine, such as /usr/lib/ and /Developer/. Xcode loads its debug libraries from there.
    • Detect suspicious dylibs: Turns the library check on.
      • Suspicious dylibs: Parts of library names to look for, such as MobileSubstrate.
    Note

    Verify development builds on the iOS tab is off by default. While it is off, the scan skips development builds. Turn it on while you test.

    What it reports

    On a find, the detector sends an IOSJailbreakDetectionStatus:

    public struct IOSJailbreakDetectionStatus : IIOSJailbreakDetectionStatus
    {
        // The kind of cheat. Always ECheatType.Jailbreak.
        public ECheatType CheatType { get; }
    
        // How likely this find is a false alarm, from 0 to 1.
        public float PossibilityOfFalsePositive { get; }
    
        // How much this find adds to the threat score.
        public uint ThreatRating { get; }
    
        // Which check found something.
        public EIOSJailbreakType JailbreakType { get; }
    
        // What was found, such as a path, a URL scheme, or a library name.
        public string Evidence { get; }
    }
    

    JailbreakType tells you which check found something:

    • URL_SCHEME: a jailbreak app can be opened.
    • SUSPICIOUS_PATH: a jailbreak file or folder exists.
    • SANDBOX_VIOLATION: a file could be written outside the app folder.
    • DYLD_INJECTION: extra code was loaded into the app.
    • SUSPICIOUS_DYLIB: a library of a tweak tool is loaded.

    You can also run a scan yourself. It returns true when it found something new.

    var detector = AntiCheatMonitor.Instance.GetDetector<IOSJailbreakDetector>();
    
    if (detector != null && detector.ManualScan())
    {
        // A new sign of a jailbreak was found.
    }
    

    Good to know

    • The flag stays. PossibleCheatingDetected stays true after the first find.
    • Each kind is reported once. A later scan that finds the same kind does not raise the score again. Five kinds can add up to five finds.
    • One find is a soft signal. With the default settings, one find only reaches the softest punisher. Many players jailbreak for other reasons than cheating.
    • The URL scheme check needs entries in Info.plist. Anti-Cheat adds them for you when you build.
    • A missing plugin does not crash the game. The detector logs a warning.

    Platforms and requirements

    iOS only. On other platforms the detector turns itself off. A real result needs a build on a device.

    • iOS 13.0 or newer. Unity's Target minimum iOS Version decides which devices can install the app.
    • The plugin com.gups.anticheat. It ships with the package in Assets/GUPS/AntiCheat/Plugins/iOS/. In its import settings, Add to Embedded Binaries must be on.

    React to a find

    Every find is added to the threat score of the Anti-Cheat Monitor. The predefined monitor prefab has no punisher. So nothing more happens to the player until you react yourself or add a punisher.

    In the Inspector. Add a method to On Cheating Detection Event. It runs on every find.

    In code. Ask the detector:

    var detector = AntiCheatMonitor.Instance.GetDetector<IOSJailbreakDetector>();
    
    if (detector != null && detector.PossibleCheatingDetected)
    {
        // The device shows signs of a jailbreak.
    }
    

    Or listen, so your code runs at the moment of the find. Subscribe returns an IDisposable. Dispose it when you want to stop.

    using System;
    using GUPS.AntiCheat;
    using GUPS.AntiCheat.Core.Detector;
    using GUPS.AntiCheat.Detector.IOS;
    using UnityEngine;
    
    public class IOSJailbreakDetectionLogger : MonoBehaviour, IObserver<IDetectorStatus>
    {
        private void Start()
        {
            var detector = AntiCheatMonitor.Instance.GetDetector<IOSJailbreakDetector>();
            detector.Subscribe(this);
        }
    
        public void OnNext(IDetectorStatus status)
        {
            if (status is IOSJailbreakDetectionStatus ios)
            {
                Debug.LogWarning($"Jailbreak sign found: {ios.JailbreakType} ({ios.Evidence})");
            }
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    Back to the Detector overview.

    In This Article
    Back to top GuardingPearSoftware documentation