Repository: Rust505/iOS-ramdisk-builder-A12-A13
Supported devices: iPhone 11, 11 Pro, 11 Pro Max, SE 2, XS, XS Max, XR, iPad mini 5, iPad Air 3
Supported iOS: 14.0 β 27.0.1 (SSH ramdisk build)
build4.sh builds an SSH ramdisk for devices with A12/A13 chips (CPID 0x8020 / 0x8030). The resulting bootchain is loaded via boot.sh in DFU mode and provides root SSH access (port 2222, password alpine).
- Downloads the IPSW for the specified iOS version from Apple servers (via
api.ipsw.me) - Extracts
BuildManifest.plist,iBSS,iBEC,DeviceTree,KernelCache,RestoreRamDisk,RestoreTrustCache, and firmware (ANE, GFX, SIOβ¦) from the IPSW - Decrypts
iBSS(iOS β€ 17.3.1) oriBEC(iOS β₯ 17.4) with the appropriate key - Patches:
- iBSS β via
iBootPatch(SSHRD-style) for iOS 15.0β17.3.1 - iBEC β via
iboot_patchfinder.py/iBoot64Patcherfor iOS 17.4+
- iBSS β via
- Patches the kernel (
Kernel64Patcherfor β€17,apply_kernel_patches.pyfor 18+) - Expands the ramdisk, injects
ssh.tar.gz, adds trustcache - Packages
.img4files with IM4M signature intobootchain/
iOS-ramdisk-builder-A12-A13/
βββ bin/ # binary patchers (iBootPatch, iBoot64Patcher, img4, img4toolβ¦)
βββ keys/ # SSHRD keys: keys/iPhone12,1.txt etc.
βββ patch/ # python patch scripts (iboot_patchfinder.py etc.)
βββ resources/ # resources: IM4M, ssh.tar.gz, sshtarlist.txt
βββ scripts/ # devices.sh, ramdisk_expand.sh
βββ tools/ # irecovery, pzb, img4, gtar, trustcache, jq (darwin/linux)
βββ boot.sh # loads the built bootchain onto the device
βββ build4.sh # β main build script
βββ collect_ibec_keys.py # utility to collect iBEC keys
βββ env.sh # environment variables
βββ ibec_keys_iPhone12_1.json # keys for iPhone 11
βββ ibec_keys_iPhone12_3.json # keys for iPhone 11 Pro
βββ ibec_keys_iPhone12_5.json # keys for iPhone 11 Pro Max
βββ ramdisk_expand.sh # APFS ramdisk expansion
βββ requirements.txt # python dependencies
βββ setup.sh # dependency installer
βββ status.sh # environment check
- macOS (Intel or Apple Silicon) β required for
hdiutil,diskutil - Python 3.9+
- pip and packages from
requirements.txt - Utilities:
curl,xxd,ipsw,jq(usually preinstalled exceptipsw) - Pwned DFU mode on the device (requires
Pi Pico usbliter8) sudofor ramdisk operations
git clone https://github.com/Rust505/iOS-ramdisk-builder-A12-A13.git
cd iOS-ramdisk-builder-A12-A13
chmod +x *.sh
./setup.sh # installs pip packages and checks binaries
./status.sh # shows if everything is in placeIf setup.sh doesn't install ipsw β install it manually:
brew install blacktop/tap/ipsw # macOS./status.shExpected output:
- β
bin/img4,bin/iBootPatch,bin/Kernel64Patcher - β
tools/darwin/{irecovery,pzb,img4,gtar,trustcache,jq} - β
resources/IM4M_0x8030(A13) orIM4M_0x8020(A12) - β
resources/ssh.tar.gz,resources/sshtarlist.txt - β
keys/<device>.txtoribec_keys_<device>.json
./build4.sh [options]| Option | Description |
|---|---|
--product <PRODUCT> |
Device identifier: iPhone12,1, iPhone12,3, iPhone12,5, iPhone12,8 |
--version <VERSION> |
iOS version, e.g. 17.3.1, 18.4 |
--build <BUILD> |
Build number (if you don't know the version): e.g. 21D61 |
--url <IPSW_URL> |
Direct IPSW URL |
--kernel stock|patched |
Whether to patch kernel (default patched) |
--kpf-set ios18|ios27|auto |
Kernel patch set (default auto) |
--with-fw / --no-fw |
Include/exclude firmware components (default with-fw) |
--im4m <PATH> |
Path to custom IM4M blob |
--list |
List all available firmwares for the device |
--dry-run |
Only show plan, don't build |
iPhone 11, iOS 17.3.1 (iBSS path):
./build4.sh --product iPhone12,1 --version 17.3.1iPhone 11 Pro, iOS 18.4 (iBEC path):
./build4.sh --product iPhone12,3 --version 18.4List firmwares:
./build4.sh --product iPhone12,1 --listDry run:
./build4.sh --product iPhone12,1 --version 17.3.1 --dry-runbootchain/n104-17.3.1-21D61-ramdisk/
βββ chain.info # summary: product, model, cpid, version, build, kernel
βββ iBSS.patched.bin # iBSS patched by iBootPatch (if 15.0β17.3.1)
βββ iBEC.img4 # iBEC for 17.4+
βββ devicetree.img4
βββ kernelcache.img4
βββ ramdisk.img4 # SSH ramdisk
βββ trustcache.img4
βββ ANE.img4, GFX.img4, SIO.img4, AOP.img4, β¦
βββ sep-firmware.img4 # if RestoreSEP present in IPSW
iPhone 11 / SE 2 / XS / XR require a hardware exploit:
- usbliter8 (for A12/A13) β via Pi Pico
- Or connect to Pi Pico and run
usbliter8
Check state:
./tools/darwin/irecovery -q
# Should show: MODE: DFU, PWND: usbliter8./boot.shThe script will:
- Send
iBSS.patched.binvialiter8ctl(oriBEC.img4viairecovery -f) - Wait for Recovery
- Send
ramdisk.img4+trustcache.img4+ firmware + devicetree + kernel - Execute
bootx - After ~15 seconds the device boots into ramdisk
iproxy 2222 22 &
ssh root@localhost -p 2222
# password: alpine-
keys/<PRODUCT>.txtβ SSHRD keys:ibss-17.3.1: 5c2cf067e1e3c6b6...364b2 ibec-21D61: aa2e8d3a3c744fe4...6f7f -
ibec_keys_<PRODUCT>.json(in root) β JSON fromcollect_ibec_keys.py:{ "17.3.1": { "21D61": { "iBSS": { "iv": "aa2e...", "key": "8076..." }, "iBEC": { "iv": "9a72...", "key": "ec0a..." } } } } -
Built-in fallback inside
build4.shβ if no key is found in files or JSON.
python3 collect_ibec_keys.py --product iPhone12,1 --output ibec_keys_iPhone12_1.jsonOr manually add the required build to an existing JSON.
| Mode | 1st source | 2nd | 3rd |
|---|---|---|---|
| iBSS (β€17.3.1) | keys/<PROD>.txt β ibss-<VER> |
ibec_keys_<PROD>.json |
inline fallback |
| iBEC (β₯17.4) | ibec_keys_<PROD>.json β release/iBEC |
keys/<PROD>.txt β ibec-<BUILD> |
inline fallback |
| File | Required | Purpose |
|---|---|---|
img4 |
β | Decrypt iBSS/iBEC with 96-hex key |
iBootPatch |
β for β€17.3.1 | Patch iBSS (SSHRD-style) |
iBoot64Patcher |
Patch iBEC for 17.4+ | |
Kernel64Patcher |
β for β€17 | Patch kernel |
kerneldiff |
Kernel diff patch | |
img4tool |
IV:KEY decryption | |
dtpatch.py |
DeviceTree patch |
| File | When needed |
|---|---|
iboot_patchfinder.py |
iBEC for iOS 17.4+ |
finalize_iboot.py |
Finalize boot-args |
apply_kernel_patches.py |
Kernel iOS 18+ |
sptm_patchfinder.py / txm_patchfinder.py |
iOS 18+ |
| File | Required |
|---|---|
IM4M_0x8030 (A13) / IM4M_0x8020 (A12) |
β |
ssh.tar.gz |
β |
sshtarlist.txt |
β |
restored_external |
- The Apple Wiki (keys): https://theapplewiki.com/wiki/Firmware_Keys
- SSHRD_Script: https://github.com/verygenericname/SSHRD_Script
- surrealra1n: https://github.com/pwnerblu/surrealra1n
- usbliter8 (A12/A13 pwn)
- https://github.com/Pa7r0n/ICH_A12_plus_Ramdisk
MIT License (see LICENSE). The author is not responsible for bricked devices. You perform all actions at your own risk. SSH ramdisk is a tool for research and recovery, not for bypassing iCloud or other protections.
# 1. Install
git clone https://github.com/Rust505/iOS-ramdisk-builder-A12-A13.git
cd iOS-ramdisk-builder-A12-A13
./setup.sh
# 2. Check
./status.sh
# 3. Build (example)
./build4.sh --product iPhone12,1 --version 17.3.1
# 4. Pwned DFU β boot
./boot.sh
# 5. SSH
iproxy 2222 22 &
ssh root@localhost -p 2222 # alpineDone. If something doesn't work β check the log next to the build (bootchain/<name>/chain.info) and the magic= line for iBSS/iBEC: 0df74f6e / 6e4ff70d β valid, 9f97aa83 β garbage, wrong key.