The iPhone Wiki is no longer updated. Visit this article on The Apple Wiki for current information. |
Difference between revisions of "AES Keys"
(Recent key decryption & 0x8A3 key) |
|||
Line 7: | Line 7: | ||
* Use the crypto bundle provided in [[XPwn]] to utilize it via userland. This method requires a kernel patch. |
* Use the crypto bundle provided in [[XPwn]] to utilize it via userland. This method requires a kernel patch. |
||
* Use [[Greenpois0n (toolkit)|Greenpois0n]] console. |
* Use [[Greenpois0n (toolkit)|Greenpois0n]] console. |
||
+ | * Use [http://github.com/Axi0mX/ipwndfu ipwndfu]. |
||
+ | * Run checkra1n with -p and use the "aes" command over USB. |
||
− | If you want to decrypt [[IMG3 File Format|IMG3]] files you need to use this. The [[GID Key]] |
+ | If you want to decrypt [[IMG3 File Format|IMG3]] or [[IMG4 File Format|IMG4]] files you need to use this. The [[GID Key]] has so far not been extracted from any device, so the only way to use it is by going through the engine itself. |
See [[Obtaining IMG3 Keys#Method 2|Obtaining IMG3 Keys]] for an [[iBoot (Bootloader)|iBoot]] patch. |
See [[Obtaining IMG3 Keys#Method 2|Obtaining IMG3 Keys]] for an [[iBoot (Bootloader)|iBoot]] patch. |
||
Line 18: | Line 20: | ||
__text:807E3030 DCD 0x89B,0x7D0,0x67993E18,0x543CB06B,0xF568A46F,0x49BD0C1C |
__text:807E3030 DCD 0x89B,0x7D0,0x67993E18,0x543CB06B,0xF568A46F,0x49BD0C1C |
||
__text:807E3048 DCD 0x89A,0x7D0,0x335B1FDB,0x1C5F6C60,0x66AA3419,0x61069C58 |
__text:807E3048 DCD 0x89A,0x7D0,0x335B1FDB,0x1C5F6C60,0x66AA3419,0x61069C58 |
||
+ | |||
=== Key 0x835 === |
=== Key 0x835 === |
||
Generated by encrypting 0x01010101010101010101010101010101 with the [[UID-key]].<br /> |
Generated by encrypting 0x01010101010101010101010101010101 with the [[UID-key]].<br /> |
||
Used for data protection. |
Used for data protection. |
||
+ | |||
=== Key 0x836 === |
=== Key 0x836 === |
||
Generated by encrypting 0x00E5A0E6526FAE66C5C1C6D4F16D6180 with the [[UID-key]].<br /> |
Generated by encrypting 0x00E5A0E6526FAE66C5C1C6D4F16D6180 with the [[UID-key]].<br /> |
||
This is computed by the kernel during a restore, but is zeroed out during a normal boot. It is also computed by the Secure Bootloader, and its only known use is to decrypt LLB in NOR. Like 0x835, it is different for each device. |
This is computed by the kernel during a restore, but is zeroed out during a normal boot. It is also computed by the Secure Bootloader, and its only known use is to decrypt LLB in NOR. Like 0x835, it is different for each device. |
||
+ | |||
=== Key 0x837 === |
=== Key 0x837 === |
||
Generated by encrypting 0x345A2D6C5050D058780DA431F0710E15 with the [[S5L8900]] [[GID Key]], resulting in 0x188458A6D15034DFE386F23B61D43774.<br /> |
Generated by encrypting 0x345A2D6C5050D058780DA431F0710E15 with the [[S5L8900]] [[GID Key]], resulting in 0x188458A6D15034DFE386F23B61D43774.<br /> |
||
Line 31: | Line 36: | ||
Generated by encrypting 0x8C8318A27D7F030717D2B8FC5514F8E1 with the [[UID-key]].<br /> |
Generated by encrypting 0x8C8318A27D7F030717D2B8FC5514F8E1 with the [[UID-key]].<br /> |
||
Another UID-AES-key-based key, it is used to encrypt everything but LLB in the NOR (iBoot, DeviceTree, pictures). |
Another UID-AES-key-based key, it is used to encrypt everything but LLB in the NOR (iBoot, DeviceTree, pictures). |
||
+ | |||
=== Key 0x899 === |
=== Key 0x899 === |
||
Generated by encrypting 0xD1E8FCB53937BF8DEFC74CD1D0F1D4B0 with the [[UID-key]]. Usage unknown. |
Generated by encrypting 0xD1E8FCB53937BF8DEFC74CD1D0F1D4B0 with the [[UID-key]]. Usage unknown. |
||
+ | |||
=== Key 0x89A === |
=== Key 0x89A === |
||
Used on A4 devices. Generated by encrypting 0xDB1F5B33606C5F1C1934AA66589C0661 with the [[UID-key]], getting a device-specific key.<br /> |
Used on A4 devices. Generated by encrypting 0xDB1F5B33606C5F1C1934AA66589C0661 with the [[UID-key]], getting a device-specific key.<br /> |
||
It is used to encrypt the [[SHSH]] blobs on the device. |
It is used to encrypt the [[SHSH]] blobs on the device. |
||
+ | |||
=== Key 0x89B === |
=== Key 0x89B === |
||
Generated by encrypting 0x183E99676BB03C546FA468F51C0CBD49 with the [[UID-key]]. It is used to encrypt the data partition key. |
Generated by encrypting 0x183E99676BB03C546FA468F51C0CBD49 with the [[UID-key]]. It is used to encrypt the data partition key. |
||
+ | |||
+ | === Key 0x8A3 === |
||
+ | Generated by encrypting 0x568241656551e0cdf56ff84cc11a79ef with the [[UID-key]] (using AES-256-CBC). It is used during software upgrades on A12 and later to encrypt the "generator" value (using AES-128-CBC) before hashing it to become the nonce. |
||
== Using [[Greenpois0n (toolkit)|greenpois0n]] == |
== Using [[Greenpois0n (toolkit)|greenpois0n]] == |
Latest revision as of 05:11, 28 November 2020
The SoC in each device have an AES coprocessor with the GID Key and UID-key built in.
Contents
Running The Engine
Currently, there are several ways to run the hardware AES engine:
- Patch iBoot to jump to
aes_crypto_cmd
, presuming the AES keys are still enabled. - Use OpenIBoot.
- Use the crypto bundle provided in XPwn to utilize it via userland. This method requires a kernel patch.
- Use Greenpois0n console.
- Use ipwndfu.
- Run checkra1n with -p and use the "aes" command over USB.
If you want to decrypt IMG3 or IMG4 files you need to use this. The GID Key has so far not been extracted from any device, so the only way to use it is by going through the engine itself.
See Obtaining IMG3 Keys for an iBoot patch.
Derived keys
Some derived keys are computed by the IOAESAccelerator kernel service at boot. These keys are generated by encrypting static values either with the UID key (0x7D0 identifier) or the GID key (0x3E8 identifier). The values defined in the iPhone 4 (iPhone3,1) 5.0 kernel are :
__text:807E3000 keys_to_compute DCD 0x835,0x7D0,0x01010101,0x01010101,0x01010101,0x01010101 __text:807E3018 DCD 0x899,0x7D0,0xB5FCE8D1,0x8DBF3739,0xD14CC7EF,0xB0D4F1D0 __text:807E3030 DCD 0x89B,0x7D0,0x67993E18,0x543CB06B,0xF568A46F,0x49BD0C1C __text:807E3048 DCD 0x89A,0x7D0,0x335B1FDB,0x1C5F6C60,0x66AA3419,0x61069C58
Key 0x835
Generated by encrypting 0x01010101010101010101010101010101 with the UID-key.
Used for data protection.
Key 0x836
Generated by encrypting 0x00E5A0E6526FAE66C5C1C6D4F16D6180 with the UID-key.
This is computed by the kernel during a restore, but is zeroed out during a normal boot. It is also computed by the Secure Bootloader, and its only known use is to decrypt LLB in NOR. Like 0x835, it is different for each device.
Key 0x837
Generated by encrypting 0x345A2D6C5050D058780DA431F0710E15 with the S5L8900 GID Key, resulting in 0x188458A6D15034DFE386F23B61D43774.
It is used as the encryption key for IMG2 files. With the introduction of IMG3 in iPhone OS 2.0, KBAGs are now used instead of the 0x837 key. Because iPhone OS versions 1.x were used only on the iPhone and iPod touch (both use the S5L8900) the encrypted values for other processors don't matter.
Key 0x838
Generated by encrypting 0x8C8318A27D7F030717D2B8FC5514F8E1 with the UID-key.
Another UID-AES-key-based key, it is used to encrypt everything but LLB in the NOR (iBoot, DeviceTree, pictures).
Key 0x899
Generated by encrypting 0xD1E8FCB53937BF8DEFC74CD1D0F1D4B0 with the UID-key. Usage unknown.
Key 0x89A
Used on A4 devices. Generated by encrypting 0xDB1F5B33606C5F1C1934AA66589C0661 with the UID-key, getting a device-specific key.
It is used to encrypt the SHSH blobs on the device.
Key 0x89B
Generated by encrypting 0x183E99676BB03C546FA468F51C0CBD49 with the UID-key. It is used to encrypt the data partition key.
Key 0x8A3
Generated by encrypting 0x568241656551e0cdf56ff84cc11a79ef with the UID-key (using AES-256-CBC). It is used during software upgrades on A12 and later to encrypt the "generator" value (using AES-128-CBC) before hashing it to become the nonce.
Using greenpois0n
- Use 'xpwntool file.img3 /dev/null' to extract the KBAG hex string from file.img3
- Run steps 1 through 5 from PwnStrap
- Start greenpois0n console: 'irecovery -s'
- Execute 'go aes dec _KBAG_STRING_' in irecovery console