Supports sideloading more than 3 apps via MacDirtyCow exploit

The MacDirtyCow exploit allows users to remove the 3 active apps limit on iOS 16.1.2 and earlier. To support this, we’ve added a new (hidden) “Enforce 3-App Limit” setting that can be disabled to allow sideloading more than 3 apps.
This commit is contained in:
Riley Testut
2023-02-06 17:36:05 -06:00
committed by Magesh K
parent 5da3974795
commit 66a17bc27f
6 changed files with 118 additions and 11 deletions

View File

@@ -52,6 +52,7 @@ public extension UserDefaults
@NSManaged var trustedSourceIDs: [String]?
@NSManaged var trustedServerURL: String?
@nonobjc
var activeAppsLimit: Int? {
get {
return self._activeAppsLimit?.intValue
@@ -69,6 +70,8 @@ public extension UserDefaults
}
@NSManaged @objc(activeAppsLimit) private var _activeAppsLimit: NSNumber?
@NSManaged var ignoreActiveAppsLimit: Bool
class func registerDefaults()
{
let ios13_5 = OperatingSystemVersion(majorVersion: 13, minorVersion: 5, patchVersion: 0)
@@ -88,7 +91,8 @@ public extension UserDefaults
#keyPath(UserDefaults.localServerSupportsRefreshing): localServerSupportsRefreshing,
#keyPath(UserDefaults.requiresAppGroupMigration): true,
#keyPath(UserDefaults.menuAnisetteList): "https://servers.sidestore.io/servers.json",
#keyPath(UserDefaults.menuAnisetteURL): "https://ani.sidestore.io"
#keyPath(UserDefaults.menuAnisetteURL): "https://ani.sidestore.io",
#keyPath(UserDefaults.ignoreActiveAppsLimit): false
] as [String : Any]
UserDefaults.standard.register(defaults: defaults)

View File

@@ -12,8 +12,22 @@ import CoreData
import AltSign
import SemanticVersion
// Free developer accounts are limited to only 3 active sideloaded apps at a time as of iOS 13.3.1.
public let ALTActiveAppsLimit = 3
extension InstalledApp
{
public static var freeAccountActiveAppsLimit: Int {
if UserDefaults.standard.ignoreActiveAppsLimit
{
// MacDirtyCow exploit allows users to remove 3-app limit, so return 10 to match App ID limit per-week.
// Don't return nil because that implies there is no limit, which isn't quite true due to App ID limit.
return 10
}
else
{
// Free developer accounts are limited to only 3 active sideloaded apps at a time as of iOS 13.3.1.
return 3
}
}
}
public protocol InstalledAppProtocol: Fetchable
{

View File

@@ -50,7 +50,7 @@ class InstalledAppToInstalledAppMigrationPolicy: NSEntityMigrationPolicy
// We can assume there is an active app limit,
// but will confirm next time user authenticates.
UserDefaults.standard.activeAppsLimit = ALTActiveAppsLimit
UserDefaults.standard.activeAppsLimit = InstalledApp.freeAccountActiveAppsLimit
}
return NSNumber(value: isActive)