TrollStore/README.md

127 lines
6.0 KiB
Markdown
Raw Normal View History

2022-09-02 23:19:48 +08:00
# TrollStore
2022-10-04 07:08:10 +08:00
TrollStore is a permasigned jailed app that can permanently install any IPA you open in it.
2022-09-02 23:19:48 +08:00
It works because of an AMFI/CoreTrust bug where iOS does not correctly verify code signatures of binaries in which there are multiple signers.
2022-09-14 00:52:04 +08:00
2024-01-07 21:12:52 +08:00
Supported versions: 14.0 - 16.6.1, 16.7 RC (20H18), 17.0
2023-11-28 20:09:28 +08:00
2022-11-06 06:34:37 +08:00
## Installing TrollStore
For installing TrollStore, refer to the guides at [ios.cfw.guide](https://ios.cfw.guide/installing-trollstore)
2022-11-06 06:31:39 +08:00
2024-01-27 08:27:40 +08:00
16.7.x (excluding 16.7 RC) and 17.0.1+ will NEVER be supported (unless a third CoreTrust bug is discovered, which is unlikely).
2022-10-30 06:45:30 +08:00
2022-10-13 01:49:13 +08:00
## Updating TrollStore
2022-09-14 00:47:05 +08:00
2022-10-14 10:17:53 +08:00
When a new TrollStore update is available, a button to install it will appear at the top in the TrollStore settings. After tapping the button, TrollStore will automatically download the update, install it, and respring.
Alternatively (if anything goes wrong), you can download the TrollStore.tar file under Releases and open it in TrollStore, TrollStore will install the update and respring.
2022-09-14 00:47:05 +08:00
2022-10-13 01:49:13 +08:00
## Uninstalling an app
2022-09-14 01:20:46 +08:00
2023-11-29 19:38:28 +08:00
Apps installed from TrollStore can only be uninstalled from TrollStore itself, tap an app or swipe it to the left in the 'Apps' tab to delete it.
2022-09-14 01:20:46 +08:00
2022-10-13 01:49:13 +08:00
## Persistence Helper
2022-09-14 00:47:05 +08:00
2022-10-04 07:08:10 +08:00
The CoreTrust bug used in TrollStore is only enough to install "System" apps, this is because FrontBoard has an additional security check (it calls libmis) every time before a user app is launched. Unfortunately it is not possible to install new "System" apps that stay through an icon cache reload. Therefore, when iOS reloads the icon cache, all TrollStore installed apps including TrollStore itself will revert back to "User" state and will no longer launch.
2022-09-14 00:47:05 +08:00
2022-10-04 07:08:10 +08:00
The only way to work around this is to install a persistence helper into a system app, this helper can then be used to reregister TrollStore and its installed apps as "System" so that they become launchable again, an option for this is available in TrollStore settings.
2022-09-14 00:47:05 +08:00
On jailbroken iOS 14 when TrollHelper is used for installation, it is located in /Applications and will persist as a "System" app through icon cache reloads, therefore TrollHelper is used as the persistence helper on iOS 14.
2022-10-30 06:45:30 +08:00
## URL Scheme
2024-01-25 21:04:24 +08:00
As of version 1.3, TrollStore replaces the system URL scheme "apple-magnifier" (this is done so "jailbreak" detections can't detect TrollStore like they could if TrollStore had a unique URL scheme). This URL scheme can be used to install applications right from the browser, or to enable JIT from the app itself, the format goes as follows:
2022-10-30 06:45:30 +08:00
2024-01-25 21:04:24 +08:00
- `apple-magnifier://install?url=<URL_to_IPA>`
- `apple-magnifier://enable-jit?bundle-id=<Bundle_ID>`
2022-10-30 06:45:30 +08:00
On devices that don't have TrollStore (1.3+) installed, this will just open the magnifier app.
2022-10-13 01:49:13 +08:00
## Features
2022-09-14 00:47:05 +08:00
2022-10-20 01:23:02 +08:00
The binaries inside an IPA can have arbitrary entitlements, fakesign them with ldid and the entitlements you want (`ldid -S<path/to/entitlements.plist> <path/to/binary>`) and TrollStore will preserve the entitlements when resigning them with the fake root certificate on installation. This gives you a lot of possibilities, some of which are explained below.
2022-09-14 00:47:05 +08:00
2022-10-13 01:49:13 +08:00
### Banned entitlements
2022-09-14 00:47:05 +08:00
iOS 15 on A12+ has banned the following three entitlements related to running unsigned code, these are impossible to get without a PPL bypass, apps signed with them will crash on launch.
2022-09-14 00:47:05 +08:00
`com.apple.private.cs.debugger`
`dynamic-codesigning`
`com.apple.private.skip-library-validation`
2022-10-13 01:49:13 +08:00
### Unsandboxing
2022-09-14 00:47:05 +08:00
Your app can run unsandboxed using one of the following entitlements:
```xml
2022-09-14 00:47:05 +08:00
<key>com.apple.private.security.container-required</key>
<false/>
```
```xml
2022-09-14 00:47:05 +08:00
<key>com.apple.private.security.no-container</key>
<true/>
```
```xml
2022-09-14 00:47:05 +08:00
<key>com.apple.private.security.no-sandbox</key>
<true/>
```
The third one is recommended if you still want a sandbox container for your application.
2022-10-12 07:19:44 +08:00
You might also need the platform-application entitlement in order for these to work properly:
2022-09-14 00:47:05 +08:00
```xml
2022-09-14 00:47:05 +08:00
<key>platform-application</key>
<true/>
```
Please note that the platform-application entitlement causes side effects such as some parts of the sandbox becoming tighter, so you may need additional private entitlements to circumvent that. (For example afterwards you need an exception entitlement for every single IOKit user client class you want to access).
In order for an app with `com.apple.private.security.no-sandbox` and `platform-application` to be able to access it's own data container, you might need the additional entitlement:
```xml
<key>com.apple.private.security.storage.AppDataContainers</key>
<true/>
```
2022-10-13 01:49:13 +08:00
### Root Helpers
2022-09-14 00:47:05 +08:00
When your app is not sandboxed, you can spawn other binaries using posix_spawn, you can also spawn binaries as root with the following entitlement:
2023-01-21 20:53:22 +08:00
```xml
2022-09-14 00:47:05 +08:00
<key>com.apple.private.persona-mgmt</key>
<true/>
```
2022-11-01 06:39:28 +08:00
You can also add your own binaries into your app bundle.
2022-09-14 00:47:05 +08:00
Afterwards you can use the [spawnRoot function in TSUtil.m](./Shared/TSUtil.m#L79) to spawn the binary as root.
2022-09-14 00:47:05 +08:00
2022-10-13 01:50:53 +08:00
### Things that are not possible using TrollStore
2022-09-14 00:47:05 +08:00
2022-12-03 07:27:52 +08:00
- Getting proper platformization (`TF_PLATFORM` / `CS_PLATFORMIZED`)
2022-09-14 00:50:06 +08:00
- Spawning a launch daemon (Would need `CS_PLATFORMIZED`)
2022-12-03 07:27:52 +08:00
- Injecting a tweak into a system process (Would need `TF_PLATFORM`, a userland PAC bypass and a PMAP trust level bypass)
2022-09-14 00:47:05 +08:00
2024-01-27 08:27:40 +08:00
### Compilation
To compile TrollStore, ensure [theos](https://theos.dev/docs/installation) is installed. Additionaly ensure [brew](https://brew.sh/) is installed and install [libarchive](https://formulae.brew.sh/formula/libarchive) from brew.
2022-10-13 01:49:13 +08:00
## Credits and Further Reading
2022-09-14 00:47:05 +08:00
[@alfiecg_dev](https://twitter.com/alfiecg_dev/) - Found the CoreTrust bug that allows TrollStore to work through patchdiffing and worked on automating the bypass.
Google Threat Analysis Group - Found the CoreTrust bug as part of an in-the-wild spyware chain and reported it to Apple.
2023-12-02 04:04:30 +08:00
[@LinusHenze](https://twitter.com/LinusHenze) - Found the installd bypass used to install TrollStore on iOS 14-15.6.1 via TrollHelperOTA, as well as the original CoreTrust bug used in TrollStore 1.0.
2022-09-14 00:47:05 +08:00
2023-10-08 23:41:49 +08:00
[Fugu15 Presentation](https://youtu.be/rPTifU1lG7Q)
[Write-Up on the first CoreTrust bug with more information](https://worthdoingbadly.com/coretrust/).