mirror of https://github.com/opa334/TrollStore.git
1.0.7
This commit is contained in:
parent
8f8644682c
commit
4d2bfbf667
|
@ -202,7 +202,6 @@ int runLdid(NSArray* args, NSString** output, NSString** errorOutput)
|
||||||
|
|
||||||
SecStaticCodeRef getStaticCodeRef(NSString *binaryPath)
|
SecStaticCodeRef getStaticCodeRef(NSString *binaryPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(binaryPath == nil)
|
if(binaryPath == nil)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -233,7 +232,6 @@ SecStaticCodeRef getStaticCodeRef(NSString *binaryPath)
|
||||||
|
|
||||||
NSDictionary* dumpEntitlements(SecStaticCodeRef codeRef)
|
NSDictionary* dumpEntitlements(SecStaticCodeRef codeRef)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(codeRef == NULL)
|
if(codeRef == NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"[dumpEntitlements] attempting to dump entitlements without a StaticCodeRef");
|
NSLog(@"[dumpEntitlements] attempting to dump entitlements without a StaticCodeRef");
|
||||||
|
@ -295,7 +293,6 @@ NSDictionary* dumpEntitlementsFromBinaryAtPath(NSString *binaryPath)
|
||||||
|
|
||||||
BOOL certificateHasDataForExtensionOID(SecCertificateRef certificate, CFStringRef oidString)
|
BOOL certificateHasDataForExtensionOID(SecCertificateRef certificate, CFStringRef oidString)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(certificate == NULL || oidString == NULL)
|
if(certificate == NULL || oidString == NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"[certificateHasDataForExtensionOID] attempted to check null certificate or OID");
|
NSLog(@"[certificateHasDataForExtensionOID] attempted to check null certificate or OID");
|
||||||
|
@ -314,7 +311,6 @@ BOOL certificateHasDataForExtensionOID(SecCertificateRef certificate, CFStringRe
|
||||||
|
|
||||||
BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(codeRef == NULL)
|
if(codeRef == NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] attempted to check cert chain of null static code object");
|
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] attempted to check cert chain of null static code object");
|
||||||
|
@ -325,7 +321,7 @@ BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
OSStatus result;
|
OSStatus result;
|
||||||
|
|
||||||
result = SecCodeCopySigningInformation(codeRef, kSecCSSigningInformation, &signingInfo);
|
result = SecCodeCopySigningInformation(codeRef, kSecCSSigningInformation, &signingInfo);
|
||||||
|
|
||||||
if(result != errSecSuccess)
|
if(result != errSecSuccess)
|
||||||
{
|
{
|
||||||
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] failed to copy signing info from static code");
|
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] failed to copy signing info from static code");
|
||||||
|
@ -333,14 +329,18 @@ BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
CFArrayRef certificates = CFDictionaryGetValue(signingInfo, kSecCodeInfoCertificates);
|
CFArrayRef certificates = CFDictionaryGetValue(signingInfo, kSecCodeInfoCertificates);
|
||||||
|
if(certificates == NULL || CFArrayGetCount(certificates) == 0)
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
// If we match the standard Apple policy, we are signed properly, but we haven't been deliberately signed with a custom root
|
// If we match the standard Apple policy, we are signed properly, but we haven't been deliberately signed with a custom root
|
||||||
|
|
||||||
SecPolicyRef appleAppStorePolicy = SecPolicyCreateWithProperties(kSecPolicyAppleiPhoneApplicationSigning, NULL);
|
SecPolicyRef appleAppStorePolicy = SecPolicyCreateWithProperties(kSecPolicyAppleiPhoneApplicationSigning, NULL);
|
||||||
|
|
||||||
SecTrustRef trust = NULL;
|
SecTrustRef trust = NULL;
|
||||||
SecTrustCreateWithCertificates(certificates, appleAppStorePolicy, &trust);
|
SecTrustCreateWithCertificates(certificates, appleAppStorePolicy, &trust);
|
||||||
|
|
||||||
if(SecTrustEvaluateWithError(trust, nil))
|
if(SecTrustEvaluateWithError(trust, nil))
|
||||||
{
|
{
|
||||||
CFRelease(trust);
|
CFRelease(trust);
|
||||||
|
@ -350,7 +350,7 @@ BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] found certificate extension, but was issued by Apple (App Store)");
|
NSLog(@"[codeCertChainContainsFakeAppStoreExtensions] found certificate extension, but was issued by Apple (App Store)");
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We haven't matched Apple, so keep going. Is the app profile signed?
|
// We haven't matched Apple, so keep going. Is the app profile signed?
|
||||||
|
|
||||||
CFRelease(appleAppStorePolicy);
|
CFRelease(appleAppStorePolicy);
|
||||||
|
@ -397,7 +397,7 @@ BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
CFRelease(signingInfo);
|
CFRelease(signingInfo);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to add our certificate chain to the anchor as it is expected to be a self-signed root
|
// Need to add our certificate chain to the anchor as it is expected to be a self-signed root
|
||||||
SecTrustSetAnchorCertificates(trust, certificates);
|
SecTrustSetAnchorCertificates(trust, certificates);
|
||||||
|
|
||||||
|
@ -413,8 +413,6 @@ BOOL codeCertChainContainsFakeAppStoreExtensions(SecStaticCodeRef codeRef)
|
||||||
|
|
||||||
BOOL signApp(NSString* appPath, NSError** error)
|
BOOL signApp(NSString* appPath, NSError** error)
|
||||||
{
|
{
|
||||||
if(!isLdidInstalled()) return NO;
|
|
||||||
|
|
||||||
NSDictionary* appInfoDict = [NSDictionary dictionaryWithContentsOfFile:[appPath stringByAppendingPathComponent:@"Info.plist"]];
|
NSDictionary* appInfoDict = [NSDictionary dictionaryWithContentsOfFile:[appPath stringByAppendingPathComponent:@"Info.plist"]];
|
||||||
if(!appInfoDict) return NO;
|
if(!appInfoDict) return NO;
|
||||||
|
|
||||||
|
@ -437,18 +435,21 @@ BOOL signApp(NSString* appPath, NSError** error)
|
||||||
}
|
}
|
||||||
|
|
||||||
SecStaticCodeRef codeRef = getStaticCodeRef(executablePath);
|
SecStaticCodeRef codeRef = getStaticCodeRef(executablePath);
|
||||||
if(codeRef == NULL)
|
if(codeRef != NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"[signApp] failed to get static code, can't derive entitlements from %@", executablePath);
|
if(codeCertChainContainsFakeAppStoreExtensions(codeRef))
|
||||||
return NO;
|
{
|
||||||
}
|
NSLog(@"[signApp] taking fast path for app signed using a custom root certificate (%@)", executablePath);
|
||||||
|
CFRelease(codeRef);
|
||||||
if(codeCertChainContainsFakeAppStoreExtensions(codeRef))
|
return YES;
|
||||||
{
|
}
|
||||||
NSLog(@"[signApp] taking fast path for app signed using a custom root certificate (%@)", executablePath);
|
|
||||||
CFRelease(codeRef);
|
|
||||||
return YES;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"[signApp] failed to get static code, can't derive entitlements from %@, continuing anways...", executablePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isLdidInstalled()) return NO;
|
||||||
|
|
||||||
NSString* certPath = [trollStoreAppPath() stringByAppendingPathComponent:@"cert.p12"];
|
NSString* certPath = [trollStoreAppPath() stringByAppendingPathComponent:@"cert.p12"];
|
||||||
NSString* certArg = [@"-K" stringByAppendingPathComponent:certPath];
|
NSString* certArg = [@"-K" stringByAppendingPathComponent:certPath];
|
||||||
|
@ -499,6 +500,7 @@ void applyPatchesToInfoDictionary(NSString* appPath)
|
||||||
// 170: failed to create container for app bundle
|
// 170: failed to create container for app bundle
|
||||||
// 171: a non trollstore app with the same identifier is already installled
|
// 171: a non trollstore app with the same identifier is already installled
|
||||||
// 172: no info.plist found in app
|
// 172: no info.plist found in app
|
||||||
|
// 173: app is not signed and cannot be signed because ldid not installed or didn't work
|
||||||
int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
{
|
{
|
||||||
NSLog(@"[installApp force = %d]", force);
|
NSLog(@"[installApp force = %d]", force);
|
||||||
|
@ -510,8 +512,7 @@ int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
|
|
||||||
if(sign)
|
if(sign)
|
||||||
{
|
{
|
||||||
// if it fails to sign, we don't care
|
if(!signApp(appPath, error)) return 173;
|
||||||
signApp(appPath, error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL existed;
|
BOOL existed;
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<string>iPhoneOS</string>
|
<string>iPhoneOS</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0.6</string>
|
<string>1.0.7</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Package: com.opa334.trollstorehelper
|
Package: com.opa334.trollstorehelper
|
||||||
Name: TrollStore Helper
|
Name: TrollStore Helper
|
||||||
Version: 1.0.6
|
Version: 1.0.7
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: Helper app to install and manage TrollStore!
|
Description: Helper app to install and manage TrollStore!
|
||||||
Maintainer: opa334
|
Maintainer: opa334
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<string>iPhoneOS</string>
|
<string>iPhoneOS</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0.6</string>
|
<string>1.0.7</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
case 172:
|
case 172:
|
||||||
errorDescription = @"The app does not seem to contain an Info.plist";
|
errorDescription = @"The app does not seem to contain an Info.plist";
|
||||||
break;
|
break;
|
||||||
|
case 173:
|
||||||
|
errorDescription = @"The app is not signed with a fake CoreTrust certificate and ldid does not seem to be installed. Make sure ldid is installed in the settings tab and try again.";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSError* error = [NSError errorWithDomain:TrollStoreErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : errorDescription}];
|
NSError* error = [NSError errorWithDomain:TrollStoreErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : errorDescription}];
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
PSSpecifier* otherGroupSpecifier = [PSSpecifier emptyGroupSpecifier];
|
PSSpecifier* otherGroupSpecifier = [PSSpecifier emptyGroupSpecifier];
|
||||||
[otherGroupSpecifier setProperty:[NSString stringWithFormat:@"TrollStore %@\n\n© 2022 Lars Fröder (opa334)\n\nCredits:\n@LinusHenze: CoreTrust bug\n@zhuowei: CoreTrust bug writeup and cert\n@ProcursusTeam: uicache and ldid build\n@cstar_ow: uicache\n@saurik: ldid", getTrollStoreVersion()] forKey:@"footerText"];
|
[otherGroupSpecifier setProperty:[NSString stringWithFormat:@"TrollStore %@\n\n© 2022 Lars Fröder (opa334)\n\nCredits:\n@LinusHenze: CoreTrust bug\n@zhuowei: CoreTrust bug writeup and cert\n@lunotech11: Some contributions\n@ProcursusTeam: uicache and ldid build\n@cstar_ow: uicache\n@saurik: ldid", getTrollStoreVersion()] forKey:@"footerText"];
|
||||||
[_specifiers addObject:otherGroupSpecifier];
|
[_specifiers addObject:otherGroupSpecifier];
|
||||||
|
|
||||||
// Uninstall TrollStore
|
// Uninstall TrollStore
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Package: com.opa334.trollstore
|
Package: com.opa334.trollstore
|
||||||
Name: TrollStore
|
Name: TrollStore
|
||||||
Version: 1.0.6
|
Version: 1.0.7
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: An awesome application!
|
Description: An awesome application!
|
||||||
Maintainer: opa334
|
Maintainer: opa334
|
||||||
|
|
Loading…
Reference in New Issue