### Install Cryptex Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Placeholder for the installation process of Cryptex for SystemOS and AppOS. ```python ... ========= INSTALL CRYPTEX(SystemOS, AppOS) ========= ``` -------------------------------- ### Install iosbinpack64 Package Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Transfers the iosbinpack64.tar archive to the device, unpacks it to the root filesystem, and cleans up the archive file. ```python os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 jb/iosbinpack64.tar 'root@127.0.0.1:/mnt1'") remote_cmd("/usr/bin/tar --preserve-permissions --no-overwrite-dir -xvf /mnt1/iosbinpack64.tar -C /mnt1") remote_cmd("/bin/rm /mnt1/iosbinpack64.tar") ``` -------------------------------- ### Prepare and Copy Cryptex Files Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Prepares the mount point by removing and recreating cryptex directories, then copies the decrypted cryptex files to the device. ```python remote_cmd("/sbin/mount_apfs -o rw /dev/disk1s1 /mnt1") remote_cmd("/bin/rm -rf /mnt1/System/Cryptexes/App") remote_cmd("/bin/rm -rf /mnt1/System/Cryptexes/OS") remote_cmd("/bin/mkdir -p /mnt1/System/Cryptexes/App") remote_cmd("/bin/chmod 0755 /mnt1/System/Cryptexes/App") remote_cmd("/bin/mkdir -p /mnt1/System/Cryptexes/OS") remote_cmd("/bin/chmod 0755 /mnt1/System/Cryptexes/OS") print("Copying cryptexs to vphone! Will take about 3 mintues...") os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 CryptexSystemOS/. 'root@127.0.0.1:/mnt1/System/Cryptexes/OS'") os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 CryptexAppOS/. 'root@127.0.0.1:/mnt1/System/Cryptexes/App'") ``` -------------------------------- ### Deploy Launch Daemons for Automatic Boot Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Copies plist files for bash, dropbear, and trollvnc to the system's LaunchDaemons directory to ensure they run on boot. Requires appropriate permissions. ```python # Send plist to /System/Library/LaunchDaemons os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 jb/LaunchDaemons/bash.plist 'root@127.0.0.1:/mnt1/System/Library/LaunchDaemons'") os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 jb/LaunchDaemons/dropbear.plist 'root@127.0.0.1:/mnt1/System/Library/LaunchDaemons'") os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 jb/LaunchDaemons/trollvnc.plist 'root@127.0.0.1:/mnt1/System/Library/LaunchDaemons'") remote_cmd("/bin/chmod 0644 /mnt1/System/Library/LaunchDaemons/bash.plist") remote_cmd("/bin/chmod 0644 /mnt1/System/Library/LaunchDaemons/dropbear.plist") remote_cmd("/bin/chmod 0644 /mnt1/System/Library/LaunchDaemons/trollvnc.plist") ``` -------------------------------- ### Craft Virtual Machine Configuration Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This function crafts a VZVirtualMachineConfiguration for a virtual iPhone. It sets up the bootloader, SEP coprocessor, platform configuration including hardware model and machine identifier, and optionally configures keyboards, touch screens, and other devices. Ensure all necessary URLs for disk, NVRAM, ROM, and SEPROM are provided. ```swift static func craftConfiguration( diskURL: URL, nvramURL: URL, romURL: URL, sepromURL: URL? = nil, vmConfig: VMConfig, network: Network = NetworkShared(), additionalStorageDevices: [VZStorageDeviceConfiguration], directorySharingDevices: [VZDirectorySharingDeviceConfiguration], serialPorts: [VZSerialPortConfiguration], suspendable: Bool = false, nested: Bool = false, audio: Bool = true, clipboard: Bool = true, sync: VZDiskImageSynchronizationMode = .full, caching: VZDiskImageCachingMode? = nil ) throws -> VZVirtualMachineConfiguration { let configuration: VZVirtualMachineConfiguration = .init() // Boot loader let bootloader = try vmConfig.platform.bootLoader(nvramURL: nvramURL) Dynamic(bootloader)._setROMURL(romURL) configuration.bootLoader = bootloader // SEP ROM let homeURL = FileManager.default.homeDirectoryForCurrentUser var sepstoragePath = homeURL.appendingPathComponent(".tart/vms/vphone/SEPStorage").path let sepstorageURL = URL(fileURLWithPath: sepstoragePath) let sep_config = Dynamic._VZSEPCoprocessorConfiguration(storageURL: sepstorageURL) if let sepromURL { // default AVPSEPBooter.vresearch1.bin from VZ framework sep_config.romBinaryURL = sepromURL } sep_config.debugStub = Dynamic._VZGDBDebugStubConfiguration(port: 8001) configuration._setCoprocessors([sep_config.asObject]) // Some vresearch101 config let pconf = VZMacPlatformConfiguration() pconf.hardwareModel = try vzHardwareModel_VRESEARCH101() let serial = Dynamic._VZMacSerialNumber.initWithString("AAAAAA1337") let identifier = Dynamic.VZMacMachineIdentifier._machineIdentifierWithECID(0x1111111111111111, serialNumber: serial.asObject) pconf.machineIdentifier = identifier.asObject as! VZMacMachineIdentifier pconf._setProductionModeEnabled(true) var auxiliaryStoragePath = homeURL.appendingPathComponent(".tart/vms/vphone/nvram.bin").path let auxiliaryStorageURL = URL(fileURLWithPath: auxiliaryStoragePath) pconf.auxiliaryiliaryStorage = VZMacAuxiliaryStorage(url: auxiliaryStorageURL) if #available(macOS 14, *) { let keyboard = VZUSBKeyboardConfiguration() configuration.keyboards = [keyboard] } if #available(macOS 14, *) { let touch = _VZUSBTouchScreenConfiguration() configuration._setMultiTouchDevices([touch]) } ... configuration.platform = pconf ``` -------------------------------- ### Converting IM4P to RAW and back using pyimg4 and img4tool Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This Python script demonstrates the process of converting firmware components between IM4P and RAW formats using external tools. It first converts an IM4P file to RAW using 'img4' and then converts it back to IM4P using 'img4tool'. ```python # Patch iBSS if not os.path.exists("iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak"): os.system("cp iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak") os.system("tools/img4 -i iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak -o iBSS.vresearch101.RELEASE") ... # patch things from raw os.system("tools/img4tool -c iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p -t ibss iBSS.vresearch101.RELEASE") # Patch iBEC if not os.path.exists("iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p.bak"): os.system("cp iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p.bak") os.system("tools/img4 -i iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p.bak -o iBEC.vresearch101.RELEASE") ... # patch things from raw os.system("tools/img4tool -c iPhone17,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p -t ibec iBEC.vresearch101.RELEASE") ``` -------------------------------- ### Create Symbolic Links for System Libraries Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Creates symbolic links for dyld libraries to point to the cryptex OS directory, essential for system library access. ```python remote_cmd("/bin/ln -sf ../../../System/Cryptexes/OS/System/Library/Caches/com.apple.dyld /mnt1/System/Library/Caches/com.apple.dyld") remote_cmd("/bin/ln -sf ../../../../System/Cryptexes/OS/System/DriverKit/System/Library/dyld /mnt1/System/DriverKit/System/Library/dyld") ``` -------------------------------- ### Create and Sign Trustcache Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Extracts a trustcache, builds a new one, and signs it into an IM4P format. ```bash os.system("pyimg4 im4p extract -i iPhone17,3_26.1_23B85_Restore/Firmware/043-53775-129.dmg.trustcache -o trustcache.raw") os.system("tools/trustcache_macos_arm64 create sshrd.tc SSHRD") os.system("pyimg4 im4p create -i sshrd.tc -o trustcache.im4p -f rtsc") # sign os.system("pyimg4 img4 create -p trustcache.im4p -o Ramdisk/trustcache.img4 -m vphone.im4m") ``` -------------------------------- ### Extracting Firmware Components with Python Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This script snippet demonstrates copying various firmware components from an extracted source to a target restore directory. It includes kernelcache, and firmware files for different hardware components like agx, ane, and dfu. ```python os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/kernelcache.* iPhone17,3_26.1_23B85_Restore") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/agx/* iPhone17,3_26.1_23B85_Restore/Firmware/agx") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/all_flash/* iPhone17,3_26.1_23B85_Restore/Firmware/all_flash") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/ane/* iPhone17,3_26.1_23B85_Restore/Firmware/ane") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/dfu/* iPhone17,3_26.1_23B85_Restore/Firmware/dfu") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/pmp/* iPhone17,3_26.1_23B85_Restore/Firmware/pmp") os.system("cp 399b664dd623358c3de118ffc114e42dcd51c9309e751d43bc949b98f4e31349_extracted/Firmware/*.im4p iPhone17,3_26.1_23B85_Restore/Firmware") os.system("sudo cp custom_26.1/BuildManifest.plist iPhone17,3_26.1_23B85_Restore") os.system("sudo cp custom_26.1/Restore.plist iPhone17,3_26.1_23B85_Restore") os.system("echo 'Done, grabbed all needed components for restoring'") ``` -------------------------------- ### MetalTest Execution - Metal Supported Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This bash output demonstrates the successful execution of the MetalTest program when Metal is supported. It shows the device name and a success message. ```bash seo@seos-Virtual-Machine Desktop % sysctl kern.version kern.version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:21 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_VMAPPLE seo@seos-Virtual-Machine Desktop % ./MetalTest 2026-02-08 23:16:56.846 MetalTest[682:5810] device: name = Apple Paravirtual device 2026-02-08 23:16:56.847 MetalTest[682:5810] Metal Device Create Success: Apple Paravirtual device seo@seos-Virtual-Machine Desktop % ``` -------------------------------- ### Patch launchd.plist to Inject Services Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Backs up, retrieves, converts, and injects service configurations (bash, dropbear, trollvnc) into the system's launchd.plist. Uses plistlib for manipulation. ```python # Edit /System/Library/xpc/launchd.plist # remove if already exist os.system("rm custom_26.1/launchd.plist 2>/dev/null") os.system("rm custom_26.1/launchd.plist.bak 2>/dev/null") # backup launchd.plist before patch file_path = "/mnt1/System/Library/xpc/launchd.plist.bak" if not check_remote_file_exists(file_path): print(f"Created backup {file_path}") remote_cmd("/bin/cp /mnt1/System/Library/xpc/launchd.plist /mnt1/System/Library/xpc/launchd.plist.bak") # grab launchd.plist os.system("tools/sshpass -p 'alpine' scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 root@127.0.0.1:/mnt1/System/Library/xpc/launchd.plist.bak ./custom_26.1") os.system("mv custom_26.1/launchd.plist.bak custom_26.1/launchd.plist") # Inject bash, dropbear, trollvnc to launchd.plist os.system("plutil -convert xml1 custom_26.1/launchd.plist") # 1. bash target_file = 'custom_26.1/launchd.plist' source_file = 'jb/LaunchDaemons/bash.plist' insert_key = '/System/Library/LaunchDaemons/bash.plist' with open(target_file, 'rb') as ft, open(source_file, 'rb') as fs: target_data = plistlib.load(ft) source_data = plistlib.load(fs) target_data.setdefault('LaunchDaemons', {})[insert_key] = source_data with open(target_file, 'wb') as f: plistlib.dump(target_data, f, sort_keys=False) # 2. dropbear source_file = 'jb/LaunchDaemons/dropbear.plist' insert_key = '/System/Library/LaunchDaemons/dropbear.plist' with open(target_file, 'rb') as ft, open(source_file, 'rb') as fs: target_data = plistlib.load(ft) source_data = plistlib.load(fs) target_data.setdefault('LaunchDaemons', {})[insert_key] = source_data with open(target_file, 'wb') as f: plistlib.dump(target_data, f, sort_keys=False) # 3. trollvnc source_file = 'jb/LaunchDaemons/trollvnc.plist' insert_key = '/System/Library/LaunchDaemons/trollvnc.plist' with open(target_file, 'rb') as ft, open(source_file, 'rb') as fs: target_data = plistlib.load(ft) source_data = plistlib.load(fs) target_data.setdefault('LaunchDaemons', {})[insert_key] = source_data with open(target_file, 'wb') as f: plistlib.dump(target_data, f, sort_keys=False) # send to apply os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 custom_26.1/launchd.plist 'root@127.0.0.1:/mnt1/System/Library/xpc'") remote_cmd("/bin/chmod 0644 /mnt1/System/Library/xpc/launchd.plist") # clean os.system("rm custom_26.1/launchd.plist 2>/dev/null") ``` -------------------------------- ### Fetch SHSH and Convert to IM4M Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Use idevicerestore to fetch SHSH blobs, then gunzip and convert them to an IM4M file using pyimg4. This is a prerequisite for creating IMG4 images. ```bash idevicerestore -e -y ./iPhone17,3_26.1_23B85_Restore -t mv shsh/[ECID]-iPhone99,11-26.1.shsh shsh/[ECID]-iPhone99,11-26.1.shsh.gz gunzip shsh/[ECID]-iPhone99,11-26.1.shsh.gz ... pyimg4 im4m extract -i shsh/[ECID]-iPhone99,11-26.1.shsh -o vphone.im4m ``` -------------------------------- ### Patch and Sign Seputil Binary Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Backs up, patches, signs, and deploys the seputil binary to prevent Gigalocker file errors. Requires custom_26.1 directory and signing certificates. ```python os.system("rm custom_26.1/seputil 2>/dev/null") os.system("rm custom_26.1/seputil.bak 2>/dev/null") file_path = "/mnt1/usr/libexec/seputil.bak" if not check_remote_file_exists(file_path): print(f"Created backup {file_path}") remote_cmd("/bin/cp /mnt1/usr/libexec/seputil /mnt1/usr/libexec/seputil.bak") os.system("tools/sshpass -p 'alpine' scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 root@127.0.0.1:/mnt1/usr/libexec/seputil.bak ./custom_26.1") os.system("mv custom_26.1/seputil.bak custom_26.1/seputil") fp = open("custom_26.1/seputil", "r+b") patch(0x1B3F1, "AA") fp.close() os.system("tools/ldid_macosx_arm64 -S -M -Ksigncert.p12 -Icom.apple.seputil custom_26.1/seputil") os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 custom_26.1/seputil 'root@127.0.0.1:/mnt1/usr/libexec/seputil'") remote_cmd("/bin/chmod 0755 /mnt1/usr/libexec/seputil") os.system("rm custom_26.1/seputil 2>/dev/null") ``` -------------------------------- ### Boot Custom Ramdisk with iRecovery Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This shell script uses iRecovery to load various IMG4 images, including the custom kernel and ramdisk, to boot the device. ```bash #!/bin/zsh irecovery -f Ramdisk/iBSS.vresearch101.RELEASE.img4 irecovery -f Ramdisk/iBEC.vresearch101.RELEASE.img4 irecovery -c go sleep 1; irecovery -f Ramdisk/sptm.vresearch1.release.img4 irecovery -c firmware irecovery -f Ramdisk/txm.img4 irecovery -c firmware irecovery -f Ramdisk/trustcache.img4 irecovery -c firmware irecovery -f Ramdisk/ramdisk.img4 irecovery -c ramdisk irecovery -f Ramdisk/DeviceTree.vphone600ap.img4 irecovery -c devicetree irecovery -f Ramdisk/sep-firmware.vresearch101.RELEASE.img4 irecovery -c firmware irecovery -f Ramdisk/krnl.img4 irecovery -c bootx ``` -------------------------------- ### Finalize and Sign Ramdisk Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Resizes the ramdisk DMG and then creates and signs it into an IM4P format. ```bash os.system("sudo hdiutil detach -force SSHRD") os.system("sudo hdiutil resize -sectors min ramdisk1.dmg") # sign os.system("pyimg4 im4p create -i ramdisk1.dmg -o ramdisk1.dmg.im4p -f rdsk") os.system("pyimg4 img4 create -p ramdisk1.dmg.im4p -o Ramdisk/ramdisk.img4 -m vphone.im4m") ``` -------------------------------- ### Extract and Create Ramdisk Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Extracts a ramdisk DMG, creates a custom one, and attaches it for further modifications. ```bash os.system("pyimg4 im4p extract -i iPhone17,3_26.1_23B85_Restore/043-53775-129.dmg -o ramdisk.dmg") os.system("mkdir SSHRD") os.system("sudo hdiutil attach -mountpoint SSHRD ramdisk.dmg -owners off") os.system("sudo hdiutil create -size 254m -imagekey diskimage-class=CRawDiskImage -format UDZO -fs APFS -layout NONE -srcfolder SSHRD -copyuid root ramdisk1.dmg") os.system("sudo hdiutil detach -force SSHRD") os.system("sudo hdiutil attach -mountpoint SSHRD ramdisk1.dmg -owners off") ``` -------------------------------- ### Grab & Patch Kernelcache Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This section details the process of patching the kernelcache. It involves creating a backup, extracting raw data, creating a new im4p file, and preserving the PAYP structure. ```bash if not os.path.exists("iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak"): os.system("cp iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600 iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak") os.system("pyimg4 im4p extract -i iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak -o kcache.raw") os.system("pyimg4 im4p create -i kcache.raw -o krnl.im4p -f krnl --lzfse") kernel_im4p_data = Path('iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak').read_bytes() payp_offset = kernel_im4p_data.rfind(b'PAYP') if payp_offset == -1: print("Couldn't find payp structure !!!") sys.exit() with open('krnl.im4p', 'ab') as f: f.write(kernel_im4p_data[(payp_offset-10):]) payp_sz = len(kernel_im4p_data[(payp_offset-10):]) print(f"payp sz: {payp_sz}") kernel_im4p_data = bytearray(open('krnl.im4p', 'rb').read()) kernel_im4p_data[2:5] = (int.from_bytes(kernel_im4p_data[2:5], 'big') + payp_sz).to_bytes(3, 'big') open('krnl.im4p', 'wb').write(kernel_im4p_data) os.system("mv krnl.im4p iPhone17,3_26.1_23B85_Restore/kernelcache.research.vphone600") ``` -------------------------------- ### Patch launchd_cache_loader Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Copies, patches, signs, and deploys the launchd_cache_loader executable. Requires custom tools like sshpass, ldid, and a patch function. ```python os.system("tools/sshpass -p 'alpine' scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 root@127.0.0.1:/mnt1/usr/libexec/launchd_cache_loader.bak ./custom_26.1") os.system("mv custom_26.1/launchd_cache_loader.bak custom_26.1/launchd_cache_loader") # patch to apply launchd_unsecure_cache=1 fp = open("custom_26.1/launchd_cache_loader", "r+b") patch(0xB58, 0xd503201f) fp.close() # sign os.system("tools/ldid_macosx_arm64 -S -M -Ksigncert.p12 -Icom.apple.launchd_cache_loader custom_26.1/launchd_cache_loader") # send to apply os.system("tools/sshpass -p 'alpine' scp -q -r -ostricthostkeychecking=false -ouserknownhostsfile=/dev/null -o StrictHostKeyChecking=no -P 2222 custom_26.1/launchd_cache_loader 'root@127.0.0.1:/mnt1/usr/libexec/launchd_cache_loader'") remote_cmd("/bin/chmod 0755 /mnt1/usr/libexec/launchd_cache_loader") # clean os.system("rm custom_26.1/launchd_cache_loader 2>/dev/null") ``` -------------------------------- ### Sign Kernel Image Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Signs the prepared kernel image using pyimg4 tool. ```bash os.system("pyimg4 img4 create -p krnl.im4p -o Ramdisk/krnl.img4 -m vphone.im4m") ``` -------------------------------- ### Configure VZMacHardwareModel for vresearch101 Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This function configures the VZMacHardwareModel for the vresearch101 platform. It sets specific values for PlatformVersion, BoardID, and ISA to match iPhone hardware requirements. Ensure that the VM hardware configuration is supported before returning. ```swift static private func vzHardwareModel_VRESEARCH101() throws -> VZMacHardwareModel { var hw_model: VZMacHardwareModel guard let hw_descriptor = _VZMacHardwareModelDescriptor() else { fatalError("Failed to create hardware descriptor") } hw_descriptor.setPlatformVersion(3) // .appleInternal4 = 3 hw_descriptor.setBoardID(0x90) hw_descriptor.setISA(2) hw_model = VZMacHardwareModel._hardwareModel(withDescriptor: hw_descriptor) guard hw_model.isSupported else { fatalError("VM hardware config not supported (model.isSupported = false)") } return hw_model } ``` -------------------------------- ### Grab & Patch TXM Firmware Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This section extracts, patches, and recreates the TXM firmware. It involves creating a backup, extracting raw data, creating a new im4p file, and preserving the PAYP structure. ```bash if not os.path.exists("iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p.bak"): os.system("cp iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p.bak") os.system("pyimg4 im4p extract -i iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p.bak -o txm.raw") os.system("pyimg4 im4p create -i txm.raw -o txm.im4p -f trxm --lzfse") txm_im4p_data = Path('iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p.bak').read_bytes() payp_offset = txm_im4p_data.rfind(b'PAYP') if payp_offset == -1: print("Couldn't find payp structure !!!") sys.exit() with open('txm.im4p', 'ab') as f: f.write(txm_im4p_data[(payp_offset-10):]) payp_sz = len(txm_im4p_data[(payp_offset-10):]) print(f"payp sz: {payp_sz}") txm_im4p_data = bytearray(open('txm.im4p', 'rb').read()) txm_im4p_data[2:5] = (int.from_bytes(txm_im4p_data[2:5], 'big') + payp_sz).to_bytes(3, 'big') open('txm.im4p', 'wb').write(txm_im4p_data) os.system("mv txm.im4p iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.research.im4p") ``` -------------------------------- ### MetalTest Execution - Metal Not Supported Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This bash output shows the result of running the MetalTest program when Metal is not supported on the system. It indicates that the Metal device is null. ```bash -bash-4.4# ./MetalTest 2026-02-08 22:49:02.293 MetalTest[633:9434] device: (null) 2026-02-08 22:49:02.294 MetalTest[633:9434] Metal Not Supported! -bash-4.4# sysctl kern.version kern.version: Darwin Kernel Version 25.1.0: Thu Oct 23 11:11:48 PDT 2025; root:xnu-12377.42.6~55/RELEASE_ARM64_VRESEARCH1 ``` -------------------------------- ### Generate IMG4 for Kernelcache Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This Python script prepares and creates an IMG4 file for the kernelcache. It includes backing up the original file, extracting raw data, patching it, and then creating the final IMG4 image. ```python # 7. Grab & patch kernelcache if not os.path.exists("iPhone17\\,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak"): os.system("cp iPhone17\\,3_26.1_23B85_Restore/kernelcache.research.vphone600 iPhone17\\,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak") os.system("pyimg4 im4p extract -i iPhone17\\,3_26.1_23B85_Restore/kernelcache.research.vphone600.bak -o kcache.raw") ... # patch things from raw #create im4p os.system("pyimg4 im4p create -i kcache.raw -o krnl.im4p -f rkrn --lzfse") ``` -------------------------------- ### Patch LLB Firmware Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This snippet patches the LLB firmware by creating a backup, processing it with img4, and then using img4tool to create a patched version. ```bash if not os.path.exists("iPhone17,3_26.1_23B85_Restore/Firmware/all_flash/LLB.vresearch101.RESEARCH_RELEASE.im4p.bak"): os.system("cp iPhone17,3_26.1_23B85_Restore/Firmware/all_flash/LLB.vresearch101.RESEARCH_RELEASE.im4p iPhone17,3_26.1_23B85_Restore/Firmware/all_flash/LLB.vresearch101.RESEARCH_RELEASE.im4p.bak") os.system("tools/img4 -i iPhone17,3_26.1_23B85_Restore/Firmware/all_flash/LLB.vresearch101.RESEARCH_RELEASE.im4p.bak -o LLB.vresearch101.RESEARCH_RELEASE") os.system("tools/img4tool -c iPhone17,3_26.1_23B85_Restore/Firmware/all_flash/LLB.vresearch101.RESEARCH_RELEASE.im4p -t illb LLB.vresearch101.RESEARCH_RELEASE") ``` -------------------------------- ### Generate IMG4 for iBEC Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This Python script prepares and creates an IMG4 file for the iBEC component. It involves backing up the original file, patching it, and then generating the final IMG4 image using the IM4M file. ```python # 2. Grab & Patch iBEC if not os.path.exists("iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p.bak"): os.system("cp iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p.bak") os.system("tools/img4 -i iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBEC.vresearch101.RELEASE.im4p -o iBEC.vresearch101.RELEASE") ... # patch things from raw os.system("tools/img4tool -c iBEC.vresearch101.RELEASE.im4p -t ibec iBEC.vresearch101.RELEASE") os.system("tools/img4 -i iBEC.vresearch101.RELEASE.im4p -o Ramdisk/iBEC.vresearch101.RELEASE.img4 -M vphone.im4m") ``` -------------------------------- ### Patch launchd_cache_loader Binary Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Backs up, patches, and deploys the launchd_cache_loader binary. This is required if modifying the /System/Library/xpc/launchd.plist file. ```python os.system("rm custom_26.1/launchd_cache_loader 2>/dev/null") os.system("rm custom_26.1/launchd_cache_loader.bak 2>/dev/null") file_path = "/mnt1/usr/libexec/launchd_cache_loader.bak" if not check_remote_file_exists(file_path): print(f"Created backup {file_path}") remote_cmd("/bin/cp /mnt1/usr/libexec/launchd_cache_loader /mnt1/usr/libexec/launchd_cache_loader.bak") ``` -------------------------------- ### Check Metal Support with MetalTest Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This C code snippet checks for the availability of a Metal device on the system. It prints whether a device is found or if Metal is not supported. ```c #import #import #import int main(int argc, char *argv[], char *envp[]) { id device = MTLCreateSystemDefaultDevice(); NSLog(@"device: %@", device); if (device) { NSLog(@"Metal Device Create Success: %@", [device name]); } else { NSLog(@"Metal Not Supported!"); } return 0; } ``` -------------------------------- ### Generate IMG4 for DeviceTree Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Generates an IMG4 file for the DeviceTree component, essential for the ramdisk, using the IM4M file. ```python # 4. Grab devicetree os.system("tools/img4 -i iPhone17\,3_26.1_23B85_Restore/Firmware/all_flash/DeviceTree.vphone600ap.im4p -o Ramdisk/DeviceTree.vphone600ap.img4 -M vphone.im4m -T rdtr") ``` -------------------------------- ### Mount and Modify Root File System Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Connects to the virtual iPhone, mounts the root file system in read-write mode, lists snapshots, renames a snapshot, and unmounts the file system. ```python ssh root@127.0.0.1 -p2222 #pw: alpine mount_apfs -o rw /dev/disk1s1 /mnt1 snaputil -l /mnt1 # (then will output will be printed with hash, result may be differ) com.apple.os.update-8AAB8DBA5C8F1F756928411675F4A892087B04559CFB084B9E400E661ABAD119 snaputil -n orig-fs /mnt1 umount /mnt1 exit ``` -------------------------------- ### Generate IMG4 for TXM Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This script handles the extraction, patching, and creation of an IMG4 file for the TXM component. It involves complex byte manipulation to preserve specific structures before signing. ```python # 6. Grab & Patch TXM if not os.path.exists("iPhone17\\,3_26.1_23B85_Restore/Firmware/txm.iphoneos.release.im4p.bak"): os.system("cp iPhone17\\,3_26.1_23B85_Restore/Firmware/txm.iphoneos.release.im4p iPhone17\\,3_26.1_23B85_Restore/Firmware/txm.iphoneos.release.im4p.bak") os.system("pyimg4 im4p extract -i iPhone17\\,3_26.1_23B85_Restore/Firmware/txm.iphoneos.release.im4p.bak -o txm.raw") ... # patch things from raw #create im4p os.system("pyimg4 im4p create -i txm.raw -o txm.im4p -f trxm --lzfse") # preserve payp structure txm_im4p_data = Path('iPhone17,3_26.1_23B85_Restore/Firmware/txm.iphoneos.release.im4p.bak').read_bytes() payp_offset = txm_im4p_data.rfind(b'PAYP') if payp_offset == -1: print("Couldn't find payp structure !!!") sys.exit() with open('txm.im4p', 'ab') as f: f.write(txm_im4p_data[(payp_offset-10):]) payp_sz = len(txm_im4p_data[(payp_offset-10):]) print(f"payp sz: {payp_sz}") txm_im4p_data = bytearray(open('txm.im4p', 'rb').read()) txm_im4p_data[2:5] = (int.from_bytes(txm_im4p_data[2:5], 'big') + payp_sz).to_bytes(3, 'big') open('txm.im4p', 'wb').write(txm_im4p_data) # sign os.system("pyimg4 img4 create -p txm.im4p -o Ramdisk/txm.img4 -m vphone.im4m") ``` -------------------------------- ### Decrypt and Mount Cryptexes Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Decrypts the SystemOS cryptex using a key obtained from ipsw, then copies and mounts both SystemOS and AppOS cryptexes. ```python key = subprocess.check_output("ipsw fw aea --key iPhone17,3_26.1_23B85_Restore/043-54303-126.dmg.aea", shell=True, text=True).strip() print(f"key: {key}") os.system(f"aea decrypt -i iPhone17,3_26.1_23B85_Restore/043-54303-126.dmg.aea -o CryptexSystemOS.dmg -key-value '{key}'") os.system(f"cp iPhone17,3_26.1_23B85_Restore/043-54062-129.dmg CryptexAppOS.dmg") os.system("mkdir CryptexSystemOS") os.system("sudo hdiutil attach -mountpoint CryptexSystemOS CryptexSystemOS.dmg -owners off") os.system("mkdir CryptexAppOS") os.system("sudo hdiutil attach -mountpoint CryptexAppOS CryptexAppOS.dmg -owners off") ``` -------------------------------- ### Generate IMG4 for SEP Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Creates an IMG4 file for the SEP firmware component, utilizing the IM4M file for signing and packaging. ```python # 5. Grab sep os.system("tools/img4 -i iPhone17\,3_26.1_23B85_Restore/Firmware/all_flash/sep-firmware.vresearch101.RELEASE.im4p -o Ramdisk/sep-firmware.vresearch101.RELEASE.img4 -M vphone.im4m -T rsep") ``` -------------------------------- ### Halt System Command Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Executes the system halt command. ```python remote_cmd("/sbin/halt") ``` -------------------------------- ### Generate IMG4 for iBSS Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This Python script prepares and creates an IMG4 file for the iBSS component. It includes backing up the original file, patching it, and then creating the final IMG4 image using the generated IM4M file. ```python # 1. Grab & Patch iBSS if not os.path.exists("iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak"): os.system("cp iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak") os.system("tools/img4 -i iPhone17\\,3_26.1_23B85_Restore/Firmware/dfu/iBSS.vresearch101.RELEASE.im4p.bak -o iBSS.vresearch101.RELEASE") ... # patch things from raw os.system("tools/img4tool -c iBSS.vresearch101.RELEASE.im4p -t ibss iBSS.vresearch101.RELEASE") os.system("tools/img4 -i iBSS.vresearch101.RELEASE.im4p -o ./Ramdisk/iBSS.vresearch101.RELEASE.img4 -M ./vphone.im4m") ``` -------------------------------- ### Generate IMG4 for SPTM Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Creates an IMG4 file for the SPTM component using the provided IM4M file. This step is part of preparing the ramdisk components. ```python # 3. Grab SPTM os.system("tools/img4 -i iPhone17\,3_26.1_23B85_Restore/Firmware/sptm.vresearch1.release.im4p -o Ramdisk/sptm.vresearch1.release.img4 -M vphone.im4m -T sptm") ``` -------------------------------- ### Configure Virtual iPhone Graphics Device Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md This snippet configures the graphics device for a virtual iPhone, specifying display resolution and pixel density. Ensure VZMacGraphicsDeviceConfiguration and VZMacGraphicsDisplayConfiguration are imported. ```swift let graphics_config = VZMacGraphicsDeviceConfiguration() let displays_config = VZMacGraphicsDisplayConfiguration( widthInPixels: 1179, heightInPixels: 2556, pixelsPerInch: 460 ) graphics_config.displays.append(displays_config) configuration.graphicsDevices = [graphics_config] ``` -------------------------------- ### Access Virtual iPhone Shell Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Connects to the virtual iPhone shell via SSH using iproxy to forward the port. ```bash iproxy 2222 22 & ``` -------------------------------- ### Resign Mach-O Binaries in Ramdisk Source: https://github.com/wh1te4ever/super-tart-vphone-writeup/blob/main/README.md Iterates through specified paths within the mounted ramdisk, identifies Mach-O files, and resigns them using ldid. ```python target_path= [ "SSHRD/usr/local/bin/*", "SSHRD/usr/local/lib/*", "SSHRD/usr/bin/*", "SSHRD/bin/*", "SSHRD/usr/lib/*", "SSHRD/sbin/*", "SSHRD/usr/sbin/*", "SSHRD/usr/libexec/*" ] for pattern in target_path: for path in glob.glob(pattern): if os.path.isfile(path) and not os.path.islink(path): if "Mach-O" in subprocess.getoutput(f"file \"{path}\""): os.system(f"tools/ldid_macosx_arm64 -S -M -Cadhoc \"{path}\"") ```