Write Up
Write Up
This writeup will detail the inner workings of the PwnBoot jailbreak for iOS 6 by the
TK_Cracks jailbreak team.
Part 1: Intro:
What is a Jailbreak?
Per TheiPhoneWiki, a jailbreak is “the process by which full execute and
write access is obtained on all the partitions of the Apple TV, iPad,
iPad mini, iPhone or iPod touch.” Most jailbreaks install a package
manager called Cydia, which assists in installing tweaks to the device
in the form of .deb files.
Key Terms:
Objective:
Via a custom ramdisk, achieve read/write access on the root partition of an iOS
device, along with installing the AFC2 service, installing an ssh service, patching
the kernel (sandbox,codesign, etc.), and installing Cydia
Research / Vulnerabilities
For this jailbreak, we have to find a way to load a custom ramdisk onto our device, as
this is the whole purpose and method of this jailbreak. Luckily, the limera1n BootROM
exploit allows us to load patched IMG3s! With Limera1n, we can send a custom ramdisk
(after sending other necessary components), using a tool called irecovery by
westbaer.
Procedure
1. Patch iBSS and iBEC
2. Build a Ramdisk with a SSH service set to run at boot, allowing us access to
the full RootFS of our device
3. Patch kernelcache to nuke AMFI, allowing us to run said SSH service along with
any other unsigned binaries we need.
4. Enter pwned DFU mode via limera1n
5. Send components in appropriate order, boot ramdisk
6. SSH into device over USB
7. Mount RootFS partition
8. Patch fstab and install AFC2
9. (ADVANCED: For a full jailbreak, abuse launchd.conf to start p0sixspwn on
boot)
THE PROCESS
Part 2: Preparing and Booting a Custom Ramdisk
Before we start, we must download all the necessary bootchain components from Apple:
partialzip "http://appldnld.apple.com/iOS5.1.1/041-
4347.20120427.o2yov/iPhone2,1_5.1.1_9B206_Restore.ipsw"
"Firmware/dfu/iBEC.n88ap.RELEASE.dfu" "ibec.dfu"
partialzip "http://appldnld.apple.com/iOS5.1.1/041-
4347.20120427.o2yov/iPhone2,1_5.1.1_9B206_Restore.ipsw"
"Firmware/dfu/iBSS.n88ap.RELEASE.dfu" "ibss.dfu"
partialzip "http://appldnld.apple.com/iOS5.1.1/041-
4347.20120427.o2yov/iPhone2,1_5.1.1_9B206_Restore.ipsw" "kernelcache.release.n88"
"kern.n88"
partialzip "http://appldnld.apple.com/iOS5.1.1/041-
4347.20120427.o2yov/iPhone2,1_5.1.1_9B206_Restore.ipsw"
"Firmware/all_flash/all_flash.n88ap.production/DeviceTree.n88ap.img3"
"devicetree.img3"
partialzip "http://appldnld.apple.com/iOS5.1.1/041-
4347.20120427.o2yov/iPhone2,1_5.1.1_9B206_Restore.ipsw" "038-4349-020.dmg"
"ramdisk.dmg"
Now, somewhere along the line here, we are going to need to run unsigned binaries,
like the SSH service, to do the post-boot work. In order to do so, we must patch the
kernelcache and nuke AMFI:
Finally, we must build the custom ramdisk itself! The ssh.tar file includes a bundled
ssh service scheduled to run at boot, and any other necessary binaries.
irecovery -f "ibss.dfu"
timeout /t 5 /nobreak > NUL
echo Sending iBEC
irecovery -f "ibec.dfu"
timeout /t 5 /nobreak > NUL
(Wait for the device to enter recovery mode [signaled by the backlight turning on] and
then proceed:)
Your device should now be showing an Apple logo with a blank progress bar, signaling
that the SSH service is halting boot. Now you have to forward the SSH service over USB
(port 2022):
Now you are able to SSH into the device over USB. Leave the previous window open, and
open a new terminal/CMD window to do so ( [email protected] over port 2022 with password
alpine ).
Now that you've successfully SSH'd into the device, we must mount the root filesystem
to gain access to all our files. In the window where you SSH'd into the device, run
mount.sh which should report something like " mounting /mnt1 ". Now we proceed to the
post-boot work.
/dev/disk0s1s1 / hfs ro 0 1
/dev/disk0s1s2 /private/var hfs,nosuid,nodev rw 0 2
Post-patch:
/dev/disk0s1s1 / hfs rw 0 1
/dev/disk0s1s2 /private/var hfs,nosuid,nodev rw 0 2
Conclusions:
There we go! We have successfully barebones jailbroken an iPhone using a custom
ramdisk! As shown, this method is fairly simple and very friendly to beginner devs. If
you have any questions about this procedure, or want to know more about its potential
applications, feel free to send me a DM on Twitter (@iBoot32) and I'll respond as soon
as I can! Also, follow my jailbreak team @TK_Cracks for more writeups and tools like
this!
~ TK_Cracks Team