"The misconduct of the people, the Loris of sin, and the Stone of his mountain, can attack the jade." "-The Book of songs "
650) this.width=650; "Src=" Http://crash-public-online.nos.netease.com/19643011523249f2bb12a7d902afa4d3.jpg? ImageView "style=" border:0px;height:220px;width:209px; "/>
When a program crashes and gets a chance to get to the crash stack, it is important to restore the crash stack to locate the error. The restore of the user symbol is straightforward because the corresponding symbol file (ending in. DSYM) is generated when the APP is packaged. For system symbols, Apple does not provide a corresponding symbol file download, so it needs to parse itself. This article is a simple way to get a system library symbol from the IOS firmware.
First, firmware download and decryption
There are many sites that provide firmware download service, the more famous is: Theiphonewiki.com. The site also maintains a key for firmware decryption,
1 is shown below:
650) this.width=650; "Src=" Http://crash-public-online.nos.netease.com/c6da7210dfba49e197782fcfd7cc712f.png? ImageView "style=" border:0px;height:223px;width:553px; "alt=" C6da7210dfba49e197782fcfd7cc712f.png?ima "/>
Figure 1:theiphonewiki.com Maintenance of IOS 9.x version of firmware decryption key
In Figure 1, the Blue Font section indicates that the corresponding firmware key is present, and the red font indicates that the corresponding firmware key is temporarily unavailable, so only a very small number of arm64 versions of the firmware on the Theiphonewiki can be decrypted.
Firmware (ending with. ipsw) file is actually a compressed package, extracted after the 3 DMG files, the space occupying the largest one contains the required system library. And this file is AES encrypted, decryption this requires Root Filesystem Key. For example, the decryption key for iphone5,4 (i.e. IPhone 5c) firmware
2 is shown below:
650) this.width=650; "Src=" Http://crash-public-online.nos.netease.com/fa553b3fbbd8407f9845e756205472fe.png? ImageView "style=" border:0px;height:106px;width:553px; "alt=" Fa553b3fbbd8407f9845e756205472fe.png?ima "/>
Figure 2:iphone5,4 Firmware Root Filesystem decryption Key
after acquiring the key, you can use the Vfdecrypt tool to complete the final decryption, but there are many more convenient UI integration tools or Python scripts, such as Idecrpyptit.
second, System library symbol extraction
Starting with IPhone OS 3.1, all system libraries are packaged into one file: dyld_shared_cache_xxx, where xxx represents a specific schema, which is located in the:/system/library/caches/com.apple.dyld directory.
dyld_shared_cache_xxx files can be extracted using the code in the Dyld,
As shown in step 3:
650) this.width=650; "Src=" Http://crash-public-online.nos.netease.com/2337ba75cf5043f1b108fc2303cd793f.png? ImageView "style=" border:0px;height:227px;width:553px; "alt=" 2337ba75cf5043f1b108fc2303cd793f.png?ima "/>
Figure 3:dyld_shared_cache_xxx File decryption method
The resulting directory contains the system library files for this firmware, such as uikit.framework.
Iii. places to be explained
The decryption key provided on the Theiphonewiki does not have a arm64 architecture, and if you want to decrypt the firmware for the IPhone 5s and future products, you need to obtain the decryption key manually via another channel or by yourself. about how to manually obtain the decryption key, this article does not involve, this topic the author also is studying, welcome everybody to correct.
Talk about extracting system library symbols from iOS firmware