Difference between revisions of "Firmware Keys"

From The iPhone Wiki
Jump to: navigation, search
m
(Firmware Versions: 16.x placeholder)
 
(526 intermediate revisions by 21 users not shown)
Line 1: Line 1:
  +
__NOTOC__
'''VFDecrypt Keys''' are the keys which can decrypt the files that come with the [[firmware]]. Apple uses a public-private key encryption to ensure the safety of their files. Over time Apple has changed the way to encrypt firmware files, thus the way to decrypt files as well as the way to get the VFDecrypt Keys has also.
 
  +
'''Firmware Keys''' are keys which decrypt bootloaders, ramdisks, and [[:/|root filesystem]] of iOS [[firmware]], if those components are encrypted. Apple uses encryption to make it harder to analyze and modify them. Over time Apple changed the way they encrypt firmware files, hence the way to decrypt them and get decryption keys changed as well.
   
  +
== History ==
[[S5L File Formats#IMG2|IMG2]] was the file format used prior to iOS 2.0. For iOS 1.1.x, IMG2 files were encrypted with Key 0x837.
 
  +
With the release of the iPhone came the [[S5L File Formats#IMG2|IMG2]] file format. They were used on all known [[iOS|iPhone OS]] [[#1.x|1.x]] firmwares. For the 1.1.x series, they were encrypted with the [[AES Keys#Key 0x837|0x837 key]]. The discovery of the 0x837 key led to the ability to decrypt ''any'' 1.x firmware.
   
  +
Following IMG2 came the [[IMG3 File Format|IMG3]] file format. They were introduced with iPhone OS [[#1.x.2F2.x|2.0 beta 4]], and have been in use ever since. In order to maintain their integrity, they use multiple layers of encryption. Apple took encryption seriously with IMG3 by utilizing [[wikipedia:Advanced Encryption Standard|AES]] (based on the [[wikipedia:Rijndael key schedule|Rinjndael key schedule]]). In terms of the pre-iPhone OS 3 [[VFDecrypt]] key, it is stored as plain-text in the "__restore" segment of the ASR image within the [[ramdisk]]s.
[[IMG3 File Format|IMG3]] encrypted files contain encrypted versions of the VFDecrypt Keys as part of the [[KBAG]] (key bag). These can be decrypted with the [[GID-key]]. For jailbroken iDevices the VFDecrypt keys can be retrieved with the devices [[AES Keys|hardware AES engine]]. The VFDecrypt key for the root filesystem image of an iDevice (~500 MB to 800MB in the case of iOS 5) requires either a decrypted [[Restore Ramdisk]] or [[Update Ramdisk]]. Once you have a decrypted Restore or Update Ramdisk, [[GenPass]] can be used to gather the keys for the root filesystem.
 
For the root filesystem there is one key per device model, with no IV. You can mount this once it has been decrypted using your program of choice. (For example, 7-zip on Windows (after extracting the DMG on Windows, extract the biggest file with [[Wikipedia:7-Zip|7-Zip]])
 
   
  +
The ramdisk keys can ''only'' be retrieved with the processor specific [[GID Key]]. The GID key is currently unretrievable and can only be utilized through the built-in [[AES Keys|AES engine]]. To complicate things ''even more'', the engine is only accessible through a special [[bootrom]] or [[iBoot]] exploit ([[jailbreak]]s typically expose it with [[/dev/aes_0]]). This makes usage of the key nearly impossible.
  +
  +
However, once you have access to the AES engine, the entire system falls apart. You are able to upload an encrypted ramdisk and grab the decryption keys for it. Once you manage to decrypt the ramdisk, you can run it through [[GenPass]] to decrypt the firmware key.
  +
  +
To find the keys, you can either use the methods on [[AES Keys]] or the easier option for OS X, [[keylimepie]].
  +
  +
== Decrypting ==
  +
{{main|Decrypting Firmwares}}
 
== Notes ==
 
== Notes ==
The Update Ramdisk and Restore Ramdisks share the same IV and key per type of Application Processor. The current models are:
+
Certain files share the same key and IV per [[Application Processor|application processor]] (per build) provided the devices have the same pixel resolution:
  +
* [[Update Ramdisk]]
  +
* [[Restore Ramdisk]]
  +
* [[AppleLogo]]
  +
* [[BatteryCharging0]]
  +
* [[BatteryCharging1]]
  +
* [[BatteryFull]]
  +
* [[BatteryLow0]]
  +
* [[BatteryLow1]]
  +
* [[GlyphCharging]]
  +
* [[GlyphPlugin]]
  +
* [[Kernelcache]]
  +
* [[NeedService]]
  +
* [[RecoveryMode]]
  +
* [[SEP Firmware]]
  +
* [[WTF]]
  +
  +
You can use [[img3decrypt]] or [[xpwntool]] to decrypt these files as described in [[Decrypting Firmwares]]. Once done, mount or extract using the tool of your choice.
   
  +
The firmware version number for the [[List of Apple TVs|Apple TV]] builds are the ones that the Apple TV reports (also known as the "marketing version").
{| class="wikitable sortable" style="font-size: smaller; text-align: center; width: auto; table-layout: fixed; border-collapse: collapse;" border="1"
 
|-
 
! width="200" | Application Processor
 
! width="200" | iDevice
 
|-
 
| [[S5L8900]]
 
| [[M68ap|iPhone]], [[N82ap|iPhone 3G]], [[N45ap|iPod touch]]
 
|-
 
| [[S5L8720]]
 
| [[M68ap|iPhone]], [[N72ap|iPod touch 2G]]
 
|-
 
| [[S5L8920]]
 
| [[N88ap|iPhone 3GS]]
 
|-
 
| [[S5L8922]]
 
| [[N18ap|iPod touch 3G]]
 
|-
 
| [[S5L8930]] (A4)
 
| [[K48ap|iPad]], [[iPhone 4]], [[N81ap|iPod touch 4G]], [[K66ap|Apple TV 2G]]
 
|-
 
| [[S5L8940]] (A5)
 
| [[iPad 2]], [[N94ap|iPhone 4S]]
 
|-
 
| [[S5L8942]] (revised A5)
 
| [[k93aap|iPad 2 Wi-Fi R2]], [[J33ap|Apple TV 3G]]
 
|-
 
| [[S5L8945]] (A5X)
 
| [[iPad 3]]
 
|}
 
   
  +
All dates are relative to [[wikipedia:Coordinated Universal Time|UTC]].
You can use [[img3decrypt]][http://code.google.com/p/img3decrypt/] or [[xpwntool]][http://github.com/planetbeing/xpwn/tree/master] to decrypt these as described in [[Ramdisk Decryption]]. Once done, mount or extract using the tool of your choice.
 
   
  +
GID AES is used by iBoot to decrypt firmware images. When iBoot loads the kernelcache, GID AES is disabled. This means in order to get firmware keys, you must gain code execution in a setting where GID AES is still enabled. In most cases, this means exploiting iBoot itself, before the kernelcache is loaded.
When posting a key page, please use the [[Template:Keys|key template]] ('''IN THE CORRECT ORDER''') and do '''NOT''' [[Wikipedia:WP:SUBST|substitute]] it.
 
   
  +
==Firmware Versions==
For the VFDecrypt Keys of each firmware please check the builds listed at the appropiate firmware version page.
 
  +
{{see also|Prototypes}}
  +
This is a full and comprehensive list of all firmwares Apple Inc. has made available to the public in some way, be it the [[Apple Developer|dev center]] or [[iTunes]]. This list also contains a few firmwares for which there never was an IPSW (as far as can be told) such as 4.2.5 for the [[N92AP|CDMA iPhone 4]] (iPhone3,3). These few builds came preinstalled on the device, but are not available for download.
   
== Firmware versions ==
+
* [[Firmware Keys/1.x|1.x]]
{{main|Firmware|Beta Firmware}}
+
* [[Firmware Keys/2.x|2.x]]
  +
* [[Firmware Keys/3.x|3.x]]
  +
* [[Firmware Keys/4.x|4.x]]
  +
* [[Firmware Keys/5.x|5.x]]
  +
* [[Firmware Keys/6.x|6.x]]
  +
* [[Firmware Keys/7.x|7.x]]
  +
* [[Firmware Keys/8.x|8.x]]
  +
* [[Firmware Keys/9.x|9.x]]
  +
* [[Firmware Keys/10.x|10.x]]
  +
* [[Firmware Keys/11.x|11.x]]
  +
* [[Firmware Keys/12.x|12.x]]
  +
* [[Firmware Keys/13.x|13.x]]
  +
* [[Firmware Keys/14.x|14.x]]
  +
* [[Firmware Keys/15.x|15.x]]
  +
* [[Firmware Keys/16.x|16.x]]
   
== Gaps ==
+
== See also ==
  +
* [[Application Processor]]
As you will notice, there may be a gap or two, or a key for a current build that is not there. Please feel free to add them, but please be sure that it is only the key for a User or Developer build, as if you gave the key for another type of build that might or may not be out there '''people could get in trouble, and we do not want that'''. Thanks for contributing!
 
   
[[Category:VFDecrypt]]
+
[[Category:Decryption]]

Latest revision as of 10:42, 6 June 2022

Firmware Keys are keys which decrypt bootloaders, ramdisks, and root filesystem of iOS firmware, if those components are encrypted. Apple uses encryption to make it harder to analyze and modify them. Over time Apple changed the way they encrypt firmware files, hence the way to decrypt them and get decryption keys changed as well.

History

With the release of the iPhone came the IMG2 file format. They were used on all known iPhone OS 1.x firmwares. For the 1.1.x series, they were encrypted with the 0x837 key. The discovery of the 0x837 key led to the ability to decrypt any 1.x firmware.

Following IMG2 came the IMG3 file format. They were introduced with iPhone OS 2.0 beta 4, and have been in use ever since. In order to maintain their integrity, they use multiple layers of encryption. Apple took encryption seriously with IMG3 by utilizing AES (based on the Rinjndael key schedule). In terms of the pre-iPhone OS 3 VFDecrypt key, it is stored as plain-text in the "__restore" segment of the ASR image within the ramdisks.

The ramdisk keys can only be retrieved with the processor specific GID Key. The GID key is currently unretrievable and can only be utilized through the built-in AES engine. To complicate things even more, the engine is only accessible through a special bootrom or iBoot exploit (jailbreaks typically expose it with /dev/aes_0). This makes usage of the key nearly impossible.

However, once you have access to the AES engine, the entire system falls apart. You are able to upload an encrypted ramdisk and grab the decryption keys for it. Once you manage to decrypt the ramdisk, you can run it through GenPass to decrypt the firmware key.

To find the keys, you can either use the methods on AES Keys or the easier option for OS X, keylimepie.

Decrypting

Main article: Decrypting Firmwares

Notes

Certain files share the same key and IV per application processor (per build) provided the devices have the same pixel resolution:

You can use img3decrypt or xpwntool to decrypt these files as described in Decrypting Firmwares. Once done, mount or extract using the tool of your choice.

The firmware version number for the Apple TV builds are the ones that the Apple TV reports (also known as the "marketing version").

All dates are relative to UTC.

GID AES is used by iBoot to decrypt firmware images. When iBoot loads the kernelcache, GID AES is disabled. This means in order to get firmware keys, you must gain code execution in a setting where GID AES is still enabled. In most cases, this means exploiting iBoot itself, before the kernelcache is loaded.

Firmware Versions

See also: Prototypes

This is a full and comprehensive list of all firmwares Apple Inc. has made available to the public in some way, be it the dev center or iTunes. This list also contains a few firmwares for which there never was an IPSW (as far as can be told) such as 4.2.5 for the CDMA iPhone 4 (iPhone3,3). These few builds came preinstalled on the device, but are not available for download.

See also