<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SciresM</id>
	<title>3dbrew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SciresM"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/SciresM"/>
	<updated>2026-04-24T21:45:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FIRM&amp;diff=21054</id>
		<title>FIRM</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FIRM&amp;diff=21054"/>
		<updated>2019-10-01T02:28:36Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Note that FIRM sections may be encrypted as well as their heuristics&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the file format for the [[Title list#00040138 - System Firmware|3DS&#039; Firmware]], it contains up to four &#039;sections&#039; of data comprising the ARM9 and ARM11 kernels, and some fundamental processes. The firmware sections are not encrypted. In a nutshell, a FIRM contains all the data required to set up the ARM9 and ARM11 kernels, and basic operating functionality.&lt;br /&gt;
&lt;br /&gt;
The ARM9 section contains the ARM9 kernel (and loader) and the Process9 NCCH (which is the only process run in user mode on the ARM9). The ARM11 sections contain the ARM11 kernel (and loader), and various ARM11 process NCCHs. For NATIVE_FIRM/SAFE_MODE_FIRM these ARM11 processes are sm, fs, pm, loader, and pxi. Normally the 4th section is not used. The code loaded from FIRM is constantly running on the system until another FIRM is launched. The ARM11 kernel is hard-coded to always decompress the ExeFS .code of embedded ARM11 NCCHs without checking the exheader compression bit.&lt;br /&gt;
&lt;br /&gt;
== FIRM Header ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x000&lt;br /&gt;
|  4&lt;br /&gt;
|  Magic &#039;FIRM&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot priority (highest value = max prio), this is normally zero.&lt;br /&gt;
|-&lt;br /&gt;
|  0x008&lt;br /&gt;
|  4&lt;br /&gt;
|  ARM11 Entrypoint&lt;br /&gt;
|-&lt;br /&gt;
|  0x00C&lt;br /&gt;
|  4&lt;br /&gt;
|  ARM9 Entrypoint&lt;br /&gt;
|-&lt;br /&gt;
|  0x010&lt;br /&gt;
|  0x030&lt;br /&gt;
|  Reserved&lt;br /&gt;
|-&lt;br /&gt;
|  0x040&lt;br /&gt;
|  0x0C0 (0x030*4)&lt;br /&gt;
|  Firmware Section Headers&lt;br /&gt;
|-&lt;br /&gt;
|  0x100&lt;br /&gt;
|  0x100&lt;br /&gt;
|  RSA-2048 signature of the FIRM header&#039;s SHA-256 hash. The signature is checked when bootrom/Process9 are doing FIRM-launch (with the public key being hardcoded in each). The signature is not checked when installing FIRM to the NAND firm0/firm1 partitions.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Firmware Section Headers ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x000&lt;br /&gt;
|  4&lt;br /&gt;
|  Byte offset&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  4&lt;br /&gt;
|  Physical address where the section is loaded to.&lt;br /&gt;
|-&lt;br /&gt;
|  0x008&lt;br /&gt;
|  4&lt;br /&gt;
|  Byte-size.  While loading FIRM this is the field used to determine whether the section exists or not, by checking for value 0x0.&lt;br /&gt;
|-&lt;br /&gt;
|  0x00C&lt;br /&gt;
|  4&lt;br /&gt;
|  Copy-method (0 = NDMA, 1 = XDMA, 2 = CPU mem-copy), Process9 ignores this field. Boot9 doesn&#039;t immediately throw an error when this isn&#039;t 0..2. In that case it will jump over section-data-loading which then results in the hash verification with the below hash being done with the hash already stored in the SHA hardware.&lt;br /&gt;
|-&lt;br /&gt;
|  0x010&lt;br /&gt;
|  0x020&lt;br /&gt;
|  SHA-256 Hash of Firmware Section&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The contents of individual sections &#039;&#039;may&#039;&#039; be encrypted if the FIRM is not meant to be booted from NAND, i.e. if it is meant to be booted from SPI flash or NTR cartridge. If hash checks fail for all FIRM sections if treated as plaintext, it may be worth trying to check if the sections are encrypted. The encryption is detailed on [[Bootloader#Non-NAND_FIRM_boot|the bootloader page]].&lt;br /&gt;
&lt;br /&gt;
== [[New_3DS]] FIRM ==&lt;br /&gt;
For New3DS firmwares (NATIVE_FIRM, TWL_FIRM, ..), the ARM9 FIRM binary has an additional layer of crypto. At the end of each ARM9 binary, there&#039;s a plaintext loader. The format of the FIRM header is identical to regular 3DS FIRM(the RSA modulo is the same as regular 3DS too).&lt;br /&gt;
&lt;br /&gt;
Before checking [[CONFIG_Registers|CFG_SYSPROT9]] the loader main() does the following:&lt;br /&gt;
* On [[9.5.0-22|9.5.0-X]]: executes a nop instruction with r0=0 and r1=&amp;lt;address of arm9binhdr+0x50&amp;gt;.&lt;br /&gt;
* Clears bit6 in [[AES_Registers|REG_AESKEYCNT]].&lt;br /&gt;
&lt;br /&gt;
If [[CONFIG_Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit 1 is clear (which means the OTP area is unlocked and so it knows that this is a hard reboot), it does the following things:&lt;br /&gt;
* Clears 0x200-bytes on the stack, then reads [[Flash_Filesystem|NAND]] sector 0x96(NAND image offset 0x12C00), with size 0x200-bytes into that stack buffer.&lt;br /&gt;
* Checks [[CONFIG_Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit 1 again, if it&#039;s set then it executes a panic function(set r0-r2=0, execute nop instruction, then execute instruction &amp;quot;bkpt 0x99&amp;quot;).&lt;br /&gt;
* Hashes data from the OTP region [[IO_Registers|0x10012000-0x10012090]] using SHA256 via the [[SHA_Registers|SHA]] hardware.&lt;br /&gt;
* Clears bit6 in [[AES_Registers|REG_AESKEYCNT]]. Initializes AES keyslot 0x11 keyX, keyY to the lower and higher portion of the above hash, respectively. Due to the above hashed data, the keyX+keyY here are console-unique.&lt;br /&gt;
* Decrypts the first 0x10-byte block in the above read NAND sector with keyslot 0x11 using AES-ECB. [[9.6.0-24|9.6.0-X]]: Then it decrypts the 0x10-bytes at offset 0x10 in the sector with keyslot 0x11.&lt;br /&gt;
* Then the normalkey, keyX, and keyY, for keyslot 0x11 are cleared to zero. Runs the TWL key-init/etc code which was originally in the ARM9-kernel, then writes 0x2 to [[CONFIG_Registers|CFG_SYSPROT9]] to disable the OTP area.&lt;br /&gt;
* Then it uses the above decrypted block from sector+0 to set the normalkey for keyslot 0x11. Decrypts arm9_bin_buf+0 using keyslot 0x11 with AES-ECB, and initialises keyX for keyslot 0x15 with it.&lt;br /&gt;
* [[9.6.0-24|9.6.0-X]]: Then it uses the above decrypted block from sector+0 to set the normalkey for keyslot 0x11. Decrypts a 0x10-byte block from arm9loader .(ro)data using keyslot 0x11 with AES-ECB, and initializes keyX for keyslot 0x18 with it(same block as previous versions).&lt;br /&gt;
* [[9.6.0-24|9.6.0-X]]: Starting with this version keyslot 0x16 keyX init was moved here, see below for details on this. The code for this is same as  [[9.5.0-22|9.5.0-X]], except the decrypted normalkey from sector+0x10 is used for keyslot 0x11 instead.&lt;br /&gt;
* Initialises KeyX for keyslots 0x18..0x1F(0x19..0x1F with [[9.6.0-24|9.6.0-X]]) with the output of decrypting a 0x10-byte block with AES-ECB using keyslot 0x11. This block was changed to a new one separate from keyslot 0x18, starting with [[9.6.0-24|9.6.0-X]]. The last byte in this 0x10-byte input block is increased by 0x01 after initializing each keyslot. Before doing the crypto each time, the loader sets the normal-key for keyslot 0x11 to the plaintext normalkey from sector+0(+0x10 with [[9.6.0-24|9.6.0-X]]). These are New3DS-specific keys.&lt;br /&gt;
* [[9.5.0-22|9.5.0-X]](moved to above with [[9.6.0-24|9.6.0-X]]): Sets the normal-key for keyslot 0x11 to the same one already decrypted on the stack. Decrypts the 0x10-byte block at arm9binhdr+0x60 with AES-ECB using keyslot 0x11, then sets the keyX for keyslot 0x16 to the output data.&lt;br /&gt;
* [[9.5.0-22|9.5.0-X]]: The normalkey, keyX, and keyY, for keyslot 0x11 are then cleared to zero.&lt;br /&gt;
&lt;br /&gt;
When [[CONFIG_Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit 1 is set(which means this happens only when this loader runs again for firm-launch), the normalkey, keyX, and keyY, for keyslot 0x11 are cleared to zero.&lt;br /&gt;
&lt;br /&gt;
It sets KeyY for keyslot 0x15(0x16 with [[9.5.0-22|9.5.0-X]]) to arm9_bin_buf+16, the CTR to arm9_bin_buf+32 (both are unique for every version). It then proceeds to decrypt the binary with AES-CTR. When done, it sets the normal-key for the keyslot used for binary decryption to zeros. It then decrypts arm9_bin_buf+64 using an hardcoded keyY for keyslot 0x15([[9.5.0-22|9.5.0-X]]/[[9.6.0-24|9.6.0-X]] also uses keyslot 0x15), sets the normal-key for this keyslot to zeros again, then makes sure the output block is all zeroes. If it is, it does some cleanup then it jumps to the entrypoint for the decrypted binary. Otherwise it will clear the keyX, keyY, and normal-key for each of the keyslots initialized by this loader (on [[9.6.0-24|9.6.0-X]]+, on older versions this was bugged and cleared keys 0x00..0x07 instead of 0x18..0x1F), do cleanup(same cleanup as when the decrypted block is all-zero) then just loop forever.&lt;br /&gt;
&lt;br /&gt;
Thus, the ARM9 binary has the following header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x000&lt;br /&gt;
|  16&lt;br /&gt;
|  Encrypted KeyX (same for all FIRM&#039;s)&lt;br /&gt;
|-&lt;br /&gt;
|  0x010&lt;br /&gt;
|  16&lt;br /&gt;
|  KeyY&lt;br /&gt;
|-&lt;br /&gt;
|  0x020&lt;br /&gt;
|  16&lt;br /&gt;
|  CTR&lt;br /&gt;
|-&lt;br /&gt;
|  0x030&lt;br /&gt;
|  8&lt;br /&gt;
|  Size of encrypted binary, as ASCII text?&lt;br /&gt;
|-&lt;br /&gt;
|  0x038&lt;br /&gt;
|  8&lt;br /&gt;
|  ?&lt;br /&gt;
|-&lt;br /&gt;
|  0x040&lt;br /&gt;
|  16&lt;br /&gt;
|  Control block&lt;br /&gt;
|-&lt;br /&gt;
|  0x050&lt;br /&gt;
|  16&lt;br /&gt;
|  Added with [[9.5.0-22|9.5.0-X]]. Only used for hardware debugging: a nop instruction is executed with r0=0 and r1=&amp;lt;address of this data&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|  0x060&lt;br /&gt;
|  16&lt;br /&gt;
|  Added with [[9.5.0-22|9.5.0-X]]. Encrypted keyX for keyslot 0x16.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally the padding after the header before offset 0x800(start of actual ARM9-binary) was 0xFF bytes, with [[9.5.0-22|9.5.0-X]] this was changed to 0x0.&lt;br /&gt;
&lt;br /&gt;
For the New3DS NATIVE_FIRM arm9-section header, the only difference between the [[8.1.0-0_New3DS]] version and the [[9.0.0-20]] version is that the keyY, CTR, and the block at 0x30 in the header were updated.&lt;br /&gt;
&lt;br /&gt;
===New3DS ARM9 binary loader versions===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  FIRM system version(s)&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| [[8.1.0-0_New3DS]] - [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| Initial version.&lt;br /&gt;
|-&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| Added keyX initialization for keyslot 0x16(see above), and added code for clearing keyslot 0x11 immediately after the code finishes using keyslot 0x11. The keyslot used for arm9bin decryption was changed from 0x15 to 0x16. Added code for clearing keyslot 0x16 when control-block decryption fails. Added code for using arm9bin_hdr+0x50 with a nop instruction, at the very beginning of the main arm9-loader function. Added two new 0x10-blocks to the arm9bin-hdr.&lt;br /&gt;
|-&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] - [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| See above and [[9.6.0-24|here]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===New3DS ARM9 kernel===&lt;br /&gt;
The only actual code-difference for the Old3DS/New3DS ARM9-kernels&#039; crt0, besides TWL AES / [[IO_Registers|0x10012000]] related code, is that the New3DS ARM9-kernel writes 0x1 to [[CONFIG_Registers|REG_EXTMEMCNT9]] in the crt0.&lt;br /&gt;
&lt;br /&gt;
===New3DS Process9===&lt;br /&gt;
The following is all of the differences for Old3DS/New3DS Process9 with [[9.3.0-21|9.3.0-X]]:&lt;br /&gt;
* The FIRM-launch code called at the end of the New3DS proc9 main() has different mem-range checks.&lt;br /&gt;
* In the New3DS proc9, the v6.0/v7.0 keyinit function at the very beginning(before the original code) had additional code added for setting [[Flash_Filesystem|CTRNAND]] [[AES_Registers|keyslot]] 0x5, with keydata from .data. After setting the keyY, the keyY in .data is cleared.&lt;br /&gt;
* In New3DS proc9, the functions for getting the gamecard crypto keyslots / NCCH keyslot can return New3DS keyslots when New3DS flags(NCSD/NCCH) are set.&lt;br /&gt;
* The code/data for the binary near the end of arm9mem is slightly different, because of memory-region sizes.&lt;br /&gt;
* The only difference in .data(besides the above code binary) is that the New3DS proc9 has an additional 0x10-byte block for the keyslot 0x5 keyY, see above.&lt;br /&gt;
&lt;br /&gt;
== Variations ==&lt;br /&gt;
There exists different official firmwares for the 3DS: The default one (NATIVE_FIRM) is used to run all 3DS content and boots by default, while backwards compatibility is handled by TWL_FIRM and AGB_FIRM. There furthermore is a rescue mode provided by SAFE_MODE_FIRM.&lt;br /&gt;
&lt;br /&gt;
=== NATIVE_FIRM ===&lt;br /&gt;
NATIVE_FIRM is the FIRM which is installed to the [[Flash_Filesystem|NAND]] firm partitions, which is loaded by bootrom.&lt;br /&gt;
&lt;br /&gt;
Version history:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  System version&lt;br /&gt;
!  old 3DS title version&lt;br /&gt;
!  old 3DS hex title contentID&lt;br /&gt;
!  Kernel/FIRM version (old 3DS/new 3DS)&lt;br /&gt;
!  FIRM ARM11-sysmodule Product Code&lt;br /&gt;
|-&lt;br /&gt;
| [[Factory_Setup|Factory]] FIRM (titleID 00040001-00000002)&lt;br /&gt;
| v0&lt;br /&gt;
| 00&lt;br /&gt;
| 2.3-0&lt;br /&gt;
|-&lt;br /&gt;
| Pre-1.0. Referenced in the v1.0 Home Menu NCCH plain-region.&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| 2.23-X&lt;br /&gt;
|-&lt;br /&gt;
| [[1.0.0-0|1.0.0]]&lt;br /&gt;
| v432&lt;br /&gt;
| 00&lt;br /&gt;
| 2.27-0&lt;br /&gt;
|-&lt;br /&gt;
| [[1.1.0-1|1.1.0]]&lt;br /&gt;
| v1472&lt;br /&gt;
| 02&lt;br /&gt;
| 2.28-0&lt;br /&gt;
|-&lt;br /&gt;
| [[2.0.0-2|2.0.0]]&lt;br /&gt;
| v2516&lt;br /&gt;
| 09&lt;br /&gt;
| 2.29-7&lt;br /&gt;
|-&lt;br /&gt;
| [[2.1.0-3|2.1.0]]&lt;br /&gt;
| v3553&lt;br /&gt;
| 0B&lt;br /&gt;
| 2.30-18&lt;br /&gt;
| 0608builder&lt;br /&gt;
|-&lt;br /&gt;
| [[2.2.0-X|2.2.0]]&lt;br /&gt;
| v4595&lt;br /&gt;
| 0F&lt;br /&gt;
| 2.31-40&lt;br /&gt;
| 0909builder&lt;br /&gt;
|-&lt;br /&gt;
| [[3.0.0-5|3.0.0]]&lt;br /&gt;
| v5647&lt;br /&gt;
| 18&lt;br /&gt;
| 2.32-15&lt;br /&gt;
| 1128builder&lt;br /&gt;
|-&lt;br /&gt;
| [[4.0.0-7|4.0.0]]&lt;br /&gt;
| v6677&lt;br /&gt;
| 1D&lt;br /&gt;
| 2.33-4&lt;br /&gt;
| 0406builder&lt;br /&gt;
|-&lt;br /&gt;
| [[4.1.0-8|4.1.0]]&lt;br /&gt;
| v7712&lt;br /&gt;
| 1F&lt;br /&gt;
| 2.34-0&lt;br /&gt;
| 0508builder&lt;br /&gt;
|-&lt;br /&gt;
| [[5.0.0-11|5.0.0]]&lt;br /&gt;
| v8758&lt;br /&gt;
| 25&lt;br /&gt;
| 2.35-6&lt;br /&gt;
| 0228builder&lt;br /&gt;
|-&lt;br /&gt;
| [[5.1.0-11|5.1.0]]&lt;br /&gt;
| v9792&lt;br /&gt;
| 26&lt;br /&gt;
| 2.36-0&lt;br /&gt;
| 0401builder&lt;br /&gt;
|-&lt;br /&gt;
| [[6.0.0-11|6.0.0]]&lt;br /&gt;
| v10833&lt;br /&gt;
| 29&lt;br /&gt;
| 2.37-0&lt;br /&gt;
| 0520builder&lt;br /&gt;
|-&lt;br /&gt;
| [[6.1.0-11|6.1.0]]&lt;br /&gt;
| v11872&lt;br /&gt;
| 2A&lt;br /&gt;
| 2.38-0&lt;br /&gt;
| 0625builder&lt;br /&gt;
|-&lt;br /&gt;
| [[7.0.0-13|7.0.0]]&lt;br /&gt;
| v12916&lt;br /&gt;
| 2E&lt;br /&gt;
| 2.39-4&lt;br /&gt;
| 1125builder&lt;br /&gt;
|-&lt;br /&gt;
| [[7.2.0-17|7.2.0]]&lt;br /&gt;
| v13956&lt;br /&gt;
| 30&lt;br /&gt;
| 2.40-0&lt;br /&gt;
| 0404builder&lt;br /&gt;
|-&lt;br /&gt;
| [[8.0.0-18|8.0.0]]&lt;br /&gt;
| v15047&lt;br /&gt;
| 37&lt;br /&gt;
| 2.44-6&lt;br /&gt;
| 0701builder&lt;br /&gt;
|-&lt;br /&gt;
| [[8.1.0-0_New3DS]]&lt;br /&gt;
|N/A&lt;br /&gt;
|N/A&lt;br /&gt;
| 2.45-5&lt;br /&gt;
|-&lt;br /&gt;
| [[9.0.0-20|9.0.0]]&lt;br /&gt;
| v17120&lt;br /&gt;
| 38&lt;br /&gt;
| 2.46-0&lt;br /&gt;
| 0828builder&lt;br /&gt;
|-&lt;br /&gt;
| [[9.3.0-21|9.3.0]]&lt;br /&gt;
| v18182&lt;br /&gt;
| 3F&lt;br /&gt;
| 2.48-3&lt;br /&gt;
| 1125builder&lt;br /&gt;
|-&lt;br /&gt;
| [[9.5.0-22|9.5.0]]&lt;br /&gt;
| v19216&lt;br /&gt;
| 40&lt;br /&gt;
| 2.49-0&lt;br /&gt;
| 0126builder&lt;br /&gt;
|-&lt;br /&gt;
| [[9.6.0-24|9.6.0]]&lt;br /&gt;
| v20262&lt;br /&gt;
| 49&lt;br /&gt;
| 2.50-1&lt;br /&gt;
| 0311builder&lt;br /&gt;
|-&lt;br /&gt;
| [[10.0.0-27|10.0.0]]&lt;br /&gt;
| v21288&lt;br /&gt;
| 4B&lt;br /&gt;
| 2.50-7&lt;br /&gt;
| 0812builder&lt;br /&gt;
|-&lt;br /&gt;
| [[10.2.0-28|10.2.0]]&lt;br /&gt;
| v22313&lt;br /&gt;
| 4C&lt;br /&gt;
| 2.50-9&lt;br /&gt;
| 1009builder&lt;br /&gt;
|-&lt;br /&gt;
| [[10.4.0-29|10.4.0]]&lt;br /&gt;
| v23341&lt;br /&gt;
| 50&lt;br /&gt;
| 2.50-11&lt;br /&gt;
| 1224builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.0.0-33|11.0.0]]&lt;br /&gt;
| v24368&lt;br /&gt;
| 52&lt;br /&gt;
| 2.51-0&lt;br /&gt;
| 0406builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.1.0-34|11.1.0]]&lt;br /&gt;
| v25396&lt;br /&gt;
| 56&lt;br /&gt;
| 2.51-2&lt;br /&gt;
| 0805builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.2.0-35|11.2.0]]&lt;br /&gt;
| v26432&lt;br /&gt;
| 58&lt;br /&gt;
| 2.52-0&lt;br /&gt;
| 1015builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.3.0-36|11.3.0]]&lt;br /&gt;
| v27476&lt;br /&gt;
| 5C&lt;br /&gt;
| 2.53-0&lt;br /&gt;
| 0126builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.4.0-37|11.4.0]]&lt;br /&gt;
| v28512&lt;br /&gt;
| 5E&lt;br /&gt;
| 2.54-0&lt;br /&gt;
| 0314builder&lt;br /&gt;
|-&lt;br /&gt;
| [[11.8.0-41|11.8.0]]&lt;br /&gt;
| v29557&lt;br /&gt;
| 64&lt;br /&gt;
| 2.55-0&lt;br /&gt;
| 0710pseg-ciuser&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The above kernel/FIRM versions are in the format: &amp;lt;KERNEL_VERSIONMAJOR&amp;gt;.&amp;lt;KERNEL_VERSIONMINOR&amp;gt;-&amp;lt;KERNEL_VERSIONREVISION&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== SAFE_MODE_FIRM ===&lt;br /&gt;
SAFE_MODE is used for running the [[System_Settings#System_Updater|System Updater]]. SAFE_MODE_FIRM and NATIVE_FIRM for the initial versions are exactly the same, except for the system core version fields.&lt;br /&gt;
&lt;br /&gt;
=== TWL_FIRM ===&lt;br /&gt;
TWL_FIRM handles DS(i) backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
The 3DS-mode ARM9 core seems to switch into DSi-mode(for running DSi-mode ARM9 code) by writing to a [[PDN]] register(this changes the memory layout to DSi-mode / etc, therefore this register poke *must* be executed from ITCM). This is the final 3DS-mode register poke before the ARM9 switches into DSi-mode. DS(i)-mode ARM7 code is run on the internal [[ARM7]] core, which is started up during TWL_FIRM boot. Trying to read from the exception-vector region(address 0x0) under this DSi-mode ARM7 seems to only return 0x00/0xFF data. Also note that this DSi-mode ARM7 runs code(stored in TWL_FIRM) which pokes some DSi-mode registers that on the DSi were used for disabling access to the DSi bootROMs, however these registers do not affect the 3DS DSi-mode ARM9/ARM7 &amp;quot;bootrom&amp;quot; region(exceptionvector region + 0x8000) at all.&lt;br /&gt;
&lt;br /&gt;
For shutting down the system, TWL_FIRM writes u8 value 8 to [[I2C]] MCU register 0x20. For returning to 3DS-mode, TWL_FIRM writes value 4 to that MCU register to trigger a hardware system reboot.&lt;br /&gt;
&lt;br /&gt;
The TWL_FIRM ARM11-process includes a TWL bootloader, see [http://dsibrew.org/wiki/Bootloader here] and [[Memory_layout#Detailed_TWL_FIRM_ARM11_Memory|here]] for details.&lt;br /&gt;
&lt;br /&gt;
TWL_FIRM verifies all TWL RSA padding with the following. This is different from the DSi &amp;quot;BIOS&amp;quot; code.&lt;br /&gt;
* The first byte must be 0x0.&lt;br /&gt;
* The second byte must be 0x1 or 0x2.&lt;br /&gt;
* Executes a while(&amp;lt;value of byte at current pos in RSA message&amp;gt;). When the second_byte in the message is 0x1, the byte at curpos must be 0xFF(otherwise the non-zero value of the byte at curpos doesn&#039;t matter). This loop must find a zero byte before offset 0x7F in the message otherwise an error is returned.&lt;br /&gt;
* Returns an address for msg_curpos+1.&lt;br /&gt;
totalhashdatasize = rsasig_bytesize - above position in the message for the hashdata. The actual &amp;quot;totalhashdatasize&amp;quot; in the RSA message must be &amp;lt;= &amp;lt;expected hashdata_size&amp;gt;(0x74 for bootloader). The TWL_FIRM code copies the RSA &amp;quot;hashdata&amp;quot; to the output buffer, using the actual size of the RSA &amp;quot;hashdata&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== AGB_FIRM ===&lt;br /&gt;
AGB_FIRM handles running GBA VC titles. The ARM9 FIRM section for TWL_FIRM and AGB_FIRM are exactly the same (for TWL_FIRM and AGB_FIRM versions which were updated with the same system-update).&lt;br /&gt;
&lt;br /&gt;
== FIRM Launch Parameters ==&lt;br /&gt;
The FIRM-launch parameters structure is located at FCRAM+0, size 0x1000-bytes. The ARM11-kernel copies this structure elsewhere, then clears the 0x1000-bytes at FCRAM+0. It will not handle an existing structure at FCRAM+0 if [[CONFIG Registers#CFG_BOOTENV|CFG_BOOTENV]] is zero. The ARM9 kernel [[Configuration_Memory#0x1FF80016|writes some values]] about the boot environment to AXI WRAM during init to enable this.&lt;br /&gt;
&lt;br /&gt;
Note: it seems NATIVE_FIRM ARM11-kernel didn&#039;t parse this during boot until [[3.0.0-5|3.0.0-X]]?&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| 0x100&lt;br /&gt;
| &#039;TLNC&#039; block created by TWL applications, handled by NS for backwards-compatibility purposes. See [[NS#Auto-boot|here]] for more info.&lt;br /&gt;
|-&lt;br /&gt;
| 0x400&lt;br /&gt;
| 0x4&lt;br /&gt;
| Flags&lt;br /&gt;
|-&lt;br /&gt;
| 0x410&lt;br /&gt;
| 0xC&lt;br /&gt;
| This is used for overriding the FIRM_* fields in [[Configuration_Memory]], when the flag listed below is set, in the following order(basically just data-copy from here to 0x1FF80060): &amp;quot;FIRM_?&amp;quot;, FIRM_VERSIONREVISION, FIRM_VERSIONMINOR, FIRM_VERSIONMAJOR, FIRM_SYSCOREVER, and FIRM_CTRSDKVERSION.&lt;br /&gt;
|-&lt;br /&gt;
| 0x438&lt;br /&gt;
| 0x4&lt;br /&gt;
| The kernel checks this field for value 0xFFFF, if it matches the kernel uses the rest of these parameter fields, otherwise FIRM-launch parameters fields are ignored by the kernel.&lt;br /&gt;
|-&lt;br /&gt;
| 0x43C&lt;br /&gt;
| 0x4&lt;br /&gt;
| CRC32, this is calculated starting at FIRM-params offset 0x400, with size 0x140(with this field cleared to zero during calculation). When invalid the kernel clears the entire buffer used for storing the FIRM-params, therefore no actual FIRM-params are handled after that.&lt;br /&gt;
|-&lt;br /&gt;
| 0x440&lt;br /&gt;
| 0x10&lt;br /&gt;
| Titleinfo [[Filesystem_services#ProgramInfo|Program Info]], used by NS during NS startup, to launch the specified title when the below flag is set.&lt;br /&gt;
|-&lt;br /&gt;
| 0x450&lt;br /&gt;
| 0x10&lt;br /&gt;
| Titleinfo [[Filesystem_services#ProgramInfo|Program Info]]. This might be used for returning to the specified title, once the above launched title terminates?&lt;br /&gt;
|-&lt;br /&gt;
| 0x460&lt;br /&gt;
| 0x4&lt;br /&gt;
| Bit0: 0 = titleinfo structure isn&#039;t set, 1 = titleinfo structure is set.&lt;br /&gt;
|-&lt;br /&gt;
| 0x480&lt;br /&gt;
| 0x20&lt;br /&gt;
| This can be set via buf1 for [[APT:SendDeliverArg]]/[[APT:StartApplication]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x4A0&lt;br /&gt;
| 0x10&lt;br /&gt;
| This can be set by [[NSS:SetWirelessRebootInfo]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x4B0&lt;br /&gt;
| 0x14&lt;br /&gt;
| SHA1-HMAC of the banner for TWL/NTR titles. This can be set by [[NSS:SetTWLBannerHMAC]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x500&lt;br /&gt;
| 0x40&lt;br /&gt;
| This is used by [[APT:LoadSysMenuArg]] and [[APT:StoreSysMenuArg]].&lt;br /&gt;
|-&lt;br /&gt;
| 0xD70&lt;br /&gt;
| 0x290&lt;br /&gt;
| [[Config Savegame|Config]] data struct for LGY FIRM.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Flags from offset 0x400:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| This can be used for overriding the default FCRAM [[Memory_layout|memory-regions]] allocation sizes(APPLICATION, SYSTEM, and BASE). The values for this is the same as [[Configuration_Memory#APPMEMTYPE|Configmem-APPMEMTYPE]]. Values 0-1 are handled the same way by the kernel. However for NS, 0=titleinfo structure for launching a title isn&#039;t set, while non-zero=titleinfo structure is set.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x3&lt;br /&gt;
| Setting bit0 here enables overriding the FIRM_* fields in [[Configuration_Memory]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Config Savegame|Config]] struct for booting LGY FIRMs from offset 0xD70:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Config block 0x30000.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x1&lt;br /&gt;
| Config block 0x70001.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x1&lt;br /&gt;
| System language (Config block 0xA0002).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| [[Cfg:SecureInfoGetRegion|Region from SecureInfo]] (&amp;quot;pseudo-block&amp;quot; 0x140000 in LGY FIRM).&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xF&lt;br /&gt;
| [[CfgS:SecureInfoGetSerialNo|Serial number from SecureInfo]] (&amp;quot;pseudo-block&amp;quot; 0x140001 in LGY FIRM).&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| 0x1&lt;br /&gt;
| Config block 0x100002.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x10&lt;br /&gt;
| Config block 0x100003.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x2&lt;br /&gt;
| Config block 0x100000.&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1&lt;br /&gt;
| Cleared to zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x27&lt;br /&gt;
| 0x1&lt;br /&gt;
| Cleared to zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x94&lt;br /&gt;
| Config block 0x100001.&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC&lt;br /&gt;
| 0x2&lt;br /&gt;
| Config block 0x50000.&lt;br /&gt;
|-&lt;br /&gt;
| 0xBE&lt;br /&gt;
| 0x2&lt;br /&gt;
| Config block 0x50001.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x38&lt;br /&gt;
| Config block 0x50002.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8&lt;br /&gt;
| 0x20&lt;br /&gt;
| Config block 0x50004.&lt;br /&gt;
|-&lt;br /&gt;
| 0x118&lt;br /&gt;
| 0x134&lt;br /&gt;
| Config block 0x20000.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24C&lt;br /&gt;
| 0x10&lt;br /&gt;
| Config block 0x40000.&lt;br /&gt;
|-&lt;br /&gt;
| 0x25C&lt;br /&gt;
| 0x1C&lt;br /&gt;
| Config block 0x40001.&lt;br /&gt;
|-&lt;br /&gt;
| 0x278&lt;br /&gt;
| 0x4&lt;br /&gt;
| Cleared to zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x27C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Cleared to zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x280&lt;br /&gt;
| 0x8&lt;br /&gt;
| Config block 0x30001.&lt;br /&gt;
|-&lt;br /&gt;
| 0x288&lt;br /&gt;
| 0x2&lt;br /&gt;
| CRC16 over the above fields from offset 0x0, size 0x288. If not valid, LGY FIRM uses dummy data from .(ro)data.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28A&lt;br /&gt;
| 0x2&lt;br /&gt;
| If non-zero, the size (below) is hardcoded (currently) to value 0x288, otherwise the size field below is used.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Value 0x288 (size used for verifying the CRC16).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Cleared to zero&amp;quot; fields above are not read at all by LGY FIRM.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=20912</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=20912"/>
		<updated>2019-04-06T17:28:45Z</updated>

		<summary type="html">&lt;p&gt;SciresM: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This region (0x10012000-0x10012100) is used as persistent storage on SoC and for passing the TWL console ID around (0x10012100-0x10012108).&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Console-unique keys are derived from here. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is the console-unique data store, including [[CTCert]] etc, that ends up in ITCM at 0x01FFB800. After decryption, the first 0x90-bytes of plaintext are copied to 0x01FFB800 if hash verification passes. Refer to [[Memory_layout#ARM9_ITCM]] for what is contained in the decrypted OTP.&lt;br /&gt;
&lt;br /&gt;
On [[FIRM]] versions prior to [[3.0.0-6|3.0.0-X]], this region was left unprotected. On versions since [[3.0.0-6|3.0.0-X]], this has been fixed, and the region disable is now done by Kernel9 after doing console-unique TWL keyinit, by setting bit 1 of [[CONFIG|REG_SYSPROT9]]. However, with the [[New_3DS]] FIRM ARM9 binary this is now done in the [[FIRM]] ARM9 binary loader, which also uses the 0x10012000 region for New 3DS key generation.&lt;br /&gt;
&lt;br /&gt;
On development units ([[CONFIG|UNITINFO]] != 0) ARM9 uses the first 8-bytes from 0x10012000 for the TWL Console ID. This region doesn&#039;t seem to be used by NATIVE_FIRM on retail at all, besides New3DS key-generation in the [[FIRM|ARM9-loader]].&lt;br /&gt;
&lt;br /&gt;
Normally [[Bootloader|Boot9]] will pass plaintext_otp+0x90 to the AES keyinit function, but when hash verification fails it will pass 0x10012000(otp+0) instead.&lt;br /&gt;
&lt;br /&gt;
== Sections ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| Console-unique data encrypted with AES-CBC. The normalkey and IV are stored in Boot9(retail/devunit have seperate normalkey+IV for this). The last 0x20-bytes of plaintext are a SHA256 hash over the first 0xE0-bytes of plaintext.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x8&lt;br /&gt;
| Before writing REG_SYSPROT9 bit1, the ARM9 copies the 8-byte TWL Console ID here. This sets the registers at 0x4004D00 for ARM7.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Plaintext OTP ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x90&lt;br /&gt;
| Copied into ITCM. The encrypted version of this is what New3DS-arm9loader hashes for key-generation.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is always 0xDEADB00F.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the u32 DeviceId.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is the fall-back keyY used for movable.sed keyY when movable.sed doesn&#039;t exist in NAND(the last two words here are used on retail for generating console-unique TWL keydata/etc). This is also used for &amp;quot;LocalFriendCodeSeed&amp;quot;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| OTP version&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| 0x1&lt;br /&gt;
| This determines if the OTP is for a dev system; it indicates the [[CTCert]] issuer type: 0 = retail &amp;quot;Nintendo CA - G3_NintendoCTR2prod&amp;quot;, non-zero = dev &amp;quot;Nintendo CA - G3_NintendoCTR2dev&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| 0x6&lt;br /&gt;
| Manufacturing date (of the SoC?). Usually month(s) before the dates in the logs stored in [[Flash_Filesystem|TWLNAND]]. Each byte is one field: year, month, day, hour, minute, second. Year is encoded as year-1900 so that it fits in one byte. This order matches up with the layout of a &amp;lt;code&amp;gt;struct tm&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the CTCert expiry time as UNIX timestamp, this is specified in big endian if the OTP version is &amp;lt;5.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x20&lt;br /&gt;
| This is the CTCert ECDSA privk.&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x3C&lt;br /&gt;
| This is the CTCert ECDSA signature (sect233r1?/SHA-256).&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is all-zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x90&lt;br /&gt;
| 0x70&lt;br /&gt;
| Used by Boot9 for generating the console-unique AES [[AES_Registers|keyXs]]. However, due to a bug(?) in Boot9, only the first 0x1C-bytes here actually affect console-unique key generation. The rest of the data is used for hashing, but that output hash only gets overwritten without being used afterwards.&lt;br /&gt;
&lt;br /&gt;
Note that the size passed to the Boot9 keyinit code for console-unique-buffer-size is 0x70, hence this includes the below OTP hash.&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash over the previous 0xE0-bytes.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=NDMA_Registers&amp;diff=20411</id>
		<title>NDMA Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=NDMA_Registers&amp;diff=20411"/>
		<updated>2017-10-20T17:26:16Z</updated>

		<summary type="html">&lt;p&gt;SciresM: actually add this to wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;3DS NDMA has 8 channels. The first 0x100-bytes of this IO mem is mirrored at 0x10002100, repeated every 0x100-bytes until the end of the 0x1000-byte IO mem. NDMA can access the ARM9 bootrom, including the protected part before it is locked out.&lt;br /&gt;
&lt;br /&gt;
= Registers =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  Name&lt;br /&gt;
!  Address&lt;br /&gt;
!  Width&lt;br /&gt;
!  Used by&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_GLOBAL_CNT|NDMA_GLOBAL_CNT]]&lt;br /&gt;
|  0x10002000&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_SRC_ADDR|NDMA_SRC_ADDR]](n)&lt;br /&gt;
|  0x10002004 + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_DST_ADDR|NDMA_DST_ADDR]](n)&lt;br /&gt;
|  0x10002008 + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_TRANSFER_CNT|NDMA_TRANSFER_CNT]](n)&lt;br /&gt;
|  0x1000200c + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_WRITE_CNT|NDMA_WRITE_CNT]](n)&lt;br /&gt;
|  0x10002010 + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_BLOCK_CNT|NDMA_BLOCK_CNT]](n)&lt;br /&gt;
|  0x10002014 + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_FILL_DATA|NDMA_FILL_DATA]](n)&lt;br /&gt;
|  0x10002018 + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  [[#NDMA_CNT|NDMA_CNT]](n)&lt;br /&gt;
|  0x1000201C + (n*0x1c)&lt;br /&gt;
|  4&lt;br /&gt;
|  Boot9, Kernel9&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_GLOBAL_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  0&lt;br /&gt;
|  Global enable?&lt;br /&gt;
|-&lt;br /&gt;
|  19-16&lt;br /&gt;
|  Cycle selection.&lt;br /&gt;
|-&lt;br /&gt;
|  31&lt;br /&gt;
|  DMA arbitration method. 0=Fixed method, 1=Round robin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_SRC_ADDR ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  31-0&lt;br /&gt;
|  Source data address. Must be multiple of 4.&lt;br /&gt;
|}&lt;br /&gt;
Like old DMA, NDMA_SRC_ADDR is copied to internal registers when written to.&lt;br /&gt;
&lt;br /&gt;
== NDMA_DST_ADDR ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  BIT&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  31-0&lt;br /&gt;
|  Destination data address. Must be multiple of 4.&lt;br /&gt;
|}&lt;br /&gt;
Like old DMA, NDMA_DST_ADDR is copied to internal registers when written to.&lt;br /&gt;
&lt;br /&gt;
== NDMA_TRANSFER_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  27-0&lt;br /&gt;
|  Total number of words transferred.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_WRITE_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  23-0&lt;br /&gt;
|  Number of words to transfer.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_BLOCK_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  15-0&lt;br /&gt;
|  Interval timer.&lt;br /&gt;
|-&lt;br /&gt;
|  17-16&lt;br /&gt;
|  Prescaler. 0=System freq, 1=1/4th freq, 2=1/16th freq, 3=1/64th freq.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_FILL_DATA ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  31-0&lt;br /&gt;
|  Fill data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NDMA_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  11-10&lt;br /&gt;
|  Destination address update method. 0=Increment, 1=Decrement, 2=Fixed.&lt;br /&gt;
|-&lt;br /&gt;
|  12&lt;br /&gt;
|  Destination address reload flag.&lt;br /&gt;
|-&lt;br /&gt;
|  14-13&lt;br /&gt;
|  Source address update method. 0=Increment, 1=Decrement, 2=Fixed, 3=No address (for filling)&lt;br /&gt;
|-&lt;br /&gt;
|  15&lt;br /&gt;
|  Source address reload flag.&lt;br /&gt;
|-&lt;br /&gt;
|  19-16&lt;br /&gt;
|  Block transfer word count = (1&amp;lt;&amp;lt;x) words.&lt;br /&gt;
|-&lt;br /&gt;
|  27-24&lt;br /&gt;
|  Startup mode.&lt;br /&gt;
|-&lt;br /&gt;
|  28&lt;br /&gt;
|  Immediate mode.&lt;br /&gt;
|-&lt;br /&gt;
|  29&lt;br /&gt;
|  Repeating mode.&lt;br /&gt;
|-&lt;br /&gt;
|  30&lt;br /&gt;
|  IRQ enable&lt;br /&gt;
|-&lt;br /&gt;
|  31&lt;br /&gt;
|  Enable/busy flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Startup modes (27-24) ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| TIMER0?&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| TIMER1?&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| TIMER2?&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| TIMER3?&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| CTRCARD0&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| CTRCARD1&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| EMMC&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| AES WD FREE&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| AES RD FREE&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| SHA&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| AES + SHA COMBINED?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Block transfers ==&lt;br /&gt;
First, a word is always 32 bits. Second, the block transfer specified in NDMA_CNT is the smallest atom of data that will be transferred in a burst. The bus is monopolized until this block is transferred, without splitting up.&lt;br /&gt;
&lt;br /&gt;
The next block transfer will happen after the specified time in the NDMA_BLOCK_CNT interval timer, until done.&lt;br /&gt;
&lt;br /&gt;
== Immediate mode ==&lt;br /&gt;
Transfers the words specified in NDMA_WRITE_CNT immediately following block transfer rules. NDMA_TRANSFER_CNT and repeating mode are ignored.&lt;br /&gt;
&lt;br /&gt;
== Repeating mode ==&lt;br /&gt;
Transfers the words specified in NDMA_WRITE_CNT following the startup mode event. NDMA_TRANSFER_CNT is ignored.&lt;br /&gt;
&lt;br /&gt;
== No immediate and no repeating mode ==&lt;br /&gt;
Transfers the words specified in NDMA_WRITE_CNT for each startup event, and gets disabled when the total number of words in NDMA_TRANSFER_CNT are transferred.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20021</id>
		<title>Bootloader</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20021"/>
		<updated>2017-05-21T02:03:40Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Fix typo.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bootloader is the binary code stored in the ARM9 and ARM11 boot ROMs and hence is ran when the 3DS is powered on. It&#039;s purpose is initializing hardware and loading the [[FIRM|system firmware]] from the internal [[Flash_Filesystem|NAND memory]].&lt;br /&gt;
&lt;br /&gt;
Besides NATIVE_FIRM, the bootloader is also capable of booting other firmwares (such as TWL_FIRM and AGB_FIRM). However, this will result either in a japanese error-screen or a system shutdown, directly after FIRM-Launching.&lt;br /&gt;
&lt;br /&gt;
== Boot ROM ==&lt;br /&gt;
Upon boot, parts of the ARM9 and ARM11 boot ROMs are protected by writing to [[CONFIG#CFG_SYSPROT9|CFG_SYSPROT9]] and [[CONFIG#CFG_SYSPROT11|CFG_SYSPROT11]], respectively. The ARM9 and ARM11 boot ROMs are identical for all Old 3DS, 2DS and New 3DS consoles.&lt;br /&gt;
&lt;br /&gt;
== NAND FIRM boot ==&lt;br /&gt;
Boot9 is not hard-coded to only handle 2 FIRM partitions: it parses all 8 NCSD partitions for this. Boot9 will attempt to use every partition listed in the NCSD which is an actual FIRM partition, in the same order listed in the NCSD, until booting one of them succeeds. Among the not-yet-processed partitions, the FIRM which has the highest value at u32 firmhdr+4 will have a FIRM-boot attempted first. Since that value is normally 0x0, the order of FIRM-partition processing is normally identical to the order of the NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
Boot9 is hard-coded for using [[AES_Registers|AES]] keyslot 0x6 for NAND crypto.&lt;br /&gt;
&lt;br /&gt;
== Non-NAND FIRM boot ==&lt;br /&gt;
Boot9 can also boot from non-NAND. For this a different set of RSA pubks are used(separate pubks for retail/devunit like NAND). The spiflash FIRM image for this is also encrypted with AES-CBC using a normalkey stored in prot_boot9(separate for retail/devunit). This encryption is basically used instead of what is used for NAND-firm-partitions. This encryption is only used for the FIRM sections, the FIRM header is used raw. The AES keyslot for this is only overwritten afterwards when booting from non-NAND fails. AES keyslot 0x3F is used for this.&lt;br /&gt;
&lt;br /&gt;
  CTR_word[0] = firmimageoffset;//FIRM section offset from FIRM header&lt;br /&gt;
  CTR_word[1] = outbufaddr;//FIRM section load addr&lt;br /&gt;
  CTR_word[2] = readsize;//FIRM section size&lt;br /&gt;
  CTR_word[3] = readsize;//FIRM section size&lt;br /&gt;
&lt;br /&gt;
When booting from NAND fails, boot9 will then attempt to boot from Wifi SPI-flash(this only triggers when the wifi module hw is properly accessible/connected, which is normally the case). The base offset for spiflash FIRM is 0x400. Note that this region(all data prior to offset 0x1F300) is write-protected by the spiflash(not writable from 3DS-mode / DS-mode).&lt;br /&gt;
&lt;br /&gt;
Additionally, if the shell is closed and a special key combination (Start + Select + X) is held, boot9 will attempt to boot from an inserted NTR cartridge before booting from NAND. Note: While normally on O3DS/2DS the console will not turn on if the shell is closed (or this is faked by holding a magnet to the console), when this special key combination is held holding down the power button will cause boot to occur anyway.&lt;br /&gt;
&lt;br /&gt;
For non-NAND booting, NCSD / FIRM-backup is not used.&lt;br /&gt;
&lt;br /&gt;
== SDMMC ==&lt;br /&gt;
&lt;br /&gt;
Boot9 has code implemented for using SD(HC) cards, but the input deviceids used by boot9 for those functions are hard-coded for NAND. However, it is possible to use an SD(HC) card in place of the NAND if the NAND chip is first disconnected, and a SD card connected to the bus. Due to the CID being different, partitions will need to be re-encrypted and TWL mode will not work, due to the MBR being in the NCSD header. Using sighax, it may be possible to replace the NCSD header.&lt;br /&gt;
&lt;br /&gt;
== Boot9 RSA keyslots ==&lt;br /&gt;
&lt;br /&gt;
The following are initialized during main() startup, by initialize_rsakeyslots_pubk(). Each of these, for the ones which are actually set, have different keydata for retail/devunit.&lt;br /&gt;
* 0: Not set.&lt;br /&gt;
* 1: Used for the NAND FIRM signature.&lt;br /&gt;
* 2: Used for the non-NAND-FIRM signature.&lt;br /&gt;
* 3: Used for the NAND-NCSD FIRM signature.&lt;br /&gt;
&lt;br /&gt;
When FIRM loading is successful, initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk() is called, right before calling the final function in main(). Besides ITCM writing, this overwrites all 4 RSA keyslots with modulus + private-exponents loaded from boot9 data.&lt;br /&gt;
&lt;br /&gt;
initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk():&lt;br /&gt;
This initializes the 4 0x100-byte/0x200-byte chunks at 0x07ffb800+0x500(0x07ffbd00)/0x07ffb800+0x900(0x07ffc100). End address of the first section is 0x07ffc100(start addr of the second section), end address of the second section is 0x07ffc900. Hence, the first section total size is 0x400-bytes, while the second section total size is 0x800-bytes.&lt;br /&gt;
&lt;br /&gt;
These are initialized using via the boot9 data image, with ptrs from DTCM. Seperate keydata is used for retail/devunit.&lt;br /&gt;
&lt;br /&gt;
When initializing the first ITCM area: rsa_setkeyslot_privk() is called for all 4 RSA keyslots. The modulo for each one is also copied to (index*0x100) + 0x07ffb800 + 0x500. The private exponent is not copied into ITCM.&lt;br /&gt;
&lt;br /&gt;
The second ITCM area is initialized by copying 4 0x200-byte entries in a loop. These are RSA pubks+privks, which Boot9 doesn&#039;t use itself at all besides this copy loop.&lt;br /&gt;
&lt;br /&gt;
== Boot9 image data memory layout ==&lt;br /&gt;
0xffffb088 is the beginning of the boot9 image data section.&lt;br /&gt;
&lt;br /&gt;
* 0xffffb088 size 0x38-bytes: This is the array used during FIRM-section-loading for the memory-range blacklist for FIRM sections.&lt;br /&gt;
* 0xffffb0c0(end-addr of the above area) size 0x20-bytes: Unknown.&lt;br /&gt;
* 0xffffb0e0(end-addr of the above area) size 0x2f80-bytes: This is *all* of the keys stored in the image.&lt;br /&gt;
* 0xffffe060(end addr of the above key-area) size 0x230-bytes: This is the initial DTCM image @ 0xFFF00000, see below.&lt;br /&gt;
* 0xffffe290(DTCM_image_end) - {boot9 image end}: All-zero.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2f80-byte key-area at 0xffffb0e0:&lt;br /&gt;
* 0xffffb0e0 size 0x2600-bytes: This is the RSA key-data, see below.&lt;br /&gt;
* 0xffffd6e0(end-addr of the above area) size 0x40-bytes: This is the keydata used for crypting the entire OTP with keyslot 0x3f, used by main(). The first 0x20-bytes is for retail, the remaining 0x20-bytes starting at 0xffffd700 is for devunit. Chunk+0(retail=0xffffd6e0 devunit=0xffffd700) is the normalkey, chunk+0x10(retail=0xffffd6f0 devunit=0xffffd710) is the AES-IV.&lt;br /&gt;
* ...&lt;br /&gt;
* 0xffffd760: size 0x100-bytes: First 0x80-bytes is for retail, the remaining 0x80-bytes at 0xffffd7e0 is for devunit. This 0x80-byte block is copied to 0x07ffcd00 by a Boot9 function, however that code actually does the copy in two 0x40-bytes chunks.&lt;br /&gt;
* 0xffffd860(end-addr of the above area) size 0x400-bytes: This is the bootrom_dataptr passed to the aes-keyinit function for retail. See the below Tools section for how this is processed.&lt;br /&gt;
* 0xffffdc60(end-addr of the above area) size 0x400-bytes: This is the devunit version of the above the 0x400-byte chunk. This is very last chunk of data in the boot9 data-section key-area: end addr for this area is 0xffffe060.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2600-byte RSA key-data at 0xffffb0e0:  &lt;br /&gt;
First 0x1300-bytes is for retail, the remaining 0x1300-bytes starting at 0xffffc3e0 is for devunit.&lt;br /&gt;
* +0x0 retail=0xffffb0e0 devunit=0xffffc3e0: RSA modulo for keyslot3, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x100 retail=0xffffb1e0 devunit=0xffffc4e0: RSA modulo for keyslot1, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x200 retail=0xffffb2e0 devunit=0xffffc5e0: RSA modulo for keyslot2, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x300 size 0x200, retail=0xffffb3e0 devunit=0xffffc6e0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). This is for RSA-engine keyslot0 with initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), which also copies this modulo to the array starting at 0x07ffbd00.&lt;br /&gt;
* +0x500 size 0x200, retail=0xffffb5e0 devunit=0xffffc8e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0x700 size 0x200, retail=0xffffb7e0 devunit=0xffffcae0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x900 size 0x200, retail=0xffffb9e0 devunit=0xffffcce0: Used the same as the above block except for slot3.&lt;br /&gt;
* +0xb00 size 0x200, retail=0xffffbbe0 devunit=0xffffcee0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). The 0x200-bytes here is copied to slot0 in the array at 0x07ffc100 by initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk().&lt;br /&gt;
* +0xd00 size 0x200, retail=0xffffbde0 devunit=0xffffd0e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0xf00 size 0x200, retail=0xffffbfe0 devunit=0xffffd2e0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x1100 size 0x200, retail=0xffffc1e0 devunit=0xffffd4e0: Used the same as the above block except for slot3.&lt;br /&gt;
&lt;br /&gt;
== Boot9 DTCM layout ==&lt;br /&gt;
Most of this is just ptrs / other unknown data, not actual keys. However, there is an unknown 0x10-byte block @ +0x124(there&#039;s a ptr initialized for this block elsewhere).&lt;br /&gt;
&lt;br /&gt;
== Boot11 image data memory layout ==&lt;br /&gt;
0x0001817c..0x000181f4 size 0x78-bytes: This seems to be the bootrom error screen font gfx data. This begins at the exact end-address of the crt0 code, the rest of the protected boot11 code begins at this end-address(0x000181f4).  &lt;br /&gt;
&lt;br /&gt;
0x00019400 is the beginning of the boot11 data area, the first 8-bytes here are unknown.&lt;br /&gt;
* 0x00019408..0x0001b498 size 0x2090-bytes: This is the blowfish keydata which gets copied to arm9itcm_twlkeydata+0x3e0 later.&lt;br /&gt;
* ...&lt;br /&gt;
* 0x0001c498..0x0001c4f8 size 0x60-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x380.&lt;br /&gt;
* 0x0001c4f8..0x0001c538 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x340.&lt;br /&gt;
* 0x0001c538..0x0001c578 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x300.&lt;br /&gt;
* 0x0001c578..0x0001c5f8 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x280.&lt;br /&gt;
* 0x0001c5f8..0x0001c678 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x0.&lt;br /&gt;
* 0x0001c678..0x0001c878 size 0x200-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x80.&lt;br /&gt;
* 0x0001c878..0x0001d078 size 0x800-bytes: These are the 3DS RSA-2048 modulus which are eventually copied to arm9_itcm+0x4900: on retail the first 4 are copied there by boot9, on devunit the last 4 are copied to itcm.&lt;br /&gt;
* 0x0001d078 size 0x120-bytes is the initial data for the .data section @ 0x1ffe8000, this is the very end of the protected arm11-bootrom.&lt;br /&gt;
&lt;br /&gt;
== AES keys ==&lt;br /&gt;
See the Tools section for how Boot9 initializes the keyslots.&lt;br /&gt;
&lt;br /&gt;
See also [[AES_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
For an issue with console-unique key-init, see [[OTP_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
== BootROM Errors ==&lt;br /&gt;
Sample error-screen(where firm0+firm1 RSA signatures were corrupted):&lt;br /&gt;
&lt;br /&gt;
  BOOTROM 8046&lt;br /&gt;
  ERRCODE: 00F800FF&lt;br /&gt;
  DEDEFFFF FFFFFFFF&lt;br /&gt;
  00000000 00000000&lt;br /&gt;
&lt;br /&gt;
* 1st line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;BOOTROM %X&amp;quot;, 0x8046);//This last param comes from the .pool.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2nd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;ERRCODE:    %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0xC)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 3rd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0x10))`, `*((unsigned int*)(0x1fffe000+0x14)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 4th line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;,*((unsigned int*)(0x1FFFE000+0x18))`, `*((unsigned int*)(0x1fffe000+0x1C)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0x1FFFE000 memory ==&lt;br /&gt;
This memory is used by boot9 mainly for sending info to the arm11 for the error-screen. The data in this region is still stored in memory by the time the ARM9+ARM11 jumps to FIRM.&lt;br /&gt;
&lt;br /&gt;
Among boot9/boot11, the 3 words at 0x1FFFE000 seem to be &#039;&#039;only&#039;&#039; accessed by the boot11 function initializing those words.&lt;br /&gt;
&lt;br /&gt;
* u32 0x1FFFE000+0: ARM11 MPCore &amp;quot;Cycle Counter Register (CCNT)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+4: ARM11 MPCore &amp;quot;Count Register 0 (PMN0)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+8: ARM11 MPCore &amp;quot;Count Register 1 (PMN0)&amp;quot;.&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0xC: 8bit status-codes initialized by boot9 main(), for the FIRM-boot devices. +0 is NAND and +2 is wifi-spiflash.&lt;br /&gt;
* ...&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0x10: Status-codes originally from nand_findfirmpartition_loadfirm(), for each of the 8 NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
== BootROM Status Codes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| 0xEE(~17)&lt;br /&gt;
| NCSD header validation function failed: NCSD magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDE(~33)&lt;br /&gt;
| FIRM header validation function failed: FIRM magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF(~32)&lt;br /&gt;
| Failed to read sector data from the device.&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF(~48)&lt;br /&gt;
| FIRM section validation function failed: FIRM section is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7(~8)&lt;br /&gt;
| A NAND FIRM from another partition was already found with a priority(firmhdr+4) &amp;gt;= to the value for the current partition&#039;s FIRM priority.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8(~7)&lt;br /&gt;
| The FIRM magicnum(firmhdr+0) is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF(~0)&lt;br /&gt;
| Initial value for each entry in the 8-entry array of status-codes for the NAND NCSD partitions. Indicates that the partition is not a FIRM partition(partition fs type isn&#039;t 0x3 or partition fs crypt-type isn&#039;t 0x2).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Boot9 startup ==&lt;br /&gt;
&lt;br /&gt;
0xffff0000 jumps to 0xffff8000. 0xffff8000 is crt0:&lt;br /&gt;
* Very first thing this does is clear u8 register 0x10000002 ([[CONFIG_Registers#CFG_RST11|CFG_RST11]]) bit 0 to zero.&lt;br /&gt;
* Then sp is initialized for each cpumode, IRQs/FIQs are disabled during the first mode-switch.&lt;br /&gt;
* Order of mode-switches + sp initialization: svc-mode = 0xfff04000, irq-mode = 0xfff03f00, system-mode = 0xfff03b00. Hence, the rest of the code following this runs in system-mode.&lt;br /&gt;
* Then L_ffff80cc/mpu_init() is called.&lt;br /&gt;
* Then L_ffff0038() is called, which initializes the exception-handler addresses @ 0x08000000.&lt;br /&gt;
* Then L_ffff81b8() is called(r4 + lr are saved on the DTCM stack), which after calling a memclear function which doesn&#039;t do anything, it then clears 0x08000030 size 0x10. Here the DTCM at 0xfff00000 size 0x4000 is cleared.&lt;br /&gt;
* Then L_ffff81b4() is called, which branches to DTCM_init(). This copies the initial DTCM data from the Boot9 data image into boot9, then it clears 0xFFF00230 - 0xFFF01AC0.&lt;br /&gt;
* Then LT_ffff8228/main is jumped to, with LR set to the address of an infinite-branch-loop instruction.&lt;br /&gt;
&lt;br /&gt;
mpu_init():&lt;br /&gt;
* Bitmask 0x000f9005 is cleared in the cp15 control register. MCR instructions which do then following are then executed: flush entire instruction cache, flush entire data cache, and drain write buffer.&lt;br /&gt;
* Then the 8 [[Memory_layout|MPU]] memregions are initialized.&lt;br /&gt;
* ITCM memregion reg = 0x24: baseaddr=0x0, size = 128MB(0x08000000).&lt;br /&gt;
* DTCM memregion reg = 0xfff0000a: baseaddr=0xfff00000, size=16KB(0x00004000).&lt;br /&gt;
* Then instruction cachable and data cachable/bufferable bits for the MPU regions are setup.&lt;br /&gt;
* Then the instruction/data access permissions for the MPU regions are setup.&lt;br /&gt;
* Lastly bitmask 0x0005707d is orred in the cp15 control register.&lt;br /&gt;
&lt;br /&gt;
== Boot9 main() ==&lt;br /&gt;
&lt;br /&gt;
  The following functions are called: LT_ffff2024(), LT_ffff1ff8(), pxi_init(), rsa_init(), initialize_rsakeyslots_pubk(), crypto_initialize(), and aesengine_reset().&lt;br /&gt;
  Then AES keyslot 0x3F is setup: aesengine_setnormalkey(0x3f, 5, ptr) is called. ptr on retail(CFG_UNITINFO check) is 0xffffd6e0, 0xffffd700 for devunit. Then essentially, aesengine_setctr(5, ptr+0x10) is executed.&lt;br /&gt;
  Then AES keyslot 0x3f is selected.&lt;br /&gt;
  When calling the following functions, if any of them return zero, it will immediately jump to setting ptr to 0x10012000(otp), otherwise when all of them return non-zero ptr = sp+0x94. otp_decrypt(sp+4), otp_verify(sp+4), initialize_consoleunique_itcm(sp+4, 0x07ffb800).&lt;br /&gt;
  Then the following is executed: initialize_aeskeys_wrap(ptr, 0x70);&lt;br /&gt;
  Then sp+4 size 0x100 is cleared to zero.&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  NAND firm-boot code-block, is described below. Note that boot9 is basically hard-coded to use deviceid NAND, not SD.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called, then the AES keyslot for NAND-FIRM is selected(0x6).&lt;br /&gt;
  	Then LT_ffff56c8() is called, if that returns non-zero the statuscode variable is set to ~2 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then LT_ffff5774(0x201) is called, if that returns non-zero the statuscode variable is set to ~1 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_mmc() is called. Then nand_findfirmpartition_loadfirm(0) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  	Executes a loop which runs 8 times: write the output from get_errorcode_arrayentry_xfff005e8(loopindex) to u8 0x1fffe000+0x10+loopindex(copy the array of 32bit error-codes for all 8 NCSD partitions initialized by nand_findfirmpartition_loadfirm() to the array of 8bit entries at 0x1fffe000+0x10).&lt;br /&gt;
  &lt;br /&gt;
  	NAND_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xc.&lt;br /&gt;
  	Then LT_ffff5690(0x201, 0x1fffe018, 0x1fffe01c) is called.&lt;br /&gt;
  	Then LT_ffff5644() is called.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it continues to the next code-block.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Wifi spi-flash firm-boot code-block, executed when no FIRM was loaded successfully so far.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called.&lt;br /&gt;
  &lt;br /&gt;
  	Then spi_wififlash_cmdgetstatusreg(sp+0x100) is executed. When bit0 of the output u8 at sp+0x100 is clear, it will continue this code-block, otherwise it will set the statuscode variable to ~1 then jump to SPIFLASH_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_wififlash() is called.&lt;br /&gt;
  	Here read_firmhdr_validate_loadfirm(0, 2) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  &lt;br /&gt;
  	SPIFLASH_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xe.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it executes writenormalkey_keyslot3f(), then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_END:&lt;br /&gt;
  Here it calls firmhdr_getarm11_entrypoint() and firmhdr_getarm9_entrypoint(). Immediately after calling each function it checks if the retval is 0, if so it then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  After calling initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), it jumps to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_FAILURE:&lt;br /&gt;
  Here it clears 0x07ffb800 size 0x3c70 to zero, endaddr = 0x07fff470.&lt;br /&gt;
  Then it continues to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_EXIT:&lt;br /&gt;
  Here firmboot() is called, which should never return. The instruction after this bl is a call for panic().&lt;br /&gt;
&lt;br /&gt;
== Boot11 ==&lt;br /&gt;
&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
main():&lt;br /&gt;
  LT_1263c();&lt;br /&gt;
  ...&lt;br /&gt;
  LT_13944()&lt;br /&gt;
  ...&lt;br /&gt;
  pxi_init();&lt;br /&gt;
  initializefuncptr_firmboot_start(firmbootbegin_funcptr);&lt;br /&gt;
  firmboot();&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
LT_12220/initializefuncptr_firmboot_start&lt;br /&gt;
  inr0=funcptr&lt;br /&gt;
  This writes inr0 to address 0x1ffe8028, then returns.&lt;br /&gt;
  This initializes the funcptr which firmboot() can call after the very first func-call.&lt;br /&gt;
&lt;br /&gt;
LT_13944&lt;br /&gt;
  if([[I2C_Registers|i2cmcu_readregf]](sp+0)==0)&lt;br /&gt;
  {&lt;br /&gt;
  	return (*((u8*)0x10147000) &amp;gt;&amp;gt; 4) &amp;amp; 1;//Reads [[GPIO_Registers|GPIO]] when reading I2C fails.&lt;br /&gt;
  }&lt;br /&gt;
  Here it basically does &amp;quot;return &amp;lt;byte loaded from sp+0&amp;gt; ^ 0x2&amp;quot;. Hence in this case, it will return 0x2 when the system shell is closed(sleep-mode), otherwise 0x0 is returned.&lt;br /&gt;
&lt;br /&gt;
LT_12454/firmboot&lt;br /&gt;
  This is the arm11 version of the boot9 firmboot() function, like boot9 this is the final function called from main(). The functionality for these two functions are identical, minus addresses.&lt;br /&gt;
  ptr = firmboot_loadentrypoint11();&lt;br /&gt;
  funcptr = *(0x1ffe8028);&lt;br /&gt;
  if(funcptr)funcptr(ptr);&lt;br /&gt;
  LT_11ffc(ptr);&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
== Boot Procedure ==&lt;br /&gt;
&lt;br /&gt;
* 0 seconds - unit is powered on. The ARM9 and ARM11 [[Memory_layout|bootroms]] begin execution.&lt;br /&gt;
* &amp;lt;= ~1 second - BootROMs fully run, load FIRM, etc. The loaded FIRM begins running.&lt;br /&gt;
**The ARM11 sysmodules included with FIRM are launched by ARM11-kernel, etc.&lt;br /&gt;
**The [[Process_Manager_Services|PM]] module launches [[NS]].&lt;br /&gt;
**If [[Home_Menu#Auto-Boot_Function|auto-booting]] is needed, NS will [[NS#Auto-boot|auto-boot]] titles.&lt;br /&gt;
**Otherwise, NS will instead launch [[ErrDisp]] and the [[Configuration Memory#ACTIVEMENUTID|current active menu]] via the PM module. For retail units, this menu is usually the [[Home Menu]]. Note that the PM module first launches the module dependencies when launching a process, prior to actually launching the process.&lt;br /&gt;
**The further Home Menu startup process is described [[Home_Menu#Home_Menu_startup|here]]. This includes Home Menu manually launching various sysmodules.&lt;br /&gt;
&lt;br /&gt;
* 4 seconds - the LCD screens are initialized.&lt;br /&gt;
&lt;br /&gt;
* 7 seconds - [[Home Menu]] is fully initialized/loaded.&lt;br /&gt;
&lt;br /&gt;
== NAND Reads during Boot ==&lt;br /&gt;
During a successful boot on 6.x, the bootloader (and firm) reads the following sectors from NAND (in this order):&lt;br /&gt;
 00000000 (NCSD Partition Table)&lt;br /&gt;
 &lt;br /&gt;
 Only verify &#039;FIRM&#039; magic? (A second Header-read will be attempted even if everything except the magic is 0xFF...)&lt;br /&gt;
 0B130000 (FIRM Partition)&lt;br /&gt;
 0B530000 (Secondary FIRM Partition)&lt;br /&gt;
 &lt;br /&gt;
 Verify RSA signature and parse Header:&lt;br /&gt;
 0B130000 (FIRM: Header)&lt;br /&gt;
 0B130200 (FIRM: Section 1)&lt;br /&gt;
 0B163E00 (FIRM: Section 2)&lt;br /&gt;
 0B193E00 (FIRM: Section 3)&lt;br /&gt;
 &lt;br /&gt;
 00013000 .. Below is probably NATIVE_FIRM booting ..&lt;br /&gt;
 00014000&lt;br /&gt;
 00015000&lt;br /&gt;
 00016000&lt;br /&gt;
 00017000&lt;br /&gt;
 &lt;br /&gt;
 09011A00&lt;br /&gt;
 09011C00&lt;br /&gt;
 09012000&lt;br /&gt;
 09012400&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Error Codes ==&lt;br /&gt;
When the 3DS does not find the NAND chip, the following error is displayed:&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Bootrom_Error.jpg|240px]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Error&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000200 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Error when having SD-card reader connected to NAND during boot.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000400 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND not found error (?)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000080 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT1 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT2 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT3 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FF F8F8FFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Both the firm0 and firm1 partitions are corrupt (failed signature checks).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800EE FFFFFFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| [[NCSD]] header in sector 0 is corrupt (failed signature check).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
* [https://github.com/yellows8/boot9_tools boot9_tools]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20020</id>
		<title>Bootloader</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20020"/>
		<updated>2017-05-21T00:05:53Z</updated>

		<summary type="html">&lt;p&gt;SciresM: NTR Cart note under NON-NAND FIRM, note about the key combination enabling boot.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bootloader is the binary code stored in the ARM9 and ARM11 boot ROMs and hence is ran when the 3DS is powered on. It&#039;s purpose is initializing hardware and loading the [[FIRM|system firmware]] from the internal [[Flash_Filesystem|NAND memory]].&lt;br /&gt;
&lt;br /&gt;
Besides NATIVE_FIRM, the bootloader is also capable of booting other firmwares (such as TWL_FIRM and AGB_FIRM). However, this will result either in a japanese error-screen or a system shutdown, directly after FIRM-Launching.&lt;br /&gt;
&lt;br /&gt;
== Boot ROM ==&lt;br /&gt;
Upon boot, parts of the ARM9 and ARM11 boot ROMs are protected by writing to [[CONFIG#CFG_SYSPROT9|CFG_SYSPROT9]] and [[CONFIG#CFG_SYSPROT11|CFG_SYSPROT11]], respectively. The ARM9 and ARM11 boot ROMs are identical for all Old 3DS, 2DS and New 3DS consoles.&lt;br /&gt;
&lt;br /&gt;
== NAND FIRM boot ==&lt;br /&gt;
Boot9 is not hard-coded to only handle 2 FIRM partitions: it parses all 8 NCSD partitions for this. Boot9 will attempt to use every partition listed in the NCSD which is an actual FIRM partition, in the same order listed in the NCSD, until booting one of them succeeds. Among the not-yet-processed partitions, the FIRM which has the highest value at u32 firmhdr+4 will have a FIRM-boot attempted first. Since that value is normally 0x0, the order of FIRM-partition processing is normally identical to the order of the NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
Boot9 is hard-coded for using [[AES_Registers|AES]] keyslot 0x6 for NAND crypto.&lt;br /&gt;
&lt;br /&gt;
== Non-NAND FIRM boot ==&lt;br /&gt;
Boot9 can also boot from non-NAND. For this a different set of RSA pubks are used(separate pubks for retail/devunit like NAND). The spiflash FIRM image for this is also encrypted with AES-CBC using a normalkey stored in prot_boot9(separate for retail/devunit). This encryption is basically used instead of what is used for NAND-firm-partitions. This encryption is only used for the FIRM sections, the FIRM header is used raw. The AES keyslot for this is only overwritten afterwards when booting from non-NAND fails. AES keyslot 0x3F is used for this.&lt;br /&gt;
&lt;br /&gt;
  CTR_word[0] = firmimageoffset;//FIRM section offset from FIRM header&lt;br /&gt;
  CTR_word[1] = outbufaddr;//FIRM section load addr&lt;br /&gt;
  CTR_word[2] = readsize;//FIRM section size&lt;br /&gt;
  CTR_word[3] = readsize;//FIRM section size&lt;br /&gt;
&lt;br /&gt;
When booting from NAND fails, boot9 will then attempt to boot from Wifi SPI-flash(this only triggers when the wifi module hw is properly accessible/connected, which is normally the case). The base offset for spiflash FIRM is 0x400. Note that this region(all data prior to offset 0x1F300) is write-protected by the spiflash(not writable from 3DS-mode / DS-mode).&lt;br /&gt;
&lt;br /&gt;
Additionally, if the shell is closed and a special key combination (Start + Select + X) is held, boot9 will attempt to boot from an inserted NTR cartridge before bootring from NAND. Note: While normally on o3ds/2ds the console will not turn on if the shell is closed (or this is faked by holding a magnet to the console), when this special key combination is held holding down the power button will cause boot to occur anyway.&lt;br /&gt;
&lt;br /&gt;
For non-NAND booting, NCSD / FIRM-backup is not used.&lt;br /&gt;
&lt;br /&gt;
== SDMMC ==&lt;br /&gt;
&lt;br /&gt;
Boot9 has code implemented for using SD(HC) cards, but the input deviceids used by boot9 for those functions are hard-coded for NAND. However, it is possible to use an SD(HC) card in place of the NAND if the NAND chip is first disconnected, and a SD card connected to the bus. Due to the CID being different, partitions will need to be re-encrypted and TWL mode will not work, due to the MBR being in the NCSD header. Using sighax, it may be possible to replace the NCSD header.&lt;br /&gt;
&lt;br /&gt;
== Boot9 RSA keyslots ==&lt;br /&gt;
&lt;br /&gt;
The following are initialized during main() startup, by initialize_rsakeyslots_pubk(). Each of these, for the ones which are actually set, have different keydata for retail/devunit.&lt;br /&gt;
* 0: Not set.&lt;br /&gt;
* 1: Used for the NAND FIRM signature.&lt;br /&gt;
* 2: Used for the non-NAND-FIRM signature.&lt;br /&gt;
* 3: Used for the NAND-NCSD FIRM signature.&lt;br /&gt;
&lt;br /&gt;
When FIRM loading is successful, initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk() is called, right before calling the final function in main(). Besides ITCM writing, this overwrites all 4 RSA keyslots with modulus + private-exponents loaded from boot9 data.&lt;br /&gt;
&lt;br /&gt;
initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk():&lt;br /&gt;
This initializes the 4 0x100-byte/0x200-byte chunks at 0x07ffb800+0x500(0x07ffbd00)/0x07ffb800+0x900(0x07ffc100). End address of the first section is 0x07ffc100(start addr of the second section), end address of the second section is 0x07ffc900. Hence, the first section total size is 0x400-bytes, while the second section total size is 0x800-bytes.&lt;br /&gt;
&lt;br /&gt;
These are initialized using via the boot9 data image, with ptrs from DTCM. Seperate keydata is used for retail/devunit.&lt;br /&gt;
&lt;br /&gt;
When initializing the first ITCM area: rsa_setkeyslot_privk() is called for all 4 RSA keyslots. The modulo for each one is also copied to (index*0x100) + 0x07ffb800 + 0x500. The private exponent is not copied into ITCM.&lt;br /&gt;
&lt;br /&gt;
The second ITCM area is initialized by copying 4 0x200-byte entries in a loop. These are RSA pubks+privks, which Boot9 doesn&#039;t use itself at all besides this copy loop.&lt;br /&gt;
&lt;br /&gt;
== Boot9 image data memory layout ==&lt;br /&gt;
0xffffb088 is the beginning of the boot9 image data section.&lt;br /&gt;
&lt;br /&gt;
* 0xffffb088 size 0x38-bytes: This is the array used during FIRM-section-loading for the memory-range blacklist for FIRM sections.&lt;br /&gt;
* 0xffffb0c0(end-addr of the above area) size 0x20-bytes: Unknown.&lt;br /&gt;
* 0xffffb0e0(end-addr of the above area) size 0x2f80-bytes: This is *all* of the keys stored in the image.&lt;br /&gt;
* 0xffffe060(end addr of the above key-area) size 0x230-bytes: This is the initial DTCM image @ 0xFFF00000, see below.&lt;br /&gt;
* 0xffffe290(DTCM_image_end) - {boot9 image end}: All-zero.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2f80-byte key-area at 0xffffb0e0:&lt;br /&gt;
* 0xffffb0e0 size 0x2600-bytes: This is the RSA key-data, see below.&lt;br /&gt;
* 0xffffd6e0(end-addr of the above area) size 0x40-bytes: This is the keydata used for crypting the entire OTP with keyslot 0x3f, used by main(). The first 0x20-bytes is for retail, the remaining 0x20-bytes starting at 0xffffd700 is for devunit. Chunk+0(retail=0xffffd6e0 devunit=0xffffd700) is the normalkey, chunk+0x10(retail=0xffffd6f0 devunit=0xffffd710) is the AES-IV.&lt;br /&gt;
* ...&lt;br /&gt;
* 0xffffd760: size 0x100-bytes: First 0x80-bytes is for retail, the remaining 0x80-bytes at 0xffffd7e0 is for devunit. This 0x80-byte block is copied to 0x07ffcd00 by a Boot9 function, however that code actually does the copy in two 0x40-bytes chunks.&lt;br /&gt;
* 0xffffd860(end-addr of the above area) size 0x400-bytes: This is the bootrom_dataptr passed to the aes-keyinit function for retail. See the below Tools section for how this is processed.&lt;br /&gt;
* 0xffffdc60(end-addr of the above area) size 0x400-bytes: This is the devunit version of the above the 0x400-byte chunk. This is very last chunk of data in the boot9 data-section key-area: end addr for this area is 0xffffe060.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2600-byte RSA key-data at 0xffffb0e0:  &lt;br /&gt;
First 0x1300-bytes is for retail, the remaining 0x1300-bytes starting at 0xffffc3e0 is for devunit.&lt;br /&gt;
* +0x0 retail=0xffffb0e0 devunit=0xffffc3e0: RSA modulo for keyslot3, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x100 retail=0xffffb1e0 devunit=0xffffc4e0: RSA modulo for keyslot1, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x200 retail=0xffffb2e0 devunit=0xffffc5e0: RSA modulo for keyslot2, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x300 size 0x200, retail=0xffffb3e0 devunit=0xffffc6e0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). This is for RSA-engine keyslot0 with initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), which also copies this modulo to the array starting at 0x07ffbd00.&lt;br /&gt;
* +0x500 size 0x200, retail=0xffffb5e0 devunit=0xffffc8e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0x700 size 0x200, retail=0xffffb7e0 devunit=0xffffcae0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x900 size 0x200, retail=0xffffb9e0 devunit=0xffffcce0: Used the same as the above block except for slot3.&lt;br /&gt;
* +0xb00 size 0x200, retail=0xffffbbe0 devunit=0xffffcee0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). The 0x200-bytes here is copied to slot0 in the array at 0x07ffc100 by initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk().&lt;br /&gt;
* +0xd00 size 0x200, retail=0xffffbde0 devunit=0xffffd0e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0xf00 size 0x200, retail=0xffffbfe0 devunit=0xffffd2e0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x1100 size 0x200, retail=0xffffc1e0 devunit=0xffffd4e0: Used the same as the above block except for slot3.&lt;br /&gt;
&lt;br /&gt;
== Boot9 DTCM layout ==&lt;br /&gt;
Most of this is just ptrs / other unknown data, not actual keys. However, there is an unknown 0x10-byte block @ +0x124(there&#039;s a ptr initialized for this block elsewhere).&lt;br /&gt;
&lt;br /&gt;
== Boot11 image data memory layout ==&lt;br /&gt;
0x0001817c..0x000181f4 size 0x78-bytes: This seems to be the bootrom error screen font gfx data. This begins at the exact end-address of the crt0 code, the rest of the protected boot11 code begins at this end-address(0x000181f4).  &lt;br /&gt;
&lt;br /&gt;
0x00019400 is the beginning of the boot11 data area, the first 8-bytes here are unknown.&lt;br /&gt;
* 0x00019408..0x0001b498 size 0x2090-bytes: This is the blowfish keydata which gets copied to arm9itcm_twlkeydata+0x3e0 later.&lt;br /&gt;
* ...&lt;br /&gt;
* 0x0001c498..0x0001c4f8 size 0x60-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x380.&lt;br /&gt;
* 0x0001c4f8..0x0001c538 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x340.&lt;br /&gt;
* 0x0001c538..0x0001c578 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x300.&lt;br /&gt;
* 0x0001c578..0x0001c5f8 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x280.&lt;br /&gt;
* 0x0001c5f8..0x0001c678 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x0.&lt;br /&gt;
* 0x0001c678..0x0001c878 size 0x200-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x80.&lt;br /&gt;
* 0x0001c878..0x0001d078 size 0x800-bytes: These are the 3DS RSA-2048 modulus which are eventually copied to arm9_itcm+0x4900: on retail the first 4 are copied there by boot9, on devunit the last 4 are copied to itcm.&lt;br /&gt;
* 0x0001d078 size 0x120-bytes is the initial data for the .data section @ 0x1ffe8000, this is the very end of the protected arm11-bootrom.&lt;br /&gt;
&lt;br /&gt;
== AES keys ==&lt;br /&gt;
See the Tools section for how Boot9 initializes the keyslots.&lt;br /&gt;
&lt;br /&gt;
See also [[AES_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
For an issue with console-unique key-init, see [[OTP_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
== BootROM Errors ==&lt;br /&gt;
Sample error-screen(where firm0+firm1 RSA signatures were corrupted):&lt;br /&gt;
&lt;br /&gt;
  BOOTROM 8046&lt;br /&gt;
  ERRCODE: 00F800FF&lt;br /&gt;
  DEDEFFFF FFFFFFFF&lt;br /&gt;
  00000000 00000000&lt;br /&gt;
&lt;br /&gt;
* 1st line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;BOOTROM %X&amp;quot;, 0x8046);//This last param comes from the .pool.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2nd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;ERRCODE:    %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0xC)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 3rd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0x10))`, `*((unsigned int*)(0x1fffe000+0x14)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 4th line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;,*((unsigned int*)(0x1FFFE000+0x18))`, `*((unsigned int*)(0x1fffe000+0x1C)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0x1FFFE000 memory ==&lt;br /&gt;
This memory is used by boot9 mainly for sending info to the arm11 for the error-screen. The data in this region is still stored in memory by the time the ARM9+ARM11 jumps to FIRM.&lt;br /&gt;
&lt;br /&gt;
Among boot9/boot11, the 3 words at 0x1FFFE000 seem to be &#039;&#039;only&#039;&#039; accessed by the boot11 function initializing those words.&lt;br /&gt;
&lt;br /&gt;
* u32 0x1FFFE000+0: ARM11 MPCore &amp;quot;Cycle Counter Register (CCNT)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+4: ARM11 MPCore &amp;quot;Count Register 0 (PMN0)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+8: ARM11 MPCore &amp;quot;Count Register 1 (PMN0)&amp;quot;.&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0xC: 8bit status-codes initialized by boot9 main(), for the FIRM-boot devices. +0 is NAND and +2 is wifi-spiflash.&lt;br /&gt;
* ...&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0x10: Status-codes originally from nand_findfirmpartition_loadfirm(), for each of the 8 NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
== BootROM Status Codes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| 0xEE(~17)&lt;br /&gt;
| NCSD header validation function failed: NCSD magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDE(~33)&lt;br /&gt;
| FIRM header validation function failed: FIRM magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF(~32)&lt;br /&gt;
| Failed to read sector data from the device.&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF(~48)&lt;br /&gt;
| FIRM section validation function failed: FIRM section is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7(~8)&lt;br /&gt;
| A NAND FIRM from another partition was already found with a priority(firmhdr+4) &amp;gt;= to the value for the current partition&#039;s FIRM priority.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8(~7)&lt;br /&gt;
| The FIRM magicnum(firmhdr+0) is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF(~0)&lt;br /&gt;
| Initial value for each entry in the 8-entry array of status-codes for the NAND NCSD partitions. Indicates that the partition is not a FIRM partition(partition fs type isn&#039;t 0x3 or partition fs crypt-type isn&#039;t 0x2).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Boot9 startup ==&lt;br /&gt;
&lt;br /&gt;
0xffff0000 jumps to 0xffff8000. 0xffff8000 is crt0:&lt;br /&gt;
* Very first thing this does is clear u8 register 0x10000002 ([[CONFIG_Registers#CFG_RST11|CFG_RST11]]) bit 0 to zero.&lt;br /&gt;
* Then sp is initialized for each cpumode, IRQs/FIQs are disabled during the first mode-switch.&lt;br /&gt;
* Order of mode-switches + sp initialization: svc-mode = 0xfff04000, irq-mode = 0xfff03f00, system-mode = 0xfff03b00. Hence, the rest of the code following this runs in system-mode.&lt;br /&gt;
* Then L_ffff80cc/mpu_init() is called.&lt;br /&gt;
* Then L_ffff0038() is called, which initializes the exception-handler addresses @ 0x08000000.&lt;br /&gt;
* Then L_ffff81b8() is called(r4 + lr are saved on the DTCM stack), which after calling a memclear function which doesn&#039;t do anything, it then clears 0x08000030 size 0x10. Here the DTCM at 0xfff00000 size 0x4000 is cleared.&lt;br /&gt;
* Then L_ffff81b4() is called, which branches to DTCM_init(). This copies the initial DTCM data from the Boot9 data image into boot9, then it clears 0xFFF00230 - 0xFFF01AC0.&lt;br /&gt;
* Then LT_ffff8228/main is jumped to, with LR set to the address of an infinite-branch-loop instruction.&lt;br /&gt;
&lt;br /&gt;
mpu_init():&lt;br /&gt;
* Bitmask 0x000f9005 is cleared in the cp15 control register. MCR instructions which do then following are then executed: flush entire instruction cache, flush entire data cache, and drain write buffer.&lt;br /&gt;
* Then the 8 [[Memory_layout|MPU]] memregions are initialized.&lt;br /&gt;
* ITCM memregion reg = 0x24: baseaddr=0x0, size = 128MB(0x08000000).&lt;br /&gt;
* DTCM memregion reg = 0xfff0000a: baseaddr=0xfff00000, size=16KB(0x00004000).&lt;br /&gt;
* Then instruction cachable and data cachable/bufferable bits for the MPU regions are setup.&lt;br /&gt;
* Then the instruction/data access permissions for the MPU regions are setup.&lt;br /&gt;
* Lastly bitmask 0x0005707d is orred in the cp15 control register.&lt;br /&gt;
&lt;br /&gt;
== Boot9 main() ==&lt;br /&gt;
&lt;br /&gt;
  The following functions are called: LT_ffff2024(), LT_ffff1ff8(), pxi_init(), rsa_init(), initialize_rsakeyslots_pubk(), crypto_initialize(), and aesengine_reset().&lt;br /&gt;
  Then AES keyslot 0x3F is setup: aesengine_setnormalkey(0x3f, 5, ptr) is called. ptr on retail(CFG_UNITINFO check) is 0xffffd6e0, 0xffffd700 for devunit. Then essentially, aesengine_setctr(5, ptr+0x10) is executed.&lt;br /&gt;
  Then AES keyslot 0x3f is selected.&lt;br /&gt;
  When calling the following functions, if any of them return zero, it will immediately jump to setting ptr to 0x10012000(otp), otherwise when all of them return non-zero ptr = sp+0x94. otp_decrypt(sp+4), otp_verify(sp+4), initialize_consoleunique_itcm(sp+4, 0x07ffb800).&lt;br /&gt;
  Then the following is executed: initialize_aeskeys_wrap(ptr, 0x70);&lt;br /&gt;
  Then sp+4 size 0x100 is cleared to zero.&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  NAND firm-boot code-block, is described below. Note that boot9 is basically hard-coded to use deviceid NAND, not SD.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called, then the AES keyslot for NAND-FIRM is selected(0x6).&lt;br /&gt;
  	Then LT_ffff56c8() is called, if that returns non-zero the statuscode variable is set to ~2 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then LT_ffff5774(0x201) is called, if that returns non-zero the statuscode variable is set to ~1 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_mmc() is called. Then nand_findfirmpartition_loadfirm(0) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  	Executes a loop which runs 8 times: write the output from get_errorcode_arrayentry_xfff005e8(loopindex) to u8 0x1fffe000+0x10+loopindex(copy the array of 32bit error-codes for all 8 NCSD partitions initialized by nand_findfirmpartition_loadfirm() to the array of 8bit entries at 0x1fffe000+0x10).&lt;br /&gt;
  &lt;br /&gt;
  	NAND_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xc.&lt;br /&gt;
  	Then LT_ffff5690(0x201, 0x1fffe018, 0x1fffe01c) is called.&lt;br /&gt;
  	Then LT_ffff5644() is called.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it continues to the next code-block.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Wifi spi-flash firm-boot code-block, executed when no FIRM was loaded successfully so far.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called.&lt;br /&gt;
  &lt;br /&gt;
  	Then spi_wififlash_cmdgetstatusreg(sp+0x100) is executed. When bit0 of the output u8 at sp+0x100 is clear, it will continue this code-block, otherwise it will set the statuscode variable to ~1 then jump to SPIFLASH_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_wififlash() is called.&lt;br /&gt;
  	Here read_firmhdr_validate_loadfirm(0, 2) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  &lt;br /&gt;
  	SPIFLASH_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xe.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it executes writenormalkey_keyslot3f(), then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_END:&lt;br /&gt;
  Here it calls firmhdr_getarm11_entrypoint() and firmhdr_getarm9_entrypoint(). Immediately after calling each function it checks if the retval is 0, if so it then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  After calling initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), it jumps to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_FAILURE:&lt;br /&gt;
  Here it clears 0x07ffb800 size 0x3c70 to zero, endaddr = 0x07fff470.&lt;br /&gt;
  Then it continues to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_EXIT:&lt;br /&gt;
  Here firmboot() is called, which should never return. The instruction after this bl is a call for panic().&lt;br /&gt;
&lt;br /&gt;
== Boot11 ==&lt;br /&gt;
&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
main():&lt;br /&gt;
  LT_1263c();&lt;br /&gt;
  ...&lt;br /&gt;
  LT_13944()&lt;br /&gt;
  ...&lt;br /&gt;
  pxi_init();&lt;br /&gt;
  initializefuncptr_firmboot_start(firmbootbegin_funcptr);&lt;br /&gt;
  firmboot();&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
LT_12220/initializefuncptr_firmboot_start&lt;br /&gt;
  inr0=funcptr&lt;br /&gt;
  This writes inr0 to address 0x1ffe8028, then returns.&lt;br /&gt;
  This initializes the funcptr which firmboot() can call after the very first func-call.&lt;br /&gt;
&lt;br /&gt;
LT_13944&lt;br /&gt;
  if([[I2C_Registers|i2cmcu_readregf]](sp+0)==0)&lt;br /&gt;
  {&lt;br /&gt;
  	return (*((u8*)0x10147000) &amp;gt;&amp;gt; 4) &amp;amp; 1;//Reads [[GPIO_Registers|GPIO]] when reading I2C fails.&lt;br /&gt;
  }&lt;br /&gt;
  Here it basically does &amp;quot;return &amp;lt;byte loaded from sp+0&amp;gt; ^ 0x2&amp;quot;. Hence in this case, it will return 0x2 when the system shell is closed(sleep-mode), otherwise 0x0 is returned.&lt;br /&gt;
&lt;br /&gt;
LT_12454/firmboot&lt;br /&gt;
  This is the arm11 version of the boot9 firmboot() function, like boot9 this is the final function called from main(). The functionality for these two functions are identical, minus addresses.&lt;br /&gt;
  ptr = firmboot_loadentrypoint11();&lt;br /&gt;
  funcptr = *(0x1ffe8028);&lt;br /&gt;
  if(funcptr)funcptr(ptr);&lt;br /&gt;
  LT_11ffc(ptr);&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
== Boot Procedure ==&lt;br /&gt;
&lt;br /&gt;
* 0 seconds - unit is powered on. The ARM9 and ARM11 [[Memory_layout|bootroms]] begin execution.&lt;br /&gt;
* &amp;lt;= ~1 second - BootROMs fully run, load FIRM, etc. The loaded FIRM begins running.&lt;br /&gt;
**The ARM11 sysmodules included with FIRM are launched by ARM11-kernel, etc.&lt;br /&gt;
**The [[Process_Manager_Services|PM]] module launches [[NS]].&lt;br /&gt;
**If [[Home_Menu#Auto-Boot_Function|auto-booting]] is needed, NS will [[NS#Auto-boot|auto-boot]] titles.&lt;br /&gt;
**Otherwise, NS will instead launch [[ErrDisp]] and the [[Configuration Memory#ACTIVEMENUTID|current active menu]] via the PM module. For retail units, this menu is usually the [[Home Menu]]. Note that the PM module first launches the module dependencies when launching a process, prior to actually launching the process.&lt;br /&gt;
**The further Home Menu startup process is described [[Home_Menu#Home_Menu_startup|here]]. This includes Home Menu manually launching various sysmodules.&lt;br /&gt;
&lt;br /&gt;
* 4 seconds - the LCD screens are initialized.&lt;br /&gt;
&lt;br /&gt;
* 7 seconds - [[Home Menu]] is fully initialized/loaded.&lt;br /&gt;
&lt;br /&gt;
== NAND Reads during Boot ==&lt;br /&gt;
During a successful boot on 6.x, the bootloader (and firm) reads the following sectors from NAND (in this order):&lt;br /&gt;
 00000000 (NCSD Partition Table)&lt;br /&gt;
 &lt;br /&gt;
 Only verify &#039;FIRM&#039; magic? (A second Header-read will be attempted even if everything except the magic is 0xFF...)&lt;br /&gt;
 0B130000 (FIRM Partition)&lt;br /&gt;
 0B530000 (Secondary FIRM Partition)&lt;br /&gt;
 &lt;br /&gt;
 Verify RSA signature and parse Header:&lt;br /&gt;
 0B130000 (FIRM: Header)&lt;br /&gt;
 0B130200 (FIRM: Section 1)&lt;br /&gt;
 0B163E00 (FIRM: Section 2)&lt;br /&gt;
 0B193E00 (FIRM: Section 3)&lt;br /&gt;
 &lt;br /&gt;
 00013000 .. Below is probably NATIVE_FIRM booting ..&lt;br /&gt;
 00014000&lt;br /&gt;
 00015000&lt;br /&gt;
 00016000&lt;br /&gt;
 00017000&lt;br /&gt;
 &lt;br /&gt;
 09011A00&lt;br /&gt;
 09011C00&lt;br /&gt;
 09012000&lt;br /&gt;
 09012400&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Error Codes ==&lt;br /&gt;
When the 3DS does not find the NAND chip, the following error is displayed:&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Bootrom_Error.jpg|240px]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Error&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000200 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Error when having SD-card reader connected to NAND during boot.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000400 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND not found error (?)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000080 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT1 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT2 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT3 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FF F8F8FFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Both the firm0 and firm1 partitions are corrupt (failed signature checks).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800EE FFFFFFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| [[NCSD]] header in sector 0 is corrupt (failed signature check).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
* [https://github.com/yellows8/boot9_tools boot9_tools]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20019</id>
		<title>Bootloader</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=20019"/>
		<updated>2017-05-20T23:59:55Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Add status code for invalid FIRM section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bootloader is the binary code stored in the ARM9 and ARM11 boot ROMs and hence is ran when the 3DS is powered on. It&#039;s purpose is initializing hardware and loading the [[FIRM|system firmware]] from the internal [[Flash_Filesystem|NAND memory]].&lt;br /&gt;
&lt;br /&gt;
Besides NATIVE_FIRM, the bootloader is also capable of booting other firmwares (such as TWL_FIRM and AGB_FIRM). However, this will result either in a japanese error-screen or a system shutdown, directly after FIRM-Launching.&lt;br /&gt;
&lt;br /&gt;
== Boot ROM ==&lt;br /&gt;
Upon boot, parts of the ARM9 and ARM11 boot ROMs are protected by writing to [[CONFIG#CFG_SYSPROT9|CFG_SYSPROT9]] and [[CONFIG#CFG_SYSPROT11|CFG_SYSPROT11]], respectively. The ARM9 and ARM11 boot ROMs are identical for all Old 3DS, 2DS and New 3DS consoles.&lt;br /&gt;
&lt;br /&gt;
== NAND FIRM boot ==&lt;br /&gt;
Boot9 is not hard-coded to only handle 2 FIRM partitions: it parses all 8 NCSD partitions for this. Boot9 will attempt to use every partition listed in the NCSD which is an actual FIRM partition, in the same order listed in the NCSD, until booting one of them succeeds. Among the not-yet-processed partitions, the FIRM which has the highest value at u32 firmhdr+4 will have a FIRM-boot attempted first. Since that value is normally 0x0, the order of FIRM-partition processing is normally identical to the order of the NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
Boot9 is hard-coded for using [[AES_Registers|AES]] keyslot 0x6 for NAND crypto.&lt;br /&gt;
&lt;br /&gt;
== Non-NAND FIRM boot ==&lt;br /&gt;
Boot9 can also boot from non-NAND. For this a different set of RSA pubks are used(separate pubks for retail/devunit like NAND). The spiflash FIRM image for this is also encrypted with AES-CBC using a normalkey stored in prot_boot9(separate for retail/devunit). This encryption is basically used instead of what is used for NAND-firm-partitions. This encryption is only used for the FIRM sections, the FIRM header is used raw. The AES keyslot for this is only overwritten afterwards when booting from non-NAND fails. AES keyslot 0x3F is used for this.&lt;br /&gt;
&lt;br /&gt;
  CTR_word[0] = firmimageoffset;//FIRM section offset from FIRM header&lt;br /&gt;
  CTR_word[1] = outbufaddr;//FIRM section load addr&lt;br /&gt;
  CTR_word[2] = readsize;//FIRM section size&lt;br /&gt;
  CTR_word[3] = readsize;//FIRM section size&lt;br /&gt;
&lt;br /&gt;
When booting from NAND fails, boot9 will then attempt to boot from Wifi SPI-flash(this only triggers when the wifi module hw is properly accessible/connected, which is normally the case). The base offset for spiflash FIRM is 0x400. Note that this region(all data prior to offset 0x1F300) is write-protected by the spiflash(not writable from 3DS-mode / DS-mode).&lt;br /&gt;
&lt;br /&gt;
For non-NAND booting, NCSD / FIRM-backup is not used.&lt;br /&gt;
&lt;br /&gt;
== SDMMC ==&lt;br /&gt;
&lt;br /&gt;
Boot9 has code implemented for using SD(HC) cards, but the input deviceids used by boot9 for those functions are hard-coded for NAND. However, it is possible to use an SD(HC) card in place of the NAND if the NAND chip is first disconnected, and a SD card connected to the bus. Due to the CID being different, partitions will need to be re-encrypted and TWL mode will not work, due to the MBR being in the NCSD header. Using sighax, it may be possible to replace the NCSD header.&lt;br /&gt;
&lt;br /&gt;
== Boot9 RSA keyslots ==&lt;br /&gt;
&lt;br /&gt;
The following are initialized during main() startup, by initialize_rsakeyslots_pubk(). Each of these, for the ones which are actually set, have different keydata for retail/devunit.&lt;br /&gt;
* 0: Not set.&lt;br /&gt;
* 1: Used for the NAND FIRM signature.&lt;br /&gt;
* 2: Used for the non-NAND-FIRM signature.&lt;br /&gt;
* 3: Used for the NAND-NCSD FIRM signature.&lt;br /&gt;
&lt;br /&gt;
When FIRM loading is successful, initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk() is called, right before calling the final function in main(). Besides ITCM writing, this overwrites all 4 RSA keyslots with modulus + private-exponents loaded from boot9 data.&lt;br /&gt;
&lt;br /&gt;
initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk():&lt;br /&gt;
This initializes the 4 0x100-byte/0x200-byte chunks at 0x07ffb800+0x500(0x07ffbd00)/0x07ffb800+0x900(0x07ffc100). End address of the first section is 0x07ffc100(start addr of the second section), end address of the second section is 0x07ffc900. Hence, the first section total size is 0x400-bytes, while the second section total size is 0x800-bytes.&lt;br /&gt;
&lt;br /&gt;
These are initialized using via the boot9 data image, with ptrs from DTCM. Seperate keydata is used for retail/devunit.&lt;br /&gt;
&lt;br /&gt;
When initializing the first ITCM area: rsa_setkeyslot_privk() is called for all 4 RSA keyslots. The modulo for each one is also copied to (index*0x100) + 0x07ffb800 + 0x500. The private exponent is not copied into ITCM.&lt;br /&gt;
&lt;br /&gt;
The second ITCM area is initialized by copying 4 0x200-byte entries in a loop. These are RSA pubks+privks, which Boot9 doesn&#039;t use itself at all besides this copy loop.&lt;br /&gt;
&lt;br /&gt;
== Boot9 image data memory layout ==&lt;br /&gt;
0xffffb088 is the beginning of the boot9 image data section.&lt;br /&gt;
&lt;br /&gt;
* 0xffffb088 size 0x38-bytes: This is the array used during FIRM-section-loading for the memory-range blacklist for FIRM sections.&lt;br /&gt;
* 0xffffb0c0(end-addr of the above area) size 0x20-bytes: Unknown.&lt;br /&gt;
* 0xffffb0e0(end-addr of the above area) size 0x2f80-bytes: This is *all* of the keys stored in the image.&lt;br /&gt;
* 0xffffe060(end addr of the above key-area) size 0x230-bytes: This is the initial DTCM image @ 0xFFF00000, see below.&lt;br /&gt;
* 0xffffe290(DTCM_image_end) - {boot9 image end}: All-zero.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2f80-byte key-area at 0xffffb0e0:&lt;br /&gt;
* 0xffffb0e0 size 0x2600-bytes: This is the RSA key-data, see below.&lt;br /&gt;
* 0xffffd6e0(end-addr of the above area) size 0x40-bytes: This is the keydata used for crypting the entire OTP with keyslot 0x3f, used by main(). The first 0x20-bytes is for retail, the remaining 0x20-bytes starting at 0xffffd700 is for devunit. Chunk+0(retail=0xffffd6e0 devunit=0xffffd700) is the normalkey, chunk+0x10(retail=0xffffd6f0 devunit=0xffffd710) is the AES-IV.&lt;br /&gt;
* ...&lt;br /&gt;
* 0xffffd760: size 0x100-bytes: First 0x80-bytes is for retail, the remaining 0x80-bytes at 0xffffd7e0 is for devunit. This 0x80-byte block is copied to 0x07ffcd00 by a Boot9 function, however that code actually does the copy in two 0x40-bytes chunks.&lt;br /&gt;
* 0xffffd860(end-addr of the above area) size 0x400-bytes: This is the bootrom_dataptr passed to the aes-keyinit function for retail. See the below Tools section for how this is processed.&lt;br /&gt;
* 0xffffdc60(end-addr of the above area) size 0x400-bytes: This is the devunit version of the above the 0x400-byte chunk. This is very last chunk of data in the boot9 data-section key-area: end addr for this area is 0xffffe060.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2600-byte RSA key-data at 0xffffb0e0:  &lt;br /&gt;
First 0x1300-bytes is for retail, the remaining 0x1300-bytes starting at 0xffffc3e0 is for devunit.&lt;br /&gt;
* +0x0 retail=0xffffb0e0 devunit=0xffffc3e0: RSA modulo for keyslot3, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x100 retail=0xffffb1e0 devunit=0xffffc4e0: RSA modulo for keyslot1, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x200 retail=0xffffb2e0 devunit=0xffffc5e0: RSA modulo for keyslot2, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x300 size 0x200, retail=0xffffb3e0 devunit=0xffffc6e0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). This is for RSA-engine keyslot0 with initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), which also copies this modulo to the array starting at 0x07ffbd00.&lt;br /&gt;
* +0x500 size 0x200, retail=0xffffb5e0 devunit=0xffffc8e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0x700 size 0x200, retail=0xffffb7e0 devunit=0xffffcae0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x900 size 0x200, retail=0xffffb9e0 devunit=0xffffcce0: Used the same as the above block except for slot3.&lt;br /&gt;
* +0xb00 size 0x200, retail=0xffffbbe0 devunit=0xffffcee0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). The 0x200-bytes here is copied to slot0 in the array at 0x07ffc100 by initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk().&lt;br /&gt;
* +0xd00 size 0x200, retail=0xffffbde0 devunit=0xffffd0e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0xf00 size 0x200, retail=0xffffbfe0 devunit=0xffffd2e0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x1100 size 0x200, retail=0xffffc1e0 devunit=0xffffd4e0: Used the same as the above block except for slot3.&lt;br /&gt;
&lt;br /&gt;
== Boot9 DTCM layout ==&lt;br /&gt;
Most of this is just ptrs / other unknown data, not actual keys. However, there is an unknown 0x10-byte block @ +0x124(there&#039;s a ptr initialized for this block elsewhere).&lt;br /&gt;
&lt;br /&gt;
== Boot11 image data memory layout ==&lt;br /&gt;
0x0001817c..0x000181f4 size 0x78-bytes: This seems to be the bootrom error screen font gfx data. This begins at the exact end-address of the crt0 code, the rest of the protected boot11 code begins at this end-address(0x000181f4).  &lt;br /&gt;
&lt;br /&gt;
0x00019400 is the beginning of the boot11 data area, the first 8-bytes here are unknown.&lt;br /&gt;
* 0x00019408..0x0001b498 size 0x2090-bytes: This is the blowfish keydata which gets copied to arm9itcm_twlkeydata+0x3e0 later.&lt;br /&gt;
* ...&lt;br /&gt;
* 0x0001c498..0x0001c4f8 size 0x60-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x380.&lt;br /&gt;
* 0x0001c4f8..0x0001c538 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x340.&lt;br /&gt;
* 0x0001c538..0x0001c578 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x300.&lt;br /&gt;
* 0x0001c578..0x0001c5f8 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x280.&lt;br /&gt;
* 0x0001c5f8..0x0001c678 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x0.&lt;br /&gt;
* 0x0001c678..0x0001c878 size 0x200-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x80.&lt;br /&gt;
* 0x0001c878..0x0001d078 size 0x800-bytes: These are the 3DS RSA-2048 modulus which are eventually copied to arm9_itcm+0x4900: on retail the first 4 are copied there by boot9, on devunit the last 4 are copied to itcm.&lt;br /&gt;
* 0x0001d078 size 0x120-bytes is the initial data for the .data section @ 0x1ffe8000, this is the very end of the protected arm11-bootrom.&lt;br /&gt;
&lt;br /&gt;
== AES keys ==&lt;br /&gt;
See the Tools section for how Boot9 initializes the keyslots.&lt;br /&gt;
&lt;br /&gt;
See also [[AES_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
For an issue with console-unique key-init, see [[OTP_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
== BootROM Errors ==&lt;br /&gt;
Sample error-screen(where firm0+firm1 RSA signatures were corrupted):&lt;br /&gt;
&lt;br /&gt;
  BOOTROM 8046&lt;br /&gt;
  ERRCODE: 00F800FF&lt;br /&gt;
  DEDEFFFF FFFFFFFF&lt;br /&gt;
  00000000 00000000&lt;br /&gt;
&lt;br /&gt;
* 1st line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;BOOTROM %X&amp;quot;, 0x8046);//This last param comes from the .pool.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2nd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;ERRCODE:    %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0xC)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 3rd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0x10))`, `*((unsigned int*)(0x1fffe000+0x14)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 4th line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;,*((unsigned int*)(0x1FFFE000+0x18))`, `*((unsigned int*)(0x1fffe000+0x1C)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0x1FFFE000 memory ==&lt;br /&gt;
This memory is used by boot9 mainly for sending info to the arm11 for the error-screen. The data in this region is still stored in memory by the time the ARM9+ARM11 jumps to FIRM.&lt;br /&gt;
&lt;br /&gt;
Among boot9/boot11, the 3 words at 0x1FFFE000 seem to be &#039;&#039;only&#039;&#039; accessed by the boot11 function initializing those words.&lt;br /&gt;
&lt;br /&gt;
* u32 0x1FFFE000+0: ARM11 MPCore &amp;quot;Cycle Counter Register (CCNT)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+4: ARM11 MPCore &amp;quot;Count Register 0 (PMN0)&amp;quot;.&lt;br /&gt;
* u32 0x1FFFE000+8: ARM11 MPCore &amp;quot;Count Register 1 (PMN0)&amp;quot;.&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0xC: 8bit status-codes initialized by boot9 main(), for the FIRM-boot devices. +0 is NAND and +2 is wifi-spiflash.&lt;br /&gt;
* ...&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0x10: Status-codes originally from nand_findfirmpartition_loadfirm(), for each of the 8 NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
== BootROM Status Codes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| 0xEE(~17)&lt;br /&gt;
| NCSD header validation function failed: NCSD magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDE(~33)&lt;br /&gt;
| FIRM header validation function failed: FIRM magicnum is invalid or RSA verification failed.&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF(~32)&lt;br /&gt;
| Failed to read sector data from the device.&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF(~48)&lt;br /&gt;
| FIRM section validation function failed: FIRM section is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7(~8)&lt;br /&gt;
| A NAND FIRM from another partition was already found with a priority(firmhdr+4) &amp;gt;= to the value for the current partition&#039;s FIRM priority.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8(~7)&lt;br /&gt;
| The FIRM magicnum(firmhdr+0) is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF(~0)&lt;br /&gt;
| Initial value for each entry in the 8-entry array of status-codes for the NAND NCSD partitions. Indicates that the partition is not a FIRM partition(partition fs type isn&#039;t 0x3 or partition fs crypt-type isn&#039;t 0x2).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Boot9 startup ==&lt;br /&gt;
&lt;br /&gt;
0xffff0000 jumps to 0xffff8000. 0xffff8000 is crt0:&lt;br /&gt;
* Very first thing this does is clear u8 register 0x10000002 ([[CONFIG_Registers#CFG_RST11|CFG_RST11]]) bit 0 to zero.&lt;br /&gt;
* Then sp is initialized for each cpumode, IRQs/FIQs are disabled during the first mode-switch.&lt;br /&gt;
* Order of mode-switches + sp initialization: svc-mode = 0xfff04000, irq-mode = 0xfff03f00, system-mode = 0xfff03b00. Hence, the rest of the code following this runs in system-mode.&lt;br /&gt;
* Then L_ffff80cc/mpu_init() is called.&lt;br /&gt;
* Then L_ffff0038() is called, which initializes the exception-handler addresses @ 0x08000000.&lt;br /&gt;
* Then L_ffff81b8() is called(r4 + lr are saved on the DTCM stack), which after calling a memclear function which doesn&#039;t do anything, it then clears 0x08000030 size 0x10. Here the DTCM at 0xfff00000 size 0x4000 is cleared.&lt;br /&gt;
* Then L_ffff81b4() is called, which branches to DTCM_init(). This copies the initial DTCM data from the Boot9 data image into boot9, then it clears 0xFFF00230 - 0xFFF01AC0.&lt;br /&gt;
* Then LT_ffff8228/main is jumped to, with LR set to the address of an infinite-branch-loop instruction.&lt;br /&gt;
&lt;br /&gt;
mpu_init():&lt;br /&gt;
* Bitmask 0x000f9005 is cleared in the cp15 control register. MCR instructions which do then following are then executed: flush entire instruction cache, flush entire data cache, and drain write buffer.&lt;br /&gt;
* Then the 8 [[Memory_layout|MPU]] memregions are initialized.&lt;br /&gt;
* ITCM memregion reg = 0x24: baseaddr=0x0, size = 128MB(0x08000000).&lt;br /&gt;
* DTCM memregion reg = 0xfff0000a: baseaddr=0xfff00000, size=16KB(0x00004000).&lt;br /&gt;
* Then instruction cachable and data cachable/bufferable bits for the MPU regions are setup.&lt;br /&gt;
* Then the instruction/data access permissions for the MPU regions are setup.&lt;br /&gt;
* Lastly bitmask 0x0005707d is orred in the cp15 control register.&lt;br /&gt;
&lt;br /&gt;
== Boot9 main() ==&lt;br /&gt;
&lt;br /&gt;
  The following functions are called: LT_ffff2024(), LT_ffff1ff8(), pxi_init(), rsa_init(), initialize_rsakeyslots_pubk(), crypto_initialize(), and aesengine_reset().&lt;br /&gt;
  Then AES keyslot 0x3F is setup: aesengine_setnormalkey(0x3f, 5, ptr) is called. ptr on retail(CFG_UNITINFO check) is 0xffffd6e0, 0xffffd700 for devunit. Then essentially, aesengine_setctr(5, ptr+0x10) is executed.&lt;br /&gt;
  Then AES keyslot 0x3f is selected.&lt;br /&gt;
  When calling the following functions, if any of them return zero, it will immediately jump to setting ptr to 0x10012000(otp), otherwise when all of them return non-zero ptr = sp+0x94. otp_decrypt(sp+4), otp_verify(sp+4), initialize_consoleunique_itcm(sp+4, 0x07ffb800).&lt;br /&gt;
  Then the following is executed: initialize_aeskeys_wrap(ptr, 0x70);&lt;br /&gt;
  Then sp+4 size 0x100 is cleared to zero.&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  NAND firm-boot code-block, is described below. Note that boot9 is basically hard-coded to use deviceid NAND, not SD.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called, then the AES keyslot for NAND-FIRM is selected(0x6).&lt;br /&gt;
  	Then LT_ffff56c8() is called, if that returns non-zero the statuscode variable is set to ~2 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then LT_ffff5774(0x201) is called, if that returns non-zero the statuscode variable is set to ~1 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_mmc() is called. Then nand_findfirmpartition_loadfirm(0) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  	Executes a loop which runs 8 times: write the output from get_errorcode_arrayentry_xfff005e8(loopindex) to u8 0x1fffe000+0x10+loopindex(copy the array of 32bit error-codes for all 8 NCSD partitions initialized by nand_findfirmpartition_loadfirm() to the array of 8bit entries at 0x1fffe000+0x10).&lt;br /&gt;
  &lt;br /&gt;
  	NAND_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xc.&lt;br /&gt;
  	Then LT_ffff5690(0x201, 0x1fffe018, 0x1fffe01c) is called.&lt;br /&gt;
  	Then LT_ffff5644() is called.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it continues to the next code-block.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Wifi spi-flash firm-boot code-block, executed when no FIRM was loaded successfully so far.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called.&lt;br /&gt;
  &lt;br /&gt;
  	Then spi_wififlash_cmdgetstatusreg(sp+0x100) is executed. When bit0 of the output u8 at sp+0x100 is clear, it will continue this code-block, otherwise it will set the statuscode variable to ~1 then jump to SPIFLASH_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_wififlash() is called.&lt;br /&gt;
  	Here read_firmhdr_validate_loadfirm(0, 2) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  &lt;br /&gt;
  	SPIFLASH_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xe.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it executes writenormalkey_keyslot3f(), then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_END:&lt;br /&gt;
  Here it calls firmhdr_getarm11_entrypoint() and firmhdr_getarm9_entrypoint(). Immediately after calling each function it checks if the retval is 0, if so it then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  After calling initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), it jumps to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_FAILURE:&lt;br /&gt;
  Here it clears 0x07ffb800 size 0x3c70 to zero, endaddr = 0x07fff470.&lt;br /&gt;
  Then it continues to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_EXIT:&lt;br /&gt;
  Here firmboot() is called, which should never return. The instruction after this bl is a call for panic().&lt;br /&gt;
&lt;br /&gt;
== Boot11 ==&lt;br /&gt;
&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
main():&lt;br /&gt;
  LT_1263c();&lt;br /&gt;
  ...&lt;br /&gt;
  LT_13944()&lt;br /&gt;
  ...&lt;br /&gt;
  pxi_init();&lt;br /&gt;
  initializefuncptr_firmboot_start(firmbootbegin_funcptr);&lt;br /&gt;
  firmboot();&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
LT_12220/initializefuncptr_firmboot_start&lt;br /&gt;
  inr0=funcptr&lt;br /&gt;
  This writes inr0 to address 0x1ffe8028, then returns.&lt;br /&gt;
  This initializes the funcptr which firmboot() can call after the very first func-call.&lt;br /&gt;
&lt;br /&gt;
LT_13944&lt;br /&gt;
  if([[I2C_Registers|i2cmcu_readregf]](sp+0)==0)&lt;br /&gt;
  {&lt;br /&gt;
  	return (*((u8*)0x10147000) &amp;gt;&amp;gt; 4) &amp;amp; 1;//Reads [[GPIO_Registers|GPIO]] when reading I2C fails.&lt;br /&gt;
  }&lt;br /&gt;
  Here it basically does &amp;quot;return &amp;lt;byte loaded from sp+0&amp;gt; ^ 0x2&amp;quot;. Hence in this case, it will return 0x2 when the system shell is closed(sleep-mode), otherwise 0x0 is returned.&lt;br /&gt;
&lt;br /&gt;
LT_12454/firmboot&lt;br /&gt;
  This is the arm11 version of the boot9 firmboot() function, like boot9 this is the final function called from main(). The functionality for these two functions are identical, minus addresses.&lt;br /&gt;
  ptr = firmboot_loadentrypoint11();&lt;br /&gt;
  funcptr = *(0x1ffe8028);&lt;br /&gt;
  if(funcptr)funcptr(ptr);&lt;br /&gt;
  LT_11ffc(ptr);&lt;br /&gt;
  return;&lt;br /&gt;
&lt;br /&gt;
== Boot Procedure ==&lt;br /&gt;
&lt;br /&gt;
* 0 seconds - unit is powered on. The ARM9 and ARM11 [[Memory_layout|bootroms]] begin execution.&lt;br /&gt;
* &amp;lt;= ~1 second - BootROMs fully run, load FIRM, etc. The loaded FIRM begins running.&lt;br /&gt;
**The ARM11 sysmodules included with FIRM are launched by ARM11-kernel, etc.&lt;br /&gt;
**The [[Process_Manager_Services|PM]] module launches [[NS]].&lt;br /&gt;
**If [[Home_Menu#Auto-Boot_Function|auto-booting]] is needed, NS will [[NS#Auto-boot|auto-boot]] titles.&lt;br /&gt;
**Otherwise, NS will instead launch [[ErrDisp]] and the [[Configuration Memory#ACTIVEMENUTID|current active menu]] via the PM module. For retail units, this menu is usually the [[Home Menu]]. Note that the PM module first launches the module dependencies when launching a process, prior to actually launching the process.&lt;br /&gt;
**The further Home Menu startup process is described [[Home_Menu#Home_Menu_startup|here]]. This includes Home Menu manually launching various sysmodules.&lt;br /&gt;
&lt;br /&gt;
* 4 seconds - the LCD screens are initialized.&lt;br /&gt;
&lt;br /&gt;
* 7 seconds - [[Home Menu]] is fully initialized/loaded.&lt;br /&gt;
&lt;br /&gt;
== NAND Reads during Boot ==&lt;br /&gt;
During a successful boot on 6.x, the bootloader (and firm) reads the following sectors from NAND (in this order):&lt;br /&gt;
 00000000 (NCSD Partition Table)&lt;br /&gt;
 &lt;br /&gt;
 Only verify &#039;FIRM&#039; magic? (A second Header-read will be attempted even if everything except the magic is 0xFF...)&lt;br /&gt;
 0B130000 (FIRM Partition)&lt;br /&gt;
 0B530000 (Secondary FIRM Partition)&lt;br /&gt;
 &lt;br /&gt;
 Verify RSA signature and parse Header:&lt;br /&gt;
 0B130000 (FIRM: Header)&lt;br /&gt;
 0B130200 (FIRM: Section 1)&lt;br /&gt;
 0B163E00 (FIRM: Section 2)&lt;br /&gt;
 0B193E00 (FIRM: Section 3)&lt;br /&gt;
 &lt;br /&gt;
 00013000 .. Below is probably NATIVE_FIRM booting ..&lt;br /&gt;
 00014000&lt;br /&gt;
 00015000&lt;br /&gt;
 00016000&lt;br /&gt;
 00017000&lt;br /&gt;
 &lt;br /&gt;
 09011A00&lt;br /&gt;
 09011C00&lt;br /&gt;
 09012000&lt;br /&gt;
 09012400&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Error Codes ==&lt;br /&gt;
When the 3DS does not find the NAND chip, the following error is displayed:&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Bootrom_Error.jpg|240px]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Error&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000200 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Error when having SD-card reader connected to NAND during boot.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000400 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND not found error (?)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000080 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT1 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT2 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT3 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FF F8F8FFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Both the firm0 and firm1 partitions are corrupt (failed signature checks).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800EE FFFFFFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| [[NCSD]] header in sector 0 is corrupt (failed signature check).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
* [https://github.com/yellows8/boot9_tools boot9_tools]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=20017</id>
		<title>3DS System Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=20017"/>
		<updated>2017-05-20T17:44:43Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Boot9 code execution via MMIO and sighax + factory firmware vulnerable to sighax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of publicly known system flaws, for userland applications/applets flaws see [[3DS_Userland_Flaws|here]].&lt;br /&gt;
&lt;br /&gt;
=Stale / Rejected Efforts=&lt;br /&gt;
* Neimod has been working on a RAM dumping setup for a little while now. He&#039;s de-soldered the 3DS&#039;s RAM chip and hooked it and the RAM pinouts on the 3DS&#039; PCB up to a custom RAM dumping setup. A while ago he published photos showing his setup to be working quite well, with the 3DS successfully booting up. However, his flickr stream is now private along with most of his work.&lt;br /&gt;
&lt;br /&gt;
* Someone (who will remain unnamed) has released CFW and CIA installers, all of which is copied from the work of others, or copyrighted material.&lt;br /&gt;
&lt;br /&gt;
==Tips and info==&lt;br /&gt;
The 3DS uses the XN feature of the ARM11 processor. There&#039;s no official way from applications to enable executable permission for memory containing arbitrary unsigned code(there&#039;s a [[SVC]] for this, but only [[RO_Services|RO-module]] has access to it). A usable userland exploit would still be useful: you could only do return-oriented-programming with it initially. From ROP one could then exploit system flaw(s), see below.&lt;br /&gt;
&lt;br /&gt;
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped(accessing SD data is far easier by running code on the target 3DS however).&lt;br /&gt;
&lt;br /&gt;
=System flaws=&lt;br /&gt;
== Hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed with hardware model/revision&lt;br /&gt;
!  Newest hardware model/revision this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| ARM9/ARM11 bootrom vectors point at uninitialized RAM&lt;br /&gt;
| ARM9&#039;s and ARM11&#039;s exception vectors are hardcoded to point at the CPU&#039;s internal memory (0x08000000 region for ARM9, AXIWRAM for ARM11). While the bootrom does set them up to point to an endless loop at some point during boot, it does not do so immediately. As such, a carefully-timed fault injection (via hardware) to trigger an exception (such as an invalid instruction) will cause execution to fall into ARM9 RAM. &lt;br /&gt;
Since RAM isn&#039;t cleared on boot (see below), one can immediately start execution of their own code here to dump bootrom, OTP, etc.&lt;br /&gt;
The ARM9 bootrom does the following at reset:  reset vector branches to another instruction, then branches to bootrom+0x8000. Hence, there&#039;s no way to know for certain when exactly the ARM9 exception-vector data stored in memory gets initialized.&lt;br /&gt;
&lt;br /&gt;
This requires *very* *precise* timing for triggering the hardware fault.&lt;br /&gt;
&lt;br /&gt;
It has been exploited by derrek to dump the ARM9 bootrom as of Summer 2015.&lt;br /&gt;
| None: all available 3DS models at the time of writing have the exact same ARM9/ARM11 bootrom for the unprotected areas.&lt;br /&gt;
| New3DS&lt;br /&gt;
| End of February 2014&lt;br /&gt;
| [[User:Derrek|derrek]], WulfyStylez (May 2015) independently&lt;br /&gt;
|-&lt;br /&gt;
| Missing AES key clearing&lt;br /&gt;
| The hardware AES engine does not clear keys when doing a hard reset/reboot.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| August 2014&lt;br /&gt;
| Mathieulh/Others&lt;br /&gt;
|-&lt;br /&gt;
| No RAM clearing on reboots&lt;br /&gt;
| On an MCU-triggered reboot all RAM including FCRAM/ARM9 memory/AXIWRAM/VRAM keeps its contents.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2014&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| 32bits of actual console-unique TWLNAND keydata&lt;br /&gt;
| On retail the 8-bytes at ARM9 address [[Memory_layout|0x01FFB808]] are XORed with hard-coded data, to generate the TWL console-unique keys, including TWLNAND. On Old3DS the high u32 is always 0x0, while on New3DS that u32 is always 0x2. On top of this, the lower u32&#039;s highest bit is always ORed. only 31 bits of the TWL console-unique keydata / TWL consoleID are actually console-unique.&lt;br /&gt;
This allows one to easily bruteforce the TWL console-unique keydata with *just* data from TWLNAND. On DSi the actual console-unique data for key generation is 8-bytes(all bytes actually set).&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| DSi / 3DS-TWL key-generator&lt;br /&gt;
| After using the key generator to generate the normal-key, you could overwrite parts of the normal-key with your own data and then recover the key-generator output by comparing the new crypto output with the original crypto output. From the normal-key outputs, you could deduce the TWL key-generator function.&lt;br /&gt;
This applies to the keyX/keyY too.&lt;br /&gt;
&lt;br /&gt;
This attack does not work for the 3DS key-generator because keyslots 0-3 are only for TWL keys.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2011&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| 3DS key-generator&lt;br /&gt;
| The algorithm for generating the normal-keys for keyslots is cryptographically weak.  As a result, it is easily susceptible to differential cryptanalysis if the normal-key corresponding to any scrambler-generated keyslot is discovered.&lt;br /&gt;
&lt;br /&gt;
Several such pairs of matching normal-keys and KeyY values were found, leading to deducing the key-generator function.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| FIRM partitions known-plaintext&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are encrypted with AES-CTR without a MAC. Since this works by XOR&#039;ing data with a static (per-console in this case) keystream, one can deduce the keystream of a portion of each FIRM partition if they have the actual FIRM binary stored in it.&lt;br /&gt;
&lt;br /&gt;
This can be paired with many exploits. For example, it allows minor FIRM downgrades (i.e. 10.4 to 9.6 or 9.5 to 9.4, but not 9.6 to 9.5).&lt;br /&gt;
&lt;br /&gt;
This can be somewhat addressed by having a FIRM header skip over previously used section offsets, but this would just air-gap newer FIRMs without fixing the core bug. This can also only be done a limited number of times due to the size of FIRM versus the size of the partitions.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| &lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| RSA keyslots don&#039;t clear exponent when setting modulus&lt;br /&gt;
| The [[RSA_Registers|RSA keyslots]] are set by boot ROM to have four private RSA keys.  The exponent value in the RSA registers is write-only and not readable.&lt;br /&gt;
&lt;br /&gt;
However, when setting a keyslot&#039;s modulus, the RSA hardware leaves the exponent alone.  This allows retrieving the exponent by doing a discrete logarithm of the output.&lt;br /&gt;
&lt;br /&gt;
By setting the modulus to a prime number whose modular multiplicative order is &amp;quot;smooth&amp;quot; (that is, p-1 is divisible by only small prime numbers), discrete logarithms can be calculated quickly using the [[wikipedia:Pohlig-Hellman algorithm|Pohlig-Hellman algorithm]].  If the prime chosen is greater than the modulus, but the same bit size, the discrete logarithm is the private exponent.&lt;br /&gt;
&lt;br /&gt;
This exploit&#039;s usefulness is limited: RSA keyslot 0 is only used in current firmware for deriving the 6.x save and 7.x NCCH keys, which were already known, and the other three keyslots are entirely unused.  Additionally, with a boot ROM dump, this exploit is moot; these private keys are located in the protected ARM9 boot ROM.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2016&lt;br /&gt;
| [[User:Myria|Myria]]&lt;br /&gt;
|-&lt;br /&gt;
| Boot9 AES keyinit function issues&lt;br /&gt;
| [[Bootloader|Boot9]] seems to have two bugs in the AES key-init function, see [[AES_Registers#AES_key-init|here]].&lt;br /&gt;
| None&lt;br /&gt;
| BootROM issue.&lt;br /&gt;
| 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]] allowing acccess to AXIWRAM/FCRAM-BASE-memregion&lt;br /&gt;
| [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]] can be configured by anything with access to it to allow the GPU to access the entire AXIWRAM+FCRAM. For example, this is an issue for any sysmodule that gets exploited and has access to this register memory-page(include one that&#039;s listed below).&lt;br /&gt;
&lt;br /&gt;
See also &amp;quot;kernelhax via gspwn&amp;quot; below.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 7, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| sighax: Boot9 improper PKCS #1 v1.5 signature validation&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are signed with RSA-2048 using SHA-256 and PKCS #1 v1.5 padding.  Boot9, however, does improper validation of the padding in three ways:&lt;br /&gt;
# Boot9 permits block type 02, meant for encrypted messages, to be used for signatures.  Only 01, for signatures, should have been permitted.  As a result, a signature block is not required to have a long string of FF bytes as padding, but rather any random values suffice.  While correct for encryption, this severely lessens security of signatures.&lt;br /&gt;
# Boot9 does not require that the length of the padding fill out the signature block completely.  As a result, there is considerable freedom in the layout of a signature.&lt;br /&gt;
# Boot9 fails to do bounds checking in its parsing of the DER-encoded hash algorithm type and hash value; the length values given in DER are permitted to point outside the signature block.&lt;br /&gt;
Flaw 3 allows the DER encoding to be such that boot9 believes that the signature&#039;s hash value is outside the range of the block itself, somewhere on the stack.  This can be pointed at the correct hash value it computes.  Boot9 then memcmp&#039;s the calculated hash against itself, and thinks that the hash is valid.&lt;br /&gt;
&lt;br /&gt;
When all three flaws are combined, a brute force in a reasonable amount of time can find a signature that passes all checks.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| November 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| Boot9 FIRM loading doesn&#039;t blacklist memory-mapped I/O&lt;br /&gt;
| [[Bootloader|Boot9]]&#039;s FIRM loading blacklists Boot9 data regions, but forgets to do other important regions, including Memory-mapped I/O. Combined with sighax, by loading a malicious FIRM section to MMIO, one can get Boot9/Boot11 code execution. &lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2015(?)&lt;br /&gt;
| [[User:Derrek|derrek]] (2015?), [[User:Normmatt|Normmatt]] and [[User:SciresM|SciresM]] independently (January 2017).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM9 software ==&lt;br /&gt;
&lt;br /&gt;
=== arm9loader ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Generating the keysector console-unique keys with ITCM+Boot9&lt;br /&gt;
| [[Bootloader|Boot9]] decrypts the 0x100-byte [[OTP_Registers|OTP]] using AES-CBC with keydata stored in Boot9. If hash verification is successful, the plaintext of the first 0x90-bytes are copied into [[Memory_layout|ITCM]]. This is the &#039;&#039;exact&#039;&#039; &#039;&#039;same&#039;&#039; region hashed by arm9loader when generating the console-unique keys for decrypting the keysector, except arm9loader uses the raw encrypted OTP.&lt;br /&gt;
&lt;br /&gt;
Therefore, with the OTP keydata+IV from Boot9 you can: encrypt the 0x90-bytes from ITCM, then hash the output to get the console-unique keys for the system&#039;s keysector. This can even be done for Old3DS which doesn&#039;t have the arm9loader keysector officially.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown why arm9loader only used the first 0x90-bytes of OTP. Using more data from OTP would&#039;ve prevented this. Fixing this would require doing exactly that, but that would also mean updating the NAND keysector(which is dangerous).&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| &lt;br /&gt;
| 2015&lt;br /&gt;
| January 6, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Rearrangable keys in the NAND keystore&lt;br /&gt;
| Due to the keystore being encrypted with AES-ECB, one can rearrange blocks and still have the NAND keystore decrypt in a deterministic way. &lt;br /&gt;
&lt;br /&gt;
Using 10.0 FIRM it is possible to rearrange keys such that ARM9 memory is executed. As such using existing ARM9 execution 10.0 FIRM can be written to NAND and a payload written to memory, with the payload to be executed post-K9L using an MCU reboot.&lt;br /&gt;
| arm9loaderhax given existing ARM9 code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| Early 2016&lt;br /&gt;
| 27 September 2016&lt;br /&gt;
| Myria, [[User:Dark samus|dark_samus]]; mathieulh (independently); [[User:Plutooo|plutoo]] (independently) + others&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared OTP hash keydata in console-unique 0x11 key-generation&lt;br /&gt;
| Kernel9Loader does not clear the [[SHA_Registers#SHA_HASH|SHA_HASH register]] after use. As a result, the data stored here as K9L hands over to Kernel9 is the hash of [[OTP_Registers|OTP data]] used to seed the [[FIRM#New_3DS_FIRM|console-unique NAND keystore decryption key]] set on keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Retrieving this keydata and the [[Flash_Filesystem#0x12C00|NAND keystore]] of the same device allows calculating the decrypted New3DS NAND keystore (non-unique, common to all New3DS units), which contains AES normal keys, also set on keyslot 0x11, which are then used to derive all current [[AES_Registers#Keyslots|New3DS-only AES keyXs]] including the newer batch introduced in [[9.6.0-24#arm9loader|9.6.0-X]]. From there, it is trivial to perform the same key derivation in order to initialize those keys on any system version, and even on Old3DS.&lt;br /&gt;
&lt;br /&gt;
This can be performed by exploiting the &amp;quot;arm9loaderhax&amp;quot; vulnerability to obtain post-K9L code execution after an MCU reboot (the bootrom section-loading fail is not relevant here, this attack was performed without OTP data by brute-forcing keys), and using this to dump the SHA_HASH register. This attack works on any FIRM version shipping a vulnerable version of K9L, whereas OTP dumping required a boot of &amp;lt;[[3.0.0-6|3.0.0-X]].&lt;br /&gt;
&lt;br /&gt;
This attack results in obtaining the entire (0x200-bytes) NAND keystore - it was confirmed at a later date that this keystore is encrypted with the same key (by comparing the decrypted data from multiple units), and therefore using another key in this store will not remedy the issue as all keys are known (i.e. later, unused keys decrypt to the same 0x200-bytes constant with the same OTP hash). Later keys could have been encrypted differently but this is not the case. As a result of this, it is not possible for Nintendo to use K9L again in its current format for its intended purpose, though this was not news from the moment people dumped a New3DS OTP.&lt;br /&gt;
| Derivation of all New3DS keys generated via the NAND keystore (0x1B &amp;quot;Secure4&amp;quot; etc.)&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| ~April 2015, implemented in May 2015&lt;br /&gt;
| 13 January 2016&lt;br /&gt;
| [[User:WulfyStylez|WulfyStylez]], [[User:Dazzozo|Dazzozo]], [[User:Shinyquagsire23|shinyquagsire23]] (complimentary + implemented), [[User:Plutooo|plutoo]], Normmatt (discovered independently)&lt;br /&gt;
|-&lt;br /&gt;
| enhanced-arm9loaderhax&lt;br /&gt;
| See the 32c3 3ds talk.&lt;br /&gt;
Since this is a combination of a trick with the arm9-bootrom + arm9loaderhax, and since you have to manually write FIRM to the firm0/firm1 NAND partitions, this can&#039;t be completely fixed. Any system with existing ARM9 code execution and an OTP/OTP hash dump can exploit this. Additionally, by using the FIRM partition known-plaintext bug and bruteforcing the second entry in the keystore, this can currently be exploited on all New3DS systems without any other prerequisite hacks.&lt;br /&gt;
| arm9loaderhax which automatically occurs at hard-boot.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| Theorized around mid July, 2015. Later implemented+tested by [[User:Plutooo|plutoo]] and [[User:Derrek|derrek]].&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Missing verification-block for the 9.6 keys (arm9loaderhax)&lt;br /&gt;
| Starting with [[9.6.0-24|9.6.0-X]] a new set of NAND-based keys were introduced. However, no verification block was added to verify that the new key read from NAND is correct. This was technically an issue from [[9.5.0-22|9.5.0-X]] with the original sector+0 keydata, however the below is only possible with [[9.6.0-24|9.6.0-X]] since keyslots 0x15 and 0x16 are generated from different 0x11 keyXs.&lt;br /&gt;
&lt;br /&gt;
Writing an incorrect key to NAND will cause arm9loader to decrypt the ARM9 kernel as garbage and then jump to it.&lt;br /&gt;
&lt;br /&gt;
This allows an hardware-based attack where you can boot into an older exploited firmware, fill all memory with NOP sleds/jump-instructions, and then reboot into executing garbage. By automating this process with various input keydata, eventually you&#039;ll find some garbage that jumps to your code.&lt;br /&gt;
&lt;br /&gt;
This gives very early ARM9 code execution (pre-ARM9 kernel). As such, it is possible to dump RSA keyslots with this and calculate the 6.x [[Savegames#6.0.0-11_Savegame_keyY|save]], and 7.x [[NCCH]] keys. This cannot be used to recover keys initialized by arm9loader itself. This is due to it wiping the area used for its stack during NAND sector decryption and keyslot init. &lt;br /&gt;
&lt;br /&gt;
Due to FIRMs on both Old and New 3DS using the same RSA data, this can be exploited on Old3DS as well, but only if one already has the actual plaintext normalkey from New3DS NAND sector 0x96 offset-0 and has dumped the OTP area of the Old3DS.&lt;br /&gt;
| Recovery of 6.x [[Savegames#6.0.0-11_Savegame_keyY|save key]]/7.x [[NCCH]] key, access to uncleared OTP hash keydata&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| March, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared New3DS keyslot 0x11&lt;br /&gt;
| Originally the New3DS [[FIRM]] arm9bin loader only cleared keyslot 0x11 when it gets executed at firmlaunch. This was fixed with [[9.5.0-22|9.5.0-X]] by completely clearing keyslot 0x11 immediately after the loader finishes using keyslot 0x11.&lt;br /&gt;
This means that any ARM9 code that can execute before the loader clears the keyslot at firmlaunch(including firmlaunch-hax) can get access to the uncleared keyslot 0x11, which then allows one to generate all &amp;lt;=v9.5 New3DS keyXs which are generated by keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Therefore, to completely fix this the loader would have to generate more keys using different keyslot 0x11 keydata. This was done with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| New3DS keyXs generation&lt;br /&gt;
| Mostly fixed with [[9.5.0-22|9.5.0-X]], completely fixed with new keys with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| &lt;br /&gt;
| February 3, 2015 (one day after [[9.5.0-22|9.5.0-X]] release)&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Process9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-scrambler key&lt;br /&gt;
| New 3DS firmware versions [[8.1.0-0 New3DS|8.1.0]] through [[9.2.0-20|9.2.0]] set the encryption key for [[Amiibo]] data using a hardcoded normal-key in Process9.  In firmware [[9.3.0-21|9.3.0]], Nintendo &amp;quot;fixed&amp;quot; this by using the key scrambler instead, by calculating the keyY value for keyslot 0x39 that results in the same normal-key, then hardcoding that keyY into Process9.&lt;br /&gt;
&lt;br /&gt;
Nintendo&#039;s fix is actually the problem: Nintendo revealed the normal-key matching an unknown keyX and a known keyY.  Combined with the key scrambler using an insecure scrambling algorithm (see &amp;quot;Hardware&amp;quot; above), the key scrambler function could be deduced.&lt;br /&gt;
| Deducing the keyX for keyslot 0x39 and the key scrambler algorithm&lt;br /&gt;
| New 3DS [[9.3.0-21|9.3.0-X]], sort of&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| Sometime in 2015 after the hardware key-generator was broken.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-generator key&lt;br /&gt;
| During the 3DS&#039; development (June/July 2010) Nintendo added support installing encrypted content ([[CIA]]). Common-key index1 was intended to be a [[AES|hardware generated key]]. However while they added code to generate the key in hardware, they forgot to remove the normal-key for index1 (used elsewhere, likely old debug code). Nintendo later removed the normal key sometime before the first non-prototype firmware release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing the keyY and the normal-key for common-key index1, the devkit key-generator algorithm can be deduced (see &amp;quot;Hardware&amp;quot; above). Additionally the remaining devkit common-keys can be generated once the common-key keyX is recovered.&lt;br /&gt;
&lt;br /&gt;
Note the devkit key-generator was discovered to be the same as the retail key-generator.&lt;br /&gt;
| Deducing the keyX for keyslot 0x3D and hardware key-generator algorithm. Generate remaining devkit common-keys.&lt;br /&gt;
| pre-[[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| Shortly after the key-generator was revealed to be flawed at the 32c3 3ds talk&lt;br /&gt;
| January 20, 2016&lt;br /&gt;
| [[User:Jakcron|jakcron]]&lt;br /&gt;
|-&lt;br /&gt;
| Factory firmware is vulnerable to sighax&lt;br /&gt;
| During the 3DS&#039;s development, presumably boot9 was written (including the sighax) vulnerability. This vulnerability is also present in factory firmware (and earlier, including 0.11). This was fixed in version 1.0.0-0.&lt;br /&gt;
| Deducing the mechanics of the sighax vulnerability in boot9 without having boot9 prot. Arm9 code execution on factory/earlier firmware.&lt;br /&gt;
| [[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| [[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| May 9, 2017&lt;br /&gt;
| May 19, 2017&lt;br /&gt;
| [[User:SciresM|SciresM]], [[User:Myria|Myria]]&lt;br /&gt;
|-&lt;br /&gt;
| safefirmhax&lt;br /&gt;
| SAFE_MODE_FIRM is almost never updated(even when NATIVE_FIRM is updated for vuln fixes), this can be noticed by &#039;&#039;just&#039;&#039; checking 3dbrew/ninupdates title-listings.&lt;br /&gt;
&lt;br /&gt;
The fix for firmlaunch-hax was only applied to NATIVE_FIRM in [[9.5.0-22|9.5.0-X]], leaving SAFE_FIRM exploitable. With ARM11-kernel execution, one can trigger FIRM-launch in to SAFE_FIRM, do Kernel9 &amp;lt;=&amp;gt; Kernel11 sync, PXI sync and then repeat the original attack on SAFE_FIRM instead.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012-2013?&lt;br /&gt;
| Wiki: January 2, 2017&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| safefirmhax 1.1&lt;br /&gt;
| Nintendo&#039;s original safefirmhax fix was flawed -- they added a global boolean that got set to true whenever a non-sysmodule title got launched (except for a hardcoded repair title id), and panic()&#039;d if that boolean was true to prevent launching safefirm after hax was active. However, because the boolean was initially false after firmlaunch -- With ARM11-kernel execution, one could FIRM-launch into NATIVE_FIRM, and then immediately FIRM-launch again into SAFE_FIRM early in NATIVE_FIRM boot before the boolean got set to true to repeat the safehax attack.&lt;br /&gt;
&lt;br /&gt;
This was fixed by adding additional CFG9_BOOTENV checks to firmlaunch code in 11.4.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[11.4.0-37|11.4.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| safefirmhax fix&lt;br /&gt;
| Wiki: April 10, 2017&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| ntrcardhax&lt;br /&gt;
| When reading the banner of a NTR title, Process9 relies on a hardware register to know when the banner was fully read.&lt;br /&gt;
However that register is shared between the ARM9 and the ARM11.&lt;br /&gt;
An attacker with k11 control can so make Process9 believe the banner continues forever and so trigger a buffer overflow.&lt;br /&gt;
With a custom banner for a NTR flashcart, this leads to code execution in Process9.&lt;br /&gt;
&lt;br /&gt;
This was fixed by adding bound checks on the read data.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Title downgrading via [[Application_Manager_Services|AM]]([[Application_Manager_Services_PXI|PXI]])&lt;br /&gt;
| When a title is *already* installed, Process9 will compare the installed title-version with the title-version being installed. When the one being installed is older, Process9 would return an error.&lt;br /&gt;
&lt;br /&gt;
However, this can be bypassed by just deleting the title first via the service command(s) for that: with the title removed from the [[Title_Database]], Process9 can&#039;t compare the input title-version with anything. Hence, titles can be downgraded this way.&lt;br /&gt;
&lt;br /&gt;
[[11.0.0-33|11.0.0-X]] fixed this for key system titles (MSET, Home Menu, spider, ErrDisp, SKATER, NATIVE_FIRM, and every retail system module), by checking the version of the title to install against a hard-coded list of (titleID, minimumVersionRequired) pairs.&lt;br /&gt;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], for key system titles.&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| FAT FS code null-deref&lt;br /&gt;
| When FSFile:Read is used with a file which is corrupted on a FAT filesystem(in particular SD), Process9 can crash. This particular crash is caused by a function returning NULL instead of an actual ptr due to an error. The caller of that function doesn&#039;t check for NULL which then triggers a read based at NULL.&lt;br /&gt;
&lt;br /&gt;
Sample &amp;quot;fsck.vfat -n -v -V &amp;lt;fat image backup&amp;gt;&amp;quot; output for the above crash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;...&lt;br /&gt;
Starting check/repair pass.&lt;br /&gt;
&amp;lt;FilePath0&amp;gt; and&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 share clusters.&lt;br /&gt;
 Truncating second to 3375104 bytes.&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 File size is 2787392 bytes, cluster chain length is 16384 bytes.&lt;br /&gt;
 Truncating file to 16384 bytes.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Reclaimed 1 unused cluster (16384 bytes).&lt;br /&gt;
Checking free cluster summary.&lt;br /&gt;
Free cluster summary wrong (1404490 vs. really 1404491)&lt;br /&gt;
 Auto-correcting.&lt;br /&gt;
Starting verification pass.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Leaving filesystem unchanged.&amp;lt;/pre&amp;gt;&lt;br /&gt;
| Useless null-based-read&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| July 8-9, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| RSA signature padding checks&lt;br /&gt;
| The TWL_FIRM RSA sig padding check code used for all TWL RSA sig-checks has issues, see [[FIRM|here]].&lt;br /&gt;
The main 3DS RSA padding check code(non-certificate, including NATIVE_FIRM) uses the function used with the above to extract more padding + the actual hash from the additional padding. This isn&#039;t really a problem here because there&#039;s proper padding check code which is executed prior to this.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ValidateDSiWareSectionMAC]] [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| When the input DSiWare section index is higher than &amp;lt;max number of DSiWare sections supported by this FIRM&amp;gt;, Process9 uses keyid 0x40 for calculating the AESMAC, which translates to keyslot 0x40. The result is that the keyslot is left at whatever was already selected before, since the AES selectkeyslot code will immediately  return when keyslot is &amp;gt;=0x40. However, actually exploiting this is difficult: the calculated AESMAC is never returned, this command just compares the calculated AESMAC with the input AESMAC(result-code depends on whether the AESMACs match). It&#039;s unknown whether a timing attack would work with this.&lt;br /&gt;
This is basically a different form of the pxips9 keyslot vuln, except with AESMAC etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| March 15, 2015&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| pxips9 [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| This requires access to the [[Process_Services|ps:ps]]/pxi:ps9 services. One way to get access to this would be snshax on system-version &amp;lt;=10.1.0-X(see 32c3 3ds talk).&lt;br /&gt;
When an invalid key-type value is passed to any of the PS commands, Process9 will try to select keyslot 0x40. That aesengine_setkeyslot() code will then immediately return due to the invalid keyslot value. Since that function doesn&#039;t return any errors, Process9 will just continue to do crypto with whatever AES keyslot was selected before the PS command was sent.&lt;br /&gt;
| Reusing the previously used keyslot, for crypto with PS.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| Roughly the same time(same day?) as firmlaunch-hax.&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| firmlaunch-hax: FIRM header ToCToU&lt;br /&gt;
| This can&#039;t be exploited from ARM11 userland.&lt;br /&gt;
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn&#039;t expect &amp;quot;anything&amp;quot; besides the ARM9 to access this data.&lt;br /&gt;
With [[9.5.0-22]] the address of this FIRM header was changed from a FCRAM address, to ARM9-only address 0x01fffc00.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| &lt;br /&gt;
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Uninitialized data output for (PXI) command replies&lt;br /&gt;
| PXI commands for various services(including some [[Filesystem_services_PXI|here]] and many others) can write uninitialized data (like from ARM registers) to the command reply. This happens with stubbed commands, but this can also occur with certain commands when returning an error.&lt;br /&gt;
Certain ARM11 service commands have this same issue as well.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions&lt;br /&gt;
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.&lt;br /&gt;
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ExportDSiWare]] export path&lt;br /&gt;
| Process9 allocates memory on Process9 heap for the export path then verifies that the actual allocated size matches the input size. Then Process9 copies the input path from FCRAM to this buffer, and uses it with the Process9 FS openfile code, which use paths in the form of &amp;quot;&amp;lt;mountpoint&amp;gt;:/&amp;lt;path&amp;gt;&amp;quot;.&lt;br /&gt;
Process9 does not check the contents of this path at all before passing it to the FS code, besides writing a NUL-terminator to the end of the buffer.&lt;br /&gt;
| Exporting of DSiWare to arbitrary Process9 file-paths, such as &amp;quot;nand:/&amp;lt;path&amp;gt;&amp;quot; etc. This isn&#039;t really useful since the data which gets written can&#039;t be controlled.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DSiWare_Exports]] [[CTCert]] verification&lt;br /&gt;
| Just like DSi originally did, 3DS verifies the APCert for DSiWare on SD with the CTCert also in the DSiWare .bin. On DSi this was fixed with with system-version 1.4.2 by verifying with the actual console-unique cert instead(stored in NAND), while on 3DS it&#039;s still not(?) fixed.&lt;br /&gt;
On 3DS however this is rather useless, due to the entire DSiWare .bin being encrypted with the console-unique movable.sed keyY.&lt;br /&gt;
| When the movable.sed keyY for the target 3DS is known and the target 3DS CTCert private-key is unknown, importing of modified DSiWare SD .bin files.&lt;br /&gt;
| Unknown, probably none.&lt;br /&gt;
| ?&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Gamecard_Services_PXI]] unchecked REG_CTRCARDCNT transfer-size&lt;br /&gt;
| The u8 REG_CTRCARDCNT transfer-size parameter for the [[Gamecard_Services_PXI]] read/write CTRCARD commands is used as an index for an array of u16 values. Before [[5.0.0-11|5.0.0-X]] this u8 value wasn&#039;t checked, thus out-of-bounds reads could be triggered(which is rather useless in this case).&lt;br /&gt;
| Out-of-bounds read for a value which gets written to a register.&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] cmdbuf buffer overrun&lt;br /&gt;
| The Process9 code responsible [[PXI_Registers|PXI]] communications didn&#039;t verify the size of the incoming command before writing it to a C++ member variable. &lt;br /&gt;
| Probably ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015, original timeframe if any unknown&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]/[[User:Yellows8|Yellows8]]/maybe others(?)&lt;br /&gt;
|-&lt;br /&gt;
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])&lt;br /&gt;
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be &amp;lt;=0x2800.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Process_Services_PXI|PS RSA]] commands buffer overflows&lt;br /&gt;
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9&#039;s .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads&#039; stacks. SignRsaSha256 also has a buf overflow, but this isn&#039;t exploitable.&lt;br /&gt;
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] pxi_id bad check&lt;br /&gt;
| The Process9 code responsible for [[PXI_Registers|PXI]] communications read pxi_id as a signed char. There were two flaws:&lt;br /&gt;
* They used it as index to a lookup-table without checking the value at all.&lt;br /&gt;
* Another function verified that pxi_id &amp;lt; 7, allowing negative values to pass the check. This would also cause an out-of-range table-lookup.&lt;br /&gt;
| Maybe ARM9 code execution&lt;br /&gt;
| [[3.0.0-5|3.0.0-5]]&lt;br /&gt;
|&lt;br /&gt;
| March 2015, originally 2012 for the first issue at least&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]], maybe others(?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Kernel9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit1 not set by Kernel9&lt;br /&gt;
| Old versions of Kernel9 never set bit1 of [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]]. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!). Since it&#039;s never locked, you can dump it once you get ARM9 code execution.&lt;br /&gt;
&lt;br /&gt;
From [[3.0.0-5|3.0.0-X]] this was fixed by setting the bit in Kernel9 after poking some registers in that region. On New3DS arm9loader sets this bit instead of Kernel9, which is exploitable through a hardware + software vulnerability (see arm9loaderhax / description).&lt;br /&gt;
&lt;br /&gt;
This flaw resurged when it gained a new practical use: retrieving the OTP data for a New3DS console in order to decrypt the key data used in arm9loader (see enhanced-arm9loaderhax / description). This was performed by downgrading to a vulnerable system version. By accounting for differences in CTR-NAND crypto (0x05 -&amp;gt; 0x04, see partition encryption types [[Flash_Filesystem#NAND_structure|here]]), it is possible to boot a New3DS using Old3DS firmware 1.0-2.X and an Old3DS [[NCSD#NCSD_header|NCSD Header]] to retrieve the required OTP data using this flaw.&lt;br /&gt;
| Dumping of the [[OTP Registers|OTP]] area&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Plutooo|plutoo]], Normmatt independently&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM11 software ==&lt;br /&gt;
=== Kernel11 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcGetThreadList]] process reference leak&lt;br /&gt;
| When given a valid process handle (including &amp;lt;code&amp;gt;0xFFFF8001&amp;lt;/code&amp;gt;), svcGetThreadList forgets to decrement the reference count of the underlying [[KProcess]] instance, after having finished using it.&lt;br /&gt;
| Before [[11.2.0-35|11.2.0-X]]: reference count overflow and therefore use-after-free, but this UAF was most likely not exploitable&lt;br /&gt;
| &lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| April 3, 2017&lt;br /&gt;
| [[User:TuxSH|TuxSH]]&lt;br /&gt;
|-&lt;br /&gt;
| kernelhax via gspwn&lt;br /&gt;
| Originally the kernel didn&#039;t initialize [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]]. Since it&#039;s 0 at hard-boot, this allowed the GPU to access the entire FCRAM + AXIWRAM.&lt;br /&gt;
| Entire FCRAM+AXIWRAM R/W.&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| February 7, 2017&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] partly&lt;br /&gt;
|-&lt;br /&gt;
| fasthax&lt;br /&gt;
| When a KTimer is created in pulse mode, the kernel calls a virtual function to reset the timer each time it pulses. The scheduler is locked for that core to avoid race conditions, but another core can call CloseHandle on the timer and free it, leading to a UAF vtable call.&lt;br /&gt;
| See description.&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| May 2016&lt;br /&gt;
| nedwill&lt;br /&gt;
|-&lt;br /&gt;
| ipctakeover&lt;br /&gt;
| When sending cmdreplies, it does not validate that the src_addr and src_size match the equivalent dst_addr and dst_size. With a modified addr/size specified in a cmdreply for an output buffer, the data-copy for the first/last pages could be used to overwrite data outside of the buffer specified by the original process.&lt;br /&gt;
&lt;br /&gt;
Used by ctr-httpwn as of v1.2, for &amp;quot;ipctakeover/bosshaxx&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This can be used to takeover processes where the process is using your service session. Like HTTPC -&amp;gt; BOSS, for bosshaxx above. NIM takeover can be done too(actual stack buffer overflow can trigger), etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| November 26, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Using IPC input buffers as output buffers&lt;br /&gt;
| When sending cmdreplies, it does not validate that the cmdreply descriptor type matches the equivalent cmdreq descriptor type. This could be used by an exploited sysmodule to use what was intended as an input-buffer as an output-buffer, and also combine other IPC vuln(s) with this.&lt;br /&gt;
&lt;br /&gt;
Used by ctr-httpwn as of v1.2, for &amp;quot;ipctakeover/bosshaxx&amp;quot;.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| November 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC]] table too small&lt;br /&gt;
|  The table of function pointers for SVC&#039;s only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.&lt;br /&gt;
&lt;br /&gt;
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn&#039;t mapped as executable.&lt;br /&gt;
| &lt;br /&gt;
|  None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC|svcBackdoor (0x7B)]]&lt;br /&gt;
|  This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11 (with NATIVE_FIRM) required patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]] (deleted)&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| veryslowpidhax&lt;br /&gt;
| &#039;&#039;&#039;This is completely different from the kernelmode-code-execution vuln described in the below separate entry.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When updating the kernel global PID counter under [[SVC|svcCreateProcess]] the kernel does not check for wraparound to 0x0(the PID for the very first process). This only matters because [[Services|SM-module]] allows processes with PID value less than &amp;lt;total ARM11 FIRM modules&amp;gt; to access &#039;&#039;all&#039;&#039; services, without checking exheader service-access-control; and because Kernel11 checks for the PID to be 1 (loader) to use the input mem-region value on ControlMemory. This alone does not affect access the [[SVC|SVCs]] access table at all.&lt;br /&gt;
&lt;br /&gt;
Inlined ldrex+strex code is used for updating the above counter. [[11.2.0-35|11.2.0-X]] had changes for similar code, but it was only for dedicated ldrex+strex functions(mainly for kernel objects) and hence this PID code was not affected.&lt;br /&gt;
&lt;br /&gt;
With launching+terminating a sysmodule repeatedly with this via ns:s, it would take weeks to finish(if not at least about a month?).&lt;br /&gt;
| Access to all [[Services_API|services]], ControlMemory on any given mem-region.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| 2012 maybe?&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|  slowhax/waithax&lt;br /&gt;
|  svcWaitSynchronizationN does not decrement the references to valid handles in an array before returning an error when it encounters an invalid handle. This allows one to (slowly) overflow the reference count for a handle object to zero.&lt;br /&gt;
| ARM11 kernel-mode code execution&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2016&lt;br /&gt;
| nedwill, [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2.1&lt;br /&gt;
| Nintendo&#039;s fix for memchunkhax2 in [[10.4.0-29|10.4.0-X]] did not fix the GPU case: one may cause the requisite ToCToU race using gspwn, bypassing the new validation.&lt;br /&gt;
derrek&#039;s original 32c3 presentation for memchunkhax2 commented that a GPU-based attack was possible, but would be difficult.  However, memchunkhax2.1 showed that it was possible to do fairly reliably.&lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]], aliaspider&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2&lt;br /&gt;
| When allocating a block of memory, the &amp;quot;next&amp;quot; pointer of the [[Memory_Management#MemoryBlockHeader|memchunkhdr]] is accessed without being checked after being mapped to userland.&lt;br /&gt;
This allows a race condition, where the process can change the next pointer just before it&#039;s accessed. By pointing the next pointer to a crafted memchunckhdr in the kernel SlabHeap, some of the SlabHeap is allocated to the calling process, allowing to change vtables of kernel objects. &lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]] (partially, see memchunkhax2.1)&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| heaphax&lt;br /&gt;
| Can change the size of free memchunk structures stored in FCRAM using DMA, which leads to the ability to allocate memory chunks over already-allocated memory. This can be used in the SYSTEM region to allocate RW memory over any part of the NS system module, which is enough to take it over.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading) Code execution within any applet.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
| snshax&lt;br /&gt;
| Can force creation of Safe NS process into gspwn-able memory, allowing for takeover.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading)&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
|  AffinityMask/processorid validation&lt;br /&gt;
|  With [[10.0.0-27|10.0.0-X]] the following functions were updated: svcGetThreadAffinityMask, svcGetProcessAffinityMask, svcSetProcessAffinityMask, and svcCreateThread. The code changes for all but svcCreateThread are identical.&lt;br /&gt;
The original code with the first 3 did the following: &lt;br /&gt;
* if(u32_processorcount &amp;gt; ~0x80000001)return 0xe0e01bfd;&lt;br /&gt;
* if(s32_processorcount &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
The following code replaced the above:&lt;br /&gt;
* if(u32_processorcount &amp;gt;= &amp;lt;total_cores+1&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
In theory the latter should catch everything that the former did, so it&#039;s unknown if this was really a security issue.&lt;br /&gt;
&lt;br /&gt;
The svcCreateThread changes with [[10.0.0-27|10.0.0-X]] definitely did fix a security issue.&lt;br /&gt;
* Original code: &amp;quot;if(s32_processorid &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
* New code: &amp;quot;if(s32_processorid &amp;gt;= &amp;lt;total_cores&amp;gt; || s32_processorid &amp;lt;= -4)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
This fixed an off-by-one issue: if one would use processorid=total_cores, which isn&#039;t actually a valid value, svcCreateThread would accept that value on &amp;lt;[[10.0.0-27|10.0.0-X]]. This results in data being written out-of-bounds(baseaddr = arrayaddr + entrysize*processorid), which has the following result:&lt;br /&gt;
* Old3DS: Useless kernel-mode crash due to accessing unmapped memory.&lt;br /&gt;
* New3DS: uncontrolled data write into a kernel-mode L1 MMU-table. This isn&#039;t really useful: the data can&#039;t be controlled, and the data which gets overwritten is all-zero anyway(this isn&#039;t anywhere near MMU L1 entries for actually mapped memory).&lt;br /&gt;
The previous version also allowed large negative s32_processorid values(negative processorid values are special values not actual procids), but it appears using values like that won&#039;t actually do anything(meaning no crash) besides the thread not running / thread not running for a while(besides triggering a kernelpanic with certain s32_processorid value(s)).&lt;br /&gt;
| Nothing useful&lt;br /&gt;
|  [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| svcCreateThread issue: May 31, 2015. The rest: September 8, 2015, via v9.6-&amp;gt;v10.0 ARM11-kernel code-diff.&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax&lt;br /&gt;
| The kernel originally did not validate the data stored in the FCRAM kernel heap [[Memchunkhdr|memchunk-headers]] for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.&lt;br /&gt;
&lt;br /&gt;
There are &#039;&#039;multiple&#039;&#039; ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.&lt;br /&gt;
| When combined with other flaws: ARM11-kernelmode code execution&lt;br /&gt;
| [[9.3.0-21|9.3.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| February 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Multiple [[KLinkedListNode|KLinkedListNode]] SlabHeap use after free bugs&lt;br /&gt;
| The ARM11-kernel did access the &#039;key&#039; field of [[KLinkedListNode|KLinkedListNode]] objects, which are located on the SlabHeap, after freeing them. Thus, triggering an allocation of a new [[KLinkedListNode|KLinkedListNode]] object at the right time could result in a type-confusion. Pseudo-code:&lt;br /&gt;
SlabHeap_free(KLinkedListNode);&lt;br /&gt;
KObject *obj = KLinkedListNode-&amp;gt;key;  // the object there might have changed!&lt;br /&gt;
This bug appeared all over the place.&lt;br /&gt;
| ARM11-kernelmode code exec maybe&lt;br /&gt;
| [[8.0.0-18|8.0.0-18]]&lt;br /&gt;
| &lt;br /&gt;
| April 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11-kernel didn&#039;t check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.&lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11|6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcStartInterProcessDma]]&lt;br /&gt;
| For svcStartInterProcessDma, the kernel code had the following flaws:&lt;br /&gt;
&lt;br /&gt;
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.&lt;br /&gt;
&lt;br /&gt;
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address &amp;gt;=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr-&amp;gt;physaddr conversion). &lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| DmaConfig issue: unknown. The rest: 2014&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] independently&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] Parameter checks&lt;br /&gt;
| For svcControlMemory the parameter check had these two flaws:&lt;br /&gt;
&lt;br /&gt;
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn&#039;t actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn&#039;t actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows on (addr0+size) are now checked that previously weren&#039;t (this also applies to most other address checks elsewhere in the kernel).&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] request/response buffer overflow&lt;br /&gt;
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.&lt;br /&gt;
&lt;br /&gt;
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of &amp;lt;nowiki&amp;gt;((size&amp;lt;&amp;lt;14) | 2)&amp;lt;/nowiki&amp;gt; to write arbitrary memory to any RW userland memory in the destination process.&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|SVC stack allocation overflows]]&lt;br /&gt;
| &lt;br /&gt;
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. &lt;br /&gt;
* The alignment (size+7)&amp;amp;~7 calculation before allocation was not checked for integer overflow.&lt;br /&gt;
&lt;br /&gt;
This might allow for ARM11 kernel code-execution.&lt;br /&gt;
&lt;br /&gt;
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] complementary&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions&lt;br /&gt;
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn&#039;t check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.1.0-8]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11 kernel didn&#039;t check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don&#039;t have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions&lt;br /&gt;
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== [[FIRM]] Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Services|&amp;quot;srv:pm&amp;quot;]] process registration&lt;br /&gt;
| Originally any process had access to the port &amp;quot;srv:pm&amp;quot;. The PID&#039;s used for the (un)registration commands are not checked either. This allowed any process to re-register itself with &amp;quot;srv:pm&amp;quot;, and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] &amp;quot;srv:pm&amp;quot; is now a service instead of a globally accessible port. Only processes with PID&#039;s less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for &amp;quot;srv:pm&amp;quot; open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.&lt;br /&gt;
&lt;br /&gt;
This flaw was needed for exploiting the &amp;lt;=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don&#039;t have access to those service(s).&lt;br /&gt;
| Access to arbitrary services&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| FSDIR null-deref&lt;br /&gt;
| [[Filesystem_services|FS]]-module may crash in some cases when handling directory reading. The trigger seems to be due to using [[FSDir:Close]] without closing the dir-handle afterwards?(Perhaps this is caused by out-of-memory?) This seems to be useless since it&#039;s just a null-deref.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| May 19(?)-20, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in system-module system-version&lt;br /&gt;
!  Last system-module system-version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Timeframe this was added to wiki&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[MP:SendDataFrame]] missing input array index validation&lt;br /&gt;
| [[MP:SendDataFrame]] doesn&#039;t validate the input index at cmdreq[1], unless the function for flag=non-zero is executed. This is used to calculate the following, without validating the index at all: someptr = stateptr + (index*0x924) + somestateoffset.&lt;br /&gt;
&lt;br /&gt;
After validating some flags from someptr, when input_flag=0 the input buffer data is copied to someptr+someotheroffset+0x14 with the u16 size loaded from someptr+someotheroffset.&lt;br /&gt;
&lt;br /&gt;
With a large input index someptr could be setup to be at a &amp;lt;target address&amp;gt;, for overwriting memory.&lt;br /&gt;
&lt;br /&gt;
This is probably difficult to exploit.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[8.0.0-18]](MP-sysmodule v2048)&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MP_Services|MP]] cmd1 out-of-bounds handle read&lt;br /&gt;
| MP-sysmodule handles the input parameter for cmd1 as a s32. It checks for &amp;gt;=16, but not &amp;lt;0. With &amp;lt;16 it basically does the following(array of entries 4-bytes each): *outhandle = ((Handle*)(stateptr+offsetinstate))[inputindex].&lt;br /&gt;
&lt;br /&gt;
Hence, this can be used to load any handle in MP-sysmodule memory. MP doesn&#039;t really have any service handles of interest however(can be obtained from elsewhere too).&lt;br /&gt;
| Reading any handle in MP-sysmodule memory.&lt;br /&gt;
| None&lt;br /&gt;
| [[8.0.0-18]](MP-sysmodule v2048)&lt;br /&gt;
| January 21, 2017&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| AM stack/.bss infoleak via [[AM:ReadTwlBackupInfo]]([[AM:ReadTwlBackupInfoEx|Ex]])&lt;br /&gt;
| After writing the output-info structure to stack, it then copies that structure to the output buffer ptr using the size from the command. The size is not checked. This could be used to read data from the AM-service-thread stack handling the command + .bss.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This was not tested on hardware.&#039;&#039;&#039;&lt;br /&gt;
| Stack/.bss reading&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27]](AM v9217)&lt;br /&gt;
| Roughly October 17, 2016&lt;br /&gt;
| October 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MVD_Services|MVD]]: Stack buffer overflow with [[MVDSTD:SetupOutputBuffers]].&lt;br /&gt;
| The input total_entries is not validated when initially processing the input entry-list. This fixed-size input entry-list is copied to stack from the command request. The loop for processing this initializes a global table, the converted linearmem-&amp;gt;physaddrs used there are also copied to stack(0x8-bytes of physaddrs per entry).&lt;br /&gt;
&lt;br /&gt;
If total_entries is too large, MVD-sysmodule will crash due to reading unmapped memory following the stack(0x10000000). Afterwards if the out-of-bounds total_entries is smaller than that, it will crash due accessing address 0x0, hence this useless.&lt;br /&gt;
| MVD-sysmodule crash.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| April 22, 2016 (Tested on the 25th)&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]]: Using CTRSDK heap with UDS sharedmem from the user-process.&lt;br /&gt;
| See the HTTP-sysmodule section below.&lt;br /&gt;
&lt;br /&gt;
CTRSDK heap is used with the sharedmem from [[NWMUDS:InitializeWithVersion]]. Buffers are allocated/freed under this heap using [[NWMUDS:Bind]] and [[NWMUDS:Unbind]].&lt;br /&gt;
&lt;br /&gt;
Hence, overwriting sharedmem with gspwn then using [[NWMUDS:Unbind]] results in the usual controlled CTRSDK memchunk-header write, similar to HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This could be done by creating an UDS network, without any other nodes on the network.&lt;br /&gt;
&lt;br /&gt;
Besides CTRSDK memchunk-headers, there are no addresses stored under this sharedmem.&lt;br /&gt;
| ROP under NWM-module.&lt;br /&gt;
| [[11.4.0-37|11.4.0-X]]&lt;br /&gt;
| [[9.0.0-20|9.0.0-X]]&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| April 16, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds memory access during spectator [[Download_Play|data-frame]] checksum calculation&lt;br /&gt;
| DLP doesn&#039;t validate the frame_size when receiving spectator data-frames at all, unlike non-spectator data-frames. The actual spectator data-frame parsing code doesn&#039;t use that field either. However, the data-frame checksum calculation code called during checksum verification does use the frame_size for loading the size of the framebuf.&lt;br /&gt;
&lt;br /&gt;
Hence, using a large frame_size like 0xFFFF will result in the checksum calculation code reading data out-of-bounds. This isn&#039;t really useful, you could trigger a remote local-WLAN DLP-sysmodule crash while a 3DS system is scanning for DLP networks(due to accessing unmapped memory), but that&#039;s about all(trying to infoleak with this likely isn&#039;t useful either).&lt;br /&gt;
| DLP-sysmodule crash, handled by dlplay system-application by a &amp;quot;connection interrupted&amp;quot; error eventually then a fatal-error via ErrDisp.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8, 2016 (Tested on the 10th)&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds output data writing during spectator sysupdate titlelist [[Download_Play|data-frame]] handling&lt;br /&gt;
| The total_entries and out_entryindex fields for the titlelist DLP spectator data-frames are not validated. This is parsed during DLP network scanning. Hence, the specified titlelist data can be written out-of-bounds using the specified out_entryindex and total_entries. A crash will occur while reading the input data-frame titlelist if total_entries is larger than 0x27A, due to accessing unmapped memory.&lt;br /&gt;
&lt;br /&gt;
There&#039;s not much non-zero data to overwrite following the output buffer(located in sharedmem), any ptrs are located in sharedmem. Overwriting certain ptr(s) are only known to cause a crash when attempting to use the DLP-client shutdown service-command.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to exploit the above crash, since the linked-list code involves writes zeros(with a controlled start ptr).&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8-9, 2016&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[IR_Services|IR]]: Stack buffer overflow with custom hardware&lt;br /&gt;
| Originally IR sysmodule used the read value from the I2C-IR registers TXLVL and RXLVL without validating them at all. See [[10.6.0-31|here]] for the fix. This is the size used for reading the data-recv FIFO, etc. The output buffer for reading is located on the stack.&lt;br /&gt;
&lt;br /&gt;
This should be exploitable if one could successfully setup the custom hardware for this and if the entire intended sizes actually get read from I2C.&lt;br /&gt;
| ROP under IR sysmodule.&lt;br /&gt;
| [[10.6.0-31|10.6.0-31]]&lt;br /&gt;
| &lt;br /&gt;
| February 23, 2016 (Unknown if it was noticed before then)&lt;br /&gt;
| February 23, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HTTP_Services|HTTP]]: Using CTRSDK heap with sharedmem from the user-process.&lt;br /&gt;
| The data from httpcAddPostDataAscii and other commands is stored under a CTRSDK heap. That heap is the sharedmem specified by the user-process via the HTTPC Initialize command.&lt;br /&gt;
Normally this sharedmem isn&#039;t accessible to the user-process once the sysmodule maps it, hence using it is supposed to be &amp;quot;safe&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This isn&#039;t the case due to gspwn however. Since CTRSDK heap code is so insecure in general, one can use gspwn to locate the HTTPC sharedmem + read/write it, then trigger a mem-write under the sysmodule. This can then be used to get ROP going under HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This is exploited by [https://github.com/yellows8/ctr-httpwn/ctr-httpwn ctr-httpwn].&lt;br /&gt;
| ROP under HTTP sysmdule.&lt;br /&gt;
| [[11.4.0-37|11.4.0-X]]&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] (Latest sysmodule version as of [[10.7.0-32|10.7.0-32]])&lt;br /&gt;
| Late 2015&lt;br /&gt;
| March 22, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NIM_Services|NIM]]: Downloading old title-versions from eShop&lt;br /&gt;
| Multiple NIM service commands(such as [[NIMS:StartDownload]]) use a title-version value specified by the user-process, NIM does not validate that this input version matches the latest version available via SOAP. Therefore, when combined with AM(PXI) [[#Process9|title-downgrading]] via deleting the target eShop title with System Settings Data Management(if the title was already installed), this allows downloading+installing any title-version from eShop &#039;&#039;if&#039;&#039; it&#039;s still available from CDN.&lt;br /&gt;
The easiest way to exploit this is to just patch the eShop system-application code using these NIM commands(ideally the code which loads the title-version).&lt;br /&gt;
&lt;br /&gt;
Originally this was tested with a debugging-system via modded-FIRM, eventually smea implemented it in HANS for the 32c3 release.&lt;br /&gt;
| Downloading old title-versions from eShop&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| October 24, 2015 (Unknown when exactly the first eShop title downgrade was actually tested, maybe November)&lt;br /&gt;
| January 7, 2016 (Same day Ironfall v1.0 was removed from CDN via the main-CXI files)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SPI_Services|SPI]] service out-of-bounds write&lt;br /&gt;
| cmd1 has out-of-bounds write allowing overwrite of some static variables in .data.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NFC_Services|NFC]] module service command buf-overflows&lt;br /&gt;
| NFC module copies data with certain commands, from command input buffers to stack without checking the size. These commands include the following, it&#039;s unknown if there&#039;s more commands with similar issues: &amp;quot;nfc:dev&amp;quot; &amp;lt;0x000C....&amp;gt; and &amp;quot;nfc:s&amp;quot; &amp;lt;0x0037....&amp;gt;.&lt;br /&gt;
Since both of these commands are stubbed in the Old3DS NFC module from the very first version(those just return an error), these issues only affect the New3DS NFC module.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known retail titles which have access to either of these services.&lt;br /&gt;
| ROP under NFC module.&lt;br /&gt;
| New3DS: None&lt;br /&gt;
| New3DS: [[9.5.0-22]]&lt;br /&gt;
| December 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[News_Services|NEWSS]] service command notificationID validation failure&lt;br /&gt;
| This module does not validate the input notificationID for &amp;lt;nowiki&amp;gt;&amp;quot;news:s&amp;quot;&amp;lt;/nowiki&amp;gt; service commands. This is an out-of-bounds array index bug. For example, [[NEWSS:SetNotificationHeader]] could be used to exploit news module: this copies the input data(size is properly checked) to: out = newsdb_savedata+0x10 + (someu32array[notificationID]*0x70).&lt;br /&gt;
| ROP under news module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.7.0-25|9.7.0-X]]&lt;br /&gt;
| December 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData]] heap buffer overflow&lt;br /&gt;
| input_size = 0x1E * &amp;lt;value the u8 from input_[[NWM_Services|networkstruct]]+0x1D&amp;gt;. Then input_tag0 is copied to a heap buffer. When input_size is larger than 0xFA-bytes, it will then copy input_tag1 to &amp;lt;end_address_of_previous_outbuf&amp;gt;, with size=input_size-0xFA.&lt;br /&gt;
&lt;br /&gt;
This can be triggered by either using this command directly, or by boadcasting a wifi beacon which triggers it while a 3DS system running the target process is in range, when the process is scanning for hosts to connect to. Processes will only pass tag data to this command when the wlancommID and other thing(s) match the values for the process.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to actually exploit this for getting ROP under NWM-module, at the time of originally adding this to the wiki. This is because the data which gets copied out-of-bounds *and* actually causes crash(es), can&#039;t be controlled it seems(with just broadcasting a beacon at least). It&#039;s unknown whether this could be exploited from just using NWMUDS service-cmd(s) directly.&lt;br /&gt;
| Without any actual way to exploit this: NWM-module DoS, resulting in process termination(process crash). This breaks *everything* involving wifi comms, a reboot is required to recover from this.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| ~September 23, 2014(see the [[NWMUDS:DecryptBeaconData]] page history)&lt;br /&gt;
| August 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HID_Services|HID]] module shared-mem&lt;br /&gt;
| HID module does not validate the index values in [[HID_Shared_Memory|sharedmem]](just changes index to 0 when index == maxval when updating), therefore large values will result in HID module writing HID data to arbitrary addresses.&lt;br /&gt;
| ROP under HID module, but this is *very* unlikely to be exploitable since the data written is HID data.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| gspwn&lt;br /&gt;
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you&#039;re running under, and gain real code-execution from a ROP-chain. Normally applets&#039; .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).&lt;br /&gt;
&lt;br /&gt;
FCRAM is gpu-accessible up to physaddr 0x26800000 on Old3DS, and 0x2D800000 on New3DS. This is BASE_memregion_start(aka SYSTEM_memregion_end)-0x400000 (0x800000 with New3DS) with the default memory-layout on Old3DS/New3DS. With [[11.3.0-36|11.3.0-X]] the cutoff now varies due to the new [[SVC]] 0x59. The New3DS &amp;quot;normal&amp;quot;(non-APPLICATION) cutoff was changed to 0x2D000000 due to the new [[SVC]] 0x59.&lt;br /&gt;
| User-mode code execution.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| Early 2014&lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Yellows8|Yellows8]]/others before then&lt;br /&gt;
|-&lt;br /&gt;
| rohax&lt;br /&gt;
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.&lt;br /&gt;
&lt;br /&gt;
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.&lt;br /&gt;
| Memory-mapping syscalls.&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| [[9.4.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Plutooo|plutoo]] joint effort&lt;br /&gt;
|-&lt;br /&gt;
| Region free&lt;br /&gt;
| Only [[Home Menu]] itself checks gamecards&#039; region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.&lt;br /&gt;
This essentially means launching the gamecard with the [[NS_and_APT_Services|&amp;quot;ns:s&amp;quot;]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].&lt;br /&gt;
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation&lt;br /&gt;
| None&lt;br /&gt;
| Last tested with [[10.1.0-27|10.1.0-X]].&lt;br /&gt;
| June(?) 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]] service-cmd state null-ptr deref&lt;br /&gt;
| The NWMUDS service command code loads a ptr from .data, adds an offset to that, then passes that as the state address for the actual command-handler function. The value of the ptr loaded from .data is not checked, therefore this will cause crashes due to that being 0x0 when NWMUDS was not properly initialized.&lt;br /&gt;
It&#039;s unknown whether any NWM services besides NWMUDS have this issue.&lt;br /&gt;
| This is rather useless since it&#039;s only a crash caused by a state ptr based at 0x0.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== General/CTRSDK ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|UDS]] beacon additional-data buffer overflow&lt;br /&gt;
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.&lt;br /&gt;
This was discovered while doing code RE with an old dlp-module version. It&#039;s unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown if there&#039;s any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can&#039;t be exploited with this).&lt;br /&gt;
&lt;br /&gt;
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.&lt;br /&gt;
| Perhaps ROP, very difficult if possible with anything at all&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| September(?) 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| CTPK buffer overflow&lt;br /&gt;
| At offset 0x20 in CTPK is an array for each texture, each entry is 0x20-bytes. This contains a wordindex(entry+0x18) for some srcdata relative to CTPK+0, and an u8 wordsize(entry+0x14) for this data. The CTRSDK function handling this doesn&#039;t validate the size, when copying srcdata using this size to the output buffer. Applications usually have the output buffer on the stack, hence stack buffer overflow.&lt;br /&gt;
&lt;br /&gt;
While CTPK(*.ctpk) are normally only loaded from RomFS, some application(s) load from elsewhere too.&lt;br /&gt;
| ROP under the target application.&lt;br /&gt;
| None?&lt;br /&gt;
| &amp;quot;[SDK+NINTENDO:CTR_SDK-11_4_0_200_none]&amp;quot;&lt;br /&gt;
| November 14, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=19830</id>
		<title>3DS System Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=19830"/>
		<updated>2017-04-11T00:22:10Z</updated>

		<summary type="html">&lt;p&gt;SciresM: safefirmhax 1.1 description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of publicly known system flaws, for userland applications/applets flaws see [[3DS_Userland_Flaws|here]].&lt;br /&gt;
&lt;br /&gt;
=Stale / Rejected Efforts=&lt;br /&gt;
* Neimod has been working on a RAM dumping setup for a little while now. He&#039;s de-soldered the 3DS&#039;s RAM chip and hooked it and the RAM pinouts on the 3DS&#039; PCB up to a custom RAM dumping setup. A while ago he published photos showing his setup to be working quite well, with the 3DS successfully booting up. However, his flickr stream is now private along with most of his work.&lt;br /&gt;
&lt;br /&gt;
* Someone (who will remain unnamed) has released CFW and CIA installers, all of which is copied from the work of others, or copyrighted material.&lt;br /&gt;
&lt;br /&gt;
==Tips and info==&lt;br /&gt;
The 3DS uses the XN feature of the ARM11 processor. There&#039;s no official way from applications to enable executable permission for memory containing arbitrary unsigned code(there&#039;s a [[SVC]] for this, but only [[RO_Services|RO-module]] has access to it). A usable userland exploit would still be useful: you could only do return-oriented-programming with it initially. From ROP one could then exploit system flaw(s), see below.&lt;br /&gt;
&lt;br /&gt;
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped(accessing SD data is far easier by running code on the target 3DS however).&lt;br /&gt;
&lt;br /&gt;
=System flaws=&lt;br /&gt;
== Hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed with hardware model/revision&lt;br /&gt;
!  Newest hardware model/revision this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| ARM9/ARM11 bootrom vectors point at uninitialized RAM&lt;br /&gt;
| ARM9&#039;s and ARM11&#039;s exception vectors are hardcoded to point at the CPU&#039;s internal memory (0x08000000 region for ARM9, AXIWRAM for ARM11). While the bootrom does set them up to point to an endless loop at some point during boot, it does not do so immediately. As such, a carefully-timed fault injection (via hardware) to trigger an exception (such as an invalid instruction) will cause execution to fall into ARM9 RAM. &lt;br /&gt;
Since RAM isn&#039;t cleared on boot (see below), one can immediately start execution of their own code here to dump bootrom, OTP, etc.&lt;br /&gt;
The ARM9 bootrom does the following at reset:  reset vector branches to another instruction, then branches to bootrom+0x8000. Hence, there&#039;s no way to know for certain when exactly the ARM9 exception-vector data stored in memory gets initialized.&lt;br /&gt;
&lt;br /&gt;
This requires *very* *precise* timing for triggering the hardware fault.&lt;br /&gt;
&lt;br /&gt;
It has been exploited by derrek to dump the ARM9 bootrom as of Summer 2015.&lt;br /&gt;
| None: all available 3DS models at the time of writing have the exact same ARM9/ARM11 bootrom for the unprotected areas.&lt;br /&gt;
| New3DS&lt;br /&gt;
| End of February 2014&lt;br /&gt;
| [[User:Derrek|derrek]], WulfyStylez (May 2015) independently&lt;br /&gt;
|-&lt;br /&gt;
| Missing AES key clearing&lt;br /&gt;
| The hardware AES engine does not clear keys when doing a hard reset/reboot.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| August 2014&lt;br /&gt;
| Mathieulh/Others&lt;br /&gt;
|-&lt;br /&gt;
| No RAM clearing on reboots&lt;br /&gt;
| On an MCU-triggered reboot all RAM including FCRAM/ARM9 memory/AXIWRAM/VRAM keeps its contents.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2014&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| 32bits of actual console-unique TWLNAND keydata&lt;br /&gt;
| On retail the 8-bytes at ARM9 address [[Memory_layout|0x01FFB808]] are XORed with hard-coded data, to generate the TWL console-unique keys, including TWLNAND. On Old3DS the high u32 is always 0x0, while on New3DS that u32 is always 0x2. On top of this, the lower u32&#039;s highest bit is always ORed. only 31 bits of the TWL console-unique keydata / TWL consoleID are actually console-unique.&lt;br /&gt;
This allows one to easily bruteforce the TWL console-unique keydata with *just* data from TWLNAND. On DSi the actual console-unique data for key generation is 8-bytes(all bytes actually set).&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| DSi / 3DS-TWL key-generator&lt;br /&gt;
| After using the key generator to generate the normal-key, you could overwrite parts of the normal-key with your own data and then recover the key-generator output by comparing the new crypto output with the original crypto output. From the normal-key outputs, you could deduce the TWL key-generator function.&lt;br /&gt;
This applies to the keyX/keyY too.&lt;br /&gt;
&lt;br /&gt;
This attack does not work for the 3DS key-generator because keyslots 0-3 are only for TWL keys.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2011&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| 3DS key-generator&lt;br /&gt;
| The algorithm for generating the normal-keys for keyslots is cryptographically weak.  As a result, it is easily susceptible to differential cryptanalysis if the normal-key corresponding to any scrambler-generated keyslot is discovered.&lt;br /&gt;
&lt;br /&gt;
Several such pairs of matching normal-keys and KeyY values were found, leading to deducing the key-generator function.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| FIRM partitions known-plaintext&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are encrypted with AES-CTR without a MAC. Since this works by XOR&#039;ing data with a static (per-console in this case) keystream, one can deduce the keystream of a portion of each FIRM partition if they have the actual FIRM binary stored in it.&lt;br /&gt;
&lt;br /&gt;
This can be paired with many exploits. For example, it allows minor FIRM downgrades (i.e. 10.4 to 9.6 or 9.5 to 9.4, but not 9.6 to 9.5).&lt;br /&gt;
&lt;br /&gt;
This can be somewhat addressed by having a FIRM header skip over previously used section offsets, but this would just air-gap newer FIRMs without fixing the core bug. This can also only be done a limited number of times due to the size of FIRM versus the size of the partitions.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| &lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| RSA keyslots don&#039;t clear exponent when setting modulus&lt;br /&gt;
| The [[RSA_Registers|RSA keyslots]] are set by boot ROM to have four private RSA keys.  The exponent value in the RSA registers is write-only and not readable.&lt;br /&gt;
&lt;br /&gt;
However, when setting a keyslot&#039;s modulus, the RSA hardware leaves the exponent alone.  This allows retrieving the exponent by doing a discrete logarithm of the output.&lt;br /&gt;
&lt;br /&gt;
By setting the modulus to a prime number whose modular multiplicative order is &amp;quot;smooth&amp;quot; (that is, p-1 is divisible by only small prime numbers), discrete logarithms can be calculated quickly using the [[wikipedia:Pohlig-Hellman algorithm|Pohlig-Hellman algorithm]].  If the prime chosen is greater than the modulus, but the same bit size, the discrete logarithm is the private exponent.&lt;br /&gt;
&lt;br /&gt;
This exploit&#039;s usefulness is limited: RSA keyslot 0 is only used in current firmware for deriving the 6.x save and 7.x NCCH keys, which were already known, and the other three keyslots are entirely unused.  Additionally, with a boot ROM dump, this exploit is moot; these private keys are located in the protected ARM9 boot ROM.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2016&lt;br /&gt;
| [[User:Myria|Myria]]&lt;br /&gt;
|-&lt;br /&gt;
| Boot9 AES keyinit function issues&lt;br /&gt;
| [[Bootloader|Boot9]] seems to have two bugs in the AES key-init function, see [[AES_Registers#AES_key-init|here]].&lt;br /&gt;
| None&lt;br /&gt;
| BootROM issue.&lt;br /&gt;
| 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]] allowing acccess to AXIWRAM/FCRAM-BASE-memregion&lt;br /&gt;
| [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]] can be configured by anything with access to it to allow the GPU to access the entire AXIWRAM+FCRAM. For example, this is an issue for any sysmodule that gets exploited and has access to this register memory-page(include one that&#039;s listed below).&lt;br /&gt;
&lt;br /&gt;
See also &amp;quot;kernelhax via gspwn&amp;quot; below.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 7, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM9 software ==&lt;br /&gt;
&lt;br /&gt;
=== arm9loader ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Generating the keysector console-unique keys with ITCM+Boot9&lt;br /&gt;
| [[Bootloader|Boot9]] decrypts the 0x100-byte [[OTP_Registers|OTP]] using AES-CBC with keydata stored in Boot9. If hash verification is successful, the plaintext of the first 0x90-bytes are copied into [[Memory_layout|ITCM]]. This is the &#039;&#039;exact&#039;&#039; &#039;&#039;same&#039;&#039; region hashed by arm9loader when generating the console-unique keys for decrypting the keysector, except arm9loader uses the raw encrypted OTP.&lt;br /&gt;
&lt;br /&gt;
Therefore, with the OTP keydata+IV from Boot9 you can: encrypt the 0x90-bytes from ITCM, then hash the output to get the console-unique keys for the system&#039;s keysector. This can even be done for Old3DS which doesn&#039;t have the arm9loader keysector officially.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown why arm9loader only used the first 0x90-bytes of OTP. Using more data from OTP would&#039;ve prevented this. Fixing this would require doing exactly that, but that would also mean updating the NAND keysector(which is dangerous).&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| &lt;br /&gt;
| 2015&lt;br /&gt;
| January 6, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Rearrangable keys in the NAND keystore&lt;br /&gt;
| Due to the keystore being encrypted with AES-ECB, one can rearrange blocks and still have the NAND keystore decrypt in a deterministic way. &lt;br /&gt;
&lt;br /&gt;
Using 10.0 FIRM it is possible to rearrange keys such that ARM9 memory is executed. As such using existing ARM9 execution 10.0 FIRM can be written to NAND and a payload written to memory, with the payload to be executed post-K9L using an MCU reboot.&lt;br /&gt;
| arm9loaderhax given existing ARM9 code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| Early 2016&lt;br /&gt;
| 27 September 2016&lt;br /&gt;
| Myria, [[User:Dark samus|dark_samus]]; mathieulh (independently); [[User:Plutooo|plutoo]] (independently) + others&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared OTP hash keydata in console-unique 0x11 key-generation&lt;br /&gt;
| Kernel9Loader does not clear the [[SHA_Registers#SHA_HASH|SHA_HASH register]] after use. As a result, the data stored here as K9L hands over to Kernel9 is the hash of [[OTP_Registers|OTP data]] used to seed the [[FIRM#New_3DS_FIRM|console-unique NAND keystore decryption key]] set on keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Retrieving this keydata and the [[Flash_Filesystem#0x12C00|NAND keystore]] of the same device allows calculating the decrypted New3DS NAND keystore (non-unique, common to all New3DS units), which contains AES normal keys, also set on keyslot 0x11, which are then used to derive all current [[AES_Registers#Keyslots|New3DS-only AES keyXs]] including the newer batch introduced in [[9.6.0-24#arm9loader|9.6.0-X]]. From there, it is trivial to perform the same key derivation in order to initialize those keys on any system version, and even on Old3DS.&lt;br /&gt;
&lt;br /&gt;
This can be performed by exploiting the &amp;quot;arm9loaderhax&amp;quot; vulnerability to obtain post-K9L code execution after an MCU reboot (the bootrom section-loading fail is not relevant here, this attack was performed without OTP data by brute-forcing keys), and using this to dump the SHA_HASH register. This attack works on any FIRM version shipping a vulnerable version of K9L, whereas OTP dumping required a boot of &amp;lt;[[3.0.0-6|3.0.0-X]].&lt;br /&gt;
&lt;br /&gt;
This attack results in obtaining the entire (0x200-bytes) NAND keystore - it was confirmed at a later date that this keystore is encrypted with the same key (by comparing the decrypted data from multiple units), and therefore using another key in this store will not remedy the issue as all keys are known (i.e. later, unused keys decrypt to the same 0x200-bytes constant with the same OTP hash). Later keys could have been encrypted differently but this is not the case. As a result of this, it is not possible for Nintendo to use K9L again in its current format for its intended purpose, though this was not news from the moment people dumped a New3DS OTP.&lt;br /&gt;
| Derivation of all New3DS keys generated via the NAND keystore (0x1B &amp;quot;Secure4&amp;quot; etc.)&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| ~April 2015, implemented in May 2015&lt;br /&gt;
| 13 January 2016&lt;br /&gt;
| [[User:WulfyStylez|WulfyStylez]], [[User:Dazzozo|Dazzozo]], [[User:Shinyquagsire23|shinyquagsire23]] (complimentary + implemented), [[User:Plutooo|plutoo]], Normmatt (discovered independently)&lt;br /&gt;
|-&lt;br /&gt;
| enhanced-arm9loaderhax&lt;br /&gt;
| See the 32c3 3ds talk.&lt;br /&gt;
Since this is a combination of a trick with the arm9-bootrom + arm9loaderhax, and since you have to manually write FIRM to the firm0/firm1 NAND partitions, this can&#039;t be completely fixed. Any system with existing ARM9 code execution and an OTP/OTP hash dump can exploit this. Additionally, by using the FIRM partition known-plaintext bug and bruteforcing the second entry in the keystore, this can currently be exploited on all New3DS systems without any other prerequisite hacks.&lt;br /&gt;
| arm9loaderhax which automatically occurs at hard-boot.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| Theorized around mid July, 2015. Later implemented+tested by [[User:Plutooo|plutoo]] and [[User:Derrek|derrek]].&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Missing verification-block for the 9.6 keys (arm9loaderhax)&lt;br /&gt;
| Starting with [[9.6.0-24|9.6.0-X]] a new set of NAND-based keys were introduced. However, no verification block was added to verify that the new key read from NAND is correct. This was technically an issue from [[9.5.0-22|9.5.0-X]] with the original sector+0 keydata, however the below is only possible with [[9.6.0-24|9.6.0-X]] since keyslots 0x15 and 0x16 are generated from different 0x11 keyXs.&lt;br /&gt;
&lt;br /&gt;
Writing an incorrect key to NAND will cause arm9loader to decrypt the ARM9 kernel as garbage and then jump to it.&lt;br /&gt;
&lt;br /&gt;
This allows an hardware-based attack where you can boot into an older exploited firmware, fill all memory with NOP sleds/jump-instructions, and then reboot into executing garbage. By automating this process with various input keydata, eventually you&#039;ll find some garbage that jumps to your code.&lt;br /&gt;
&lt;br /&gt;
This gives very early ARM9 code execution (pre-ARM9 kernel). As such, it is possible to dump RSA keyslots with this and calculate the 6.x [[Savegames#6.0.0-11_Savegame_keyY|save]], and 7.x [[NCCH]] keys. This cannot be used to recover keys initialized by arm9loader itself. This is due to it wiping the area used for its stack during NAND sector decryption and keyslot init. &lt;br /&gt;
&lt;br /&gt;
Due to FIRMs on both Old and New 3DS using the same RSA data, this can be exploited on Old3DS as well, but only if one already has the actual plaintext normalkey from New3DS NAND sector 0x96 offset-0 and has dumped the OTP area of the Old3DS.&lt;br /&gt;
| Recovery of 6.x [[Savegames#6.0.0-11_Savegame_keyY|save key]]/7.x [[NCCH]] key, access to uncleared OTP hash keydata&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| March, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared New3DS keyslot 0x11&lt;br /&gt;
| Originally the New3DS [[FIRM]] arm9bin loader only cleared keyslot 0x11 when it gets executed at firmlaunch. This was fixed with [[9.5.0-22|9.5.0-X]] by completely clearing keyslot 0x11 immediately after the loader finishes using keyslot 0x11.&lt;br /&gt;
This means that any ARM9 code that can execute before the loader clears the keyslot at firmlaunch(including firmlaunch-hax) can get access to the uncleared keyslot 0x11, which then allows one to generate all &amp;lt;=v9.5 New3DS keyXs which are generated by keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Therefore, to completely fix this the loader would have to generate more keys using different keyslot 0x11 keydata. This was done with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| New3DS keyXs generation&lt;br /&gt;
| Mostly fixed with [[9.5.0-22|9.5.0-X]], completely fixed with new keys with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| &lt;br /&gt;
| February 3, 2015 (one day after [[9.5.0-22|9.5.0-X]] release)&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Process9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-scrambler key&lt;br /&gt;
| New 3DS firmware versions [[8.1.0-0 New3DS|8.1.0]] through [[9.2.0-20|9.2.0]] set the encryption key for [[Amiibo]] data using a hardcoded normal-key in Process9.  In firmware [[9.3.0-21|9.3.0]], Nintendo &amp;quot;fixed&amp;quot; this by using the key scrambler instead, by calculating the keyY value for keyslot 0x39 that results in the same normal-key, then hardcoding that keyY into Process9.&lt;br /&gt;
&lt;br /&gt;
Nintendo&#039;s fix is actually the problem: Nintendo revealed the normal-key matching an unknown keyX and a known keyY.  Combined with the key scrambler using an insecure scrambling algorithm (see &amp;quot;Hardware&amp;quot; above), the key scrambler function could be deduced.&lt;br /&gt;
| Deducing the keyX for keyslot 0x39 and the key scrambler algorithm&lt;br /&gt;
| New 3DS [[9.3.0-21|9.3.0-X]], sort of&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| Sometime in 2015 after the hardware key-generator was broken.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-generator key&lt;br /&gt;
| During the 3DS&#039; development (June/July 2010) Nintendo added support installing encrypted content ([[CIA]]). Common-key index1 was intended to be a [[AES|hardware generated key]]. However while they added code to generate the key in hardware, they forgot to remove the normal-key for index1 (used elsewhere, likely old debug code). Nintendo later removed the normal key sometime before the first non-prototype firmware release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing the keyY and the normal-key for common-key index1, the devkit key-generator algorithm can be deduced (see &amp;quot;Hardware&amp;quot; above). Additionally the remaining devkit common-keys can be generated once the common-key keyX is recovered.&lt;br /&gt;
&lt;br /&gt;
Note the devkit key-generator was discovered to be the same as the retail key-generator.&lt;br /&gt;
| Deducing the keyX for keyslot 0x3D and hardware key-generator algorithm. Generate remaining devkit common-keys.&lt;br /&gt;
| pre-[[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| Shortly after the key-generator was revealed to be flawed at the 32c3 3ds talk&lt;br /&gt;
| January 20, 2016&lt;br /&gt;
| [[User:Jakcron|jakcron]]&lt;br /&gt;
|-&lt;br /&gt;
| safefirmhax&lt;br /&gt;
| SAFE_MODE_FIRM is almost never updated(even when NATIVE_FIRM is updated for vuln fixes), this can be noticed by &#039;&#039;just&#039;&#039; checking 3dbrew/ninupdates title-listings.&lt;br /&gt;
&lt;br /&gt;
The fix for firmlaunch-hax was only applied to NATIVE_FIRM in [[9.5.0-22|9.5.0-X]], leaving SAFE_FIRM exploitable. With ARM11-kernel execution, one can trigger FIRM-launch in to SAFE_FIRM, do Kernel9 &amp;lt;=&amp;gt; Kernel11 sync, PXI sync and then repeat the original attack on SAFE_FIRM instead.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012-2013?&lt;br /&gt;
| Wiki: January 2, 2017&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| safefirmhax 1.1&lt;br /&gt;
| Nintendo&#039;s original safefirmhax fix was flawed -- they added a global boolean that got set to true whenever a non-sysmodule title got launched (except for a hardcoded repair title id), and panic()&#039;d if that boolean was true to prevent launching safefirm after hax was active. However, because the boolean was initially false after firmlaunch -- With ARM11-kernel execution, one could FIRM-launch into NATIVE_FIRM, and then immediately FIRM-launch again into SAFE_FIRM early in NATIVE_FIRM boot before the boolean got set to true to repeat the safehax attack.&lt;br /&gt;
&lt;br /&gt;
This was fixed by adding additional CFG9_BOOTENV checks to firmlaunch code in 11.4.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[11.4.0-36|11.4.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| safefirmhax fix&lt;br /&gt;
| Wiki: April 10, 2017&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| ntrcardhax&lt;br /&gt;
| When reading the banner of a NTR title, Process9 relies on a hardware register to know when the banner was fully read.&lt;br /&gt;
However that register is shared between the ARM9 and the ARM11.&lt;br /&gt;
An attacker with k11 control can so make Process9 believe the banner continues forever and so trigger a buffer overflow.&lt;br /&gt;
With a custom banner for a NTR flashcart, this leads to code execution in Process9.&lt;br /&gt;
&lt;br /&gt;
This was fixed by adding bound checks on the read data.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Title downgrading via [[Application_Manager_Services|AM]]([[Application_Manager_Services_PXI|PXI]])&lt;br /&gt;
| When a title is *already* installed, Process9 will compare the installed title-version with the title-version being installed. When the one being installed is older, Process9 would return an error.&lt;br /&gt;
&lt;br /&gt;
However, this can be bypassed by just deleting the title first via the service command(s) for that: with the title removed from the [[Title_Database]], Process9 can&#039;t compare the input title-version with anything. Hence, titles can be downgraded this way.&lt;br /&gt;
&lt;br /&gt;
[[11.0.0-33|11.0.0-X]] fixed this for key system titles (MSET, Home Menu, spider, ErrDisp, SKATER, NATIVE_FIRM, and every retail system module), by checking the version of the title to install against a hard-coded list of (titleID, minimumVersionRequired) pairs.&lt;br /&gt;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], for key system titles.&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| FAT FS code null-deref&lt;br /&gt;
| When FSFile:Read is used with a file which is corrupted on a FAT filesystem(in particular SD), Process9 can crash. This particular crash is caused by a function returning NULL instead of an actual ptr due to an error. The caller of that function doesn&#039;t check for NULL which then triggers a read based at NULL.&lt;br /&gt;
&lt;br /&gt;
Sample &amp;quot;fsck.vfat -n -v -V &amp;lt;fat image backup&amp;gt;&amp;quot; output for the above crash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;...&lt;br /&gt;
Starting check/repair pass.&lt;br /&gt;
&amp;lt;FilePath0&amp;gt; and&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 share clusters.&lt;br /&gt;
 Truncating second to 3375104 bytes.&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 File size is 2787392 bytes, cluster chain length is 16384 bytes.&lt;br /&gt;
 Truncating file to 16384 bytes.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Reclaimed 1 unused cluster (16384 bytes).&lt;br /&gt;
Checking free cluster summary.&lt;br /&gt;
Free cluster summary wrong (1404490 vs. really 1404491)&lt;br /&gt;
 Auto-correcting.&lt;br /&gt;
Starting verification pass.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Leaving filesystem unchanged.&amp;lt;/pre&amp;gt;&lt;br /&gt;
| Useless null-based-read&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| July 8-9, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| RSA signature padding checks&lt;br /&gt;
| The TWL_FIRM RSA sig padding check code used for all TWL RSA sig-checks has issues, see [[FIRM|here]].&lt;br /&gt;
The main 3DS RSA padding check code(non-certificate, including NATIVE_FIRM) uses the function used with the above to extract more padding + the actual hash from the additional padding. This isn&#039;t really a problem here because there&#039;s proper padding check code which is executed prior to this.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ValidateDSiWareSectionMAC]] [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| When the input DSiWare section index is higher than &amp;lt;max number of DSiWare sections supported by this FIRM&amp;gt;, Process9 uses keyid 0x40 for calculating the AESMAC, which translates to keyslot 0x40. The result is that the keyslot is left at whatever was already selected before, since the AES selectkeyslot code will immediately  return when keyslot is &amp;gt;=0x40. However, actually exploiting this is difficult: the calculated AESMAC is never returned, this command just compares the calculated AESMAC with the input AESMAC(result-code depends on whether the AESMACs match). It&#039;s unknown whether a timing attack would work with this.&lt;br /&gt;
This is basically a different form of the pxips9 keyslot vuln, except with AESMAC etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| March 15, 2015&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| pxips9 [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| This requires access to the [[Process_Services|ps:ps]]/pxi:ps9 services. One way to get access to this would be snshax on system-version &amp;lt;=10.1.0-X(see 32c3 3ds talk).&lt;br /&gt;
When an invalid key-type value is passed to any of the PS commands, Process9 will try to select keyslot 0x40. That aesengine_setkeyslot() code will then immediately return due to the invalid keyslot value. Since that function doesn&#039;t return any errors, Process9 will just continue to do crypto with whatever AES keyslot was selected before the PS command was sent.&lt;br /&gt;
| Reusing the previously used keyslot, for crypto with PS.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| Roughly the same time(same day?) as firmlaunch-hax.&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| firmlaunch-hax: FIRM header ToCToU&lt;br /&gt;
| This can&#039;t be exploited from ARM11 userland.&lt;br /&gt;
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn&#039;t expect &amp;quot;anything&amp;quot; besides the ARM9 to access this data.&lt;br /&gt;
With [[9.5.0-22]] the address of this FIRM header was changed from a FCRAM address, to ARM9-only address 0x01fffc00.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| &lt;br /&gt;
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Uninitialized data output for (PXI) command replies&lt;br /&gt;
| PXI commands for various services(including some [[Filesystem_services_PXI|here]] and many others) can write uninitialized data (like from ARM registers) to the command reply. This happens with stubbed commands, but this can also occur with certain commands when returning an error.&lt;br /&gt;
Certain ARM11 service commands have this same issue as well.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions&lt;br /&gt;
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.&lt;br /&gt;
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ExportDSiWare]] export path&lt;br /&gt;
| Process9 allocates memory on Process9 heap for the export path then verifies that the actual allocated size matches the input size. Then Process9 copies the input path from FCRAM to this buffer, and uses it with the Process9 FS openfile code, which use paths in the form of &amp;quot;&amp;lt;mountpoint&amp;gt;:/&amp;lt;path&amp;gt;&amp;quot;.&lt;br /&gt;
Process9 does not check the contents of this path at all before passing it to the FS code, besides writing a NUL-terminator to the end of the buffer.&lt;br /&gt;
| Exporting of DSiWare to arbitrary Process9 file-paths, such as &amp;quot;nand:/&amp;lt;path&amp;gt;&amp;quot; etc. This isn&#039;t really useful since the data which gets written can&#039;t be controlled.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DSiWare_Exports]] [[CTCert]] verification&lt;br /&gt;
| Just like DSi originally did, 3DS verifies the APCert for DSiWare on SD with the CTCert also in the DSiWare .bin. On DSi this was fixed with with system-version 1.4.2 by verifying with the actual console-unique cert instead(stored in NAND), while on 3DS it&#039;s still not(?) fixed.&lt;br /&gt;
On 3DS however this is rather useless, due to the entire DSiWare .bin being encrypted with the console-unique movable.sed keyY.&lt;br /&gt;
| When the movable.sed keyY for the target 3DS is known and the target 3DS CTCert private-key is unknown, importing of modified DSiWare SD .bin files.&lt;br /&gt;
| Unknown, probably none.&lt;br /&gt;
| ?&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Gamecard_Services_PXI]] unchecked REG_CTRCARDCNT transfer-size&lt;br /&gt;
| The u8 REG_CTRCARDCNT transfer-size parameter for the [[Gamecard_Services_PXI]] read/write CTRCARD commands is used as an index for an array of u16 values. Before [[5.0.0-11|5.0.0-X]] this u8 value wasn&#039;t checked, thus out-of-bounds reads could be triggered(which is rather useless in this case).&lt;br /&gt;
| Out-of-bounds read for a value which gets written to a register.&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] cmdbuf buffer overrun&lt;br /&gt;
| The Process9 code responsible [[PXI_Registers|PXI]] communications didn&#039;t verify the size of the incoming command before writing it to a C++ member variable. &lt;br /&gt;
| Probably ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015, original timeframe if any unknown&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]/[[User:Yellows8|Yellows8]]/maybe others(?)&lt;br /&gt;
|-&lt;br /&gt;
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])&lt;br /&gt;
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be &amp;lt;=0x2800.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Process_Services_PXI|PS RSA]] commands buffer overflows&lt;br /&gt;
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9&#039;s .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads&#039; stacks. SignRsaSha256 also has a buf overflow, but this isn&#039;t exploitable.&lt;br /&gt;
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] pxi_id bad check&lt;br /&gt;
| The Process9 code responsible for [[PXI_Registers|PXI]] communications read pxi_id as a signed char. There were two flaws:&lt;br /&gt;
* They used it as index to a lookup-table without checking the value at all.&lt;br /&gt;
* Another function verified that pxi_id &amp;lt; 7, allowing negative values to pass the check. This would also cause an out-of-range table-lookup.&lt;br /&gt;
| Maybe ARM9 code execution&lt;br /&gt;
| [[3.0.0-5|3.0.0-5]]&lt;br /&gt;
|&lt;br /&gt;
| March 2015, originally 2012 for the first issue at least&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]], maybe others(?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Kernel9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit1 not set by Kernel9&lt;br /&gt;
| Old versions of Kernel9 never set bit1 of [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]]. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!). Since it&#039;s never locked, you can dump it once you get ARM9 code execution.&lt;br /&gt;
&lt;br /&gt;
From [[3.0.0-5|3.0.0-X]] this was fixed by setting the bit in Kernel9 after poking some registers in that region. On New3DS arm9loader sets this bit instead of Kernel9, which is exploitable through a hardware + software vulnerability (see arm9loaderhax / description).&lt;br /&gt;
&lt;br /&gt;
This flaw resurged when it gained a new practical use: retrieving the OTP data for a New3DS console in order to decrypt the key data used in arm9loader (see enhanced-arm9loaderhax / description). This was performed by downgrading to a vulnerable system version. By accounting for differences in CTR-NAND crypto (0x05 -&amp;gt; 0x04, see partition encryption types [[Flash_Filesystem#NAND_structure|here]]), it is possible to boot a New3DS using Old3DS firmware 1.0-2.X and an Old3DS [[NCSD#NCSD_header|NCSD Header]] to retrieve the required OTP data using this flaw.&lt;br /&gt;
| Dumping of the [[OTP Registers|OTP]] area&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Plutooo|plutoo]], Normmatt independently&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM11 software ==&lt;br /&gt;
=== Kernel11 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcGetThreadList]] process reference leak&lt;br /&gt;
| When given a valid process handle (including &amp;lt;code&amp;gt;0xFFFF8001&amp;lt;/code&amp;gt;), svcGetThreadList forgets to decrement the reference count of the underlying [[KProcess]] instance, after having finished using it.&lt;br /&gt;
| Before [[11.2.0-35|11.2.0-X]]: reference count overflow and therefore use-after-free, but this UAF was most likely not exploitable&lt;br /&gt;
| &lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| April 3, 2017&lt;br /&gt;
| [[User:TuxSH|TuxSH]]&lt;br /&gt;
|-&lt;br /&gt;
| kernelhax via gspwn&lt;br /&gt;
| Originally the kernel didn&#039;t initialize [[CONFIG11_Registers#CFG11_GPUPROT|CFG11_GPUPROT]]. Since it&#039;s 0 at hard-boot, this allowed the GPU to access the entire FCRAM + AXIWRAM.&lt;br /&gt;
| Entire FCRAM+AXIWRAM R/W.&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| February 7, 2017&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] partly&lt;br /&gt;
|-&lt;br /&gt;
| fasthax&lt;br /&gt;
| When a KTimer is created in pulse mode, the kernel calls a virtual function to reset the timer each time it pulses. The scheduler is locked for that core to avoid race conditions, but another core can call CloseHandle on the timer and free it, leading to a UAF vtable call.&lt;br /&gt;
| See description.&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| May 2016&lt;br /&gt;
| nedwill&lt;br /&gt;
|-&lt;br /&gt;
| ipctakeover&lt;br /&gt;
| When sending cmdreplies, it does not validate that the src_addr and src_size match the equivalent dst_addr and dst_size. With a modified addr/size specified in a cmdreply for an output buffer, the data-copy for the first/last pages could be used to overwrite data outside of the buffer specified by the original process.&lt;br /&gt;
&lt;br /&gt;
Used by ctr-httpwn as of v1.2, for &amp;quot;ipctakeover/bosshaxx&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This can be used to takeover processes where the process is using your service session. Like HTTPC -&amp;gt; BOSS, for bosshaxx above. NIM takeover can be done too(actual stack buffer overflow can trigger), etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| November 26, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Using IPC input buffers as output buffers&lt;br /&gt;
| When sending cmdreplies, it does not validate that the cmdreply descriptor type matches the equivalent cmdreq descriptor type. This could be used by an exploited sysmodule to use what was intended as an input-buffer as an output-buffer, and also combine other IPC vuln(s) with this.&lt;br /&gt;
&lt;br /&gt;
Used by ctr-httpwn as of v1.2, for &amp;quot;ipctakeover/bosshaxx&amp;quot;.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| November 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC]] table too small&lt;br /&gt;
|  The table of function pointers for SVC&#039;s only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.&lt;br /&gt;
&lt;br /&gt;
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn&#039;t mapped as executable.&lt;br /&gt;
| &lt;br /&gt;
|  None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC|svcBackdoor (0x7B)]]&lt;br /&gt;
|  This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11 (with NATIVE_FIRM) required patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]] (deleted)&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| veryslowpidhax&lt;br /&gt;
| &#039;&#039;&#039;This is completely different from the kernelmode-code-execution vuln described in the below separate entry.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When updating the kernel global PID counter under [[SVC|svcCreateProcess]] the kernel does not check for wraparound to 0x0(the PID for the very first process). This only matters because [[Services|SM-module]] allows processes with PID value less than &amp;lt;total ARM11 FIRM modules&amp;gt; to access &#039;&#039;all&#039;&#039; services, without checking exheader service-access-control; and because Kernel11 checks for the PID to be 1 (loader) to use the input mem-region value on ControlMemory. This alone does not affect access the [[SVC|SVCs]] access table at all.&lt;br /&gt;
&lt;br /&gt;
Inlined ldrex+strex code is used for updating the above counter. [[11.2.0-35|11.2.0-X]] had changes for similar code, but it was only for dedicated ldrex+strex functions(mainly for kernel objects) and hence this PID code was not affected.&lt;br /&gt;
&lt;br /&gt;
With launching+terminating a sysmodule repeatedly with this via ns:s, it would take weeks to finish(if not at least about a month?).&lt;br /&gt;
| Access to all [[Services_API|services]], ControlMemory on any given mem-region.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| 2012 maybe?&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|  slowhax/waithax&lt;br /&gt;
|  svcWaitSynchronizationN does not decrement the references to valid handles in an array before returning an error when it encounters an invalid handle. This allows one to (slowly) overflow the reference count for a handle object to zero.&lt;br /&gt;
| ARM11 kernel-mode code execution&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2016&lt;br /&gt;
| nedwill, [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.3.0-36|11.3.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2.1&lt;br /&gt;
| Nintendo&#039;s fix for memchunkhax2 in [[10.4.0-29|10.4.0-X]] did not fix the GPU case: one may cause the requisite ToCToU race using gspwn, bypassing the new validation.&lt;br /&gt;
derrek&#039;s original 32c3 presentation for memchunkhax2 commented that a GPU-based attack was possible, but would be difficult.  However, memchunkhax2.1 showed that it was possible to do fairly reliably.&lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]], aliaspider&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2&lt;br /&gt;
| When allocating a block of memory, the &amp;quot;next&amp;quot; pointer of the [[Memory_Management#MemoryBlockHeader|memchunkhdr]] is accessed without being checked after being mapped to userland.&lt;br /&gt;
This allows a race condition, where the process can change the next pointer just before it&#039;s accessed. By pointing the next pointer to a crafted memchunckhdr in the kernel SlabHeap, some of the SlabHeap is allocated to the calling process, allowing to change vtables of kernel objects. &lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]] (partially, see memchunkhax2.1)&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| heaphax&lt;br /&gt;
| Can change the size of free memchunk structures stored in FCRAM using DMA, which leads to the ability to allocate memory chunks over already-allocated memory. This can be used in the SYSTEM region to allocate RW memory over any part of the NS system module, which is enough to take it over.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading) Code execution within any applet.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
| snshax&lt;br /&gt;
| Can force creation of Safe NS process into gspwn-able memory, allowing for takeover.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading)&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
|  AffinityMask/processorid validation&lt;br /&gt;
|  With [[10.0.0-27|10.0.0-X]] the following functions were updated: svcGetThreadAffinityMask, svcGetProcessAffinityMask, svcSetProcessAffinityMask, and svcCreateThread. The code changes for all but svcCreateThread are identical.&lt;br /&gt;
The original code with the first 3 did the following: &lt;br /&gt;
* if(u32_processorcount &amp;gt; ~0x80000001)return 0xe0e01bfd;&lt;br /&gt;
* if(s32_processorcount &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
The following code replaced the above:&lt;br /&gt;
* if(u32_processorcount &amp;gt;= &amp;lt;total_cores+1&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
In theory the latter should catch everything that the former did, so it&#039;s unknown if this was really a security issue.&lt;br /&gt;
&lt;br /&gt;
The svcCreateThread changes with [[10.0.0-27|10.0.0-X]] definitely did fix a security issue.&lt;br /&gt;
* Original code: &amp;quot;if(s32_processorid &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
* New code: &amp;quot;if(s32_processorid &amp;gt;= &amp;lt;total_cores&amp;gt; || s32_processorid &amp;lt;= -4)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
This fixed an off-by-one issue: if one would use processorid=total_cores, which isn&#039;t actually a valid value, svcCreateThread would accept that value on &amp;lt;[[10.0.0-27|10.0.0-X]]. This results in data being written out-of-bounds(baseaddr = arrayaddr + entrysize*processorid), which has the following result:&lt;br /&gt;
* Old3DS: Useless kernel-mode crash due to accessing unmapped memory.&lt;br /&gt;
* New3DS: uncontrolled data write into a kernel-mode L1 MMU-table. This isn&#039;t really useful: the data can&#039;t be controlled, and the data which gets overwritten is all-zero anyway(this isn&#039;t anywhere near MMU L1 entries for actually mapped memory).&lt;br /&gt;
The previous version also allowed large negative s32_processorid values(negative processorid values are special values not actual procids), but it appears using values like that won&#039;t actually do anything(meaning no crash) besides the thread not running / thread not running for a while(besides triggering a kernelpanic with certain s32_processorid value(s)).&lt;br /&gt;
| Nothing useful&lt;br /&gt;
|  [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| svcCreateThread issue: May 31, 2015. The rest: September 8, 2015, via v9.6-&amp;gt;v10.0 ARM11-kernel code-diff.&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax&lt;br /&gt;
| The kernel originally did not validate the data stored in the FCRAM kernel heap [[Memchunkhdr|memchunk-headers]] for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.&lt;br /&gt;
&lt;br /&gt;
There are &#039;&#039;multiple&#039;&#039; ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.&lt;br /&gt;
| When combined with other flaws: ARM11-kernelmode code execution&lt;br /&gt;
| [[9.3.0-21|9.3.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| February 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Multiple [[KLinkedListNode|KLinkedListNode]] SlabHeap use after free bugs&lt;br /&gt;
| The ARM11-kernel did access the &#039;key&#039; field of [[KLinkedListNode|KLinkedListNode]] objects, which are located on the SlabHeap, after freeing them. Thus, triggering an allocation of a new [[KLinkedListNode|KLinkedListNode]] object at the right time could result in a type-confusion. Pseudo-code:&lt;br /&gt;
SlabHeap_free(KLinkedListNode);&lt;br /&gt;
KObject *obj = KLinkedListNode-&amp;gt;key;  // the object there might have changed!&lt;br /&gt;
This bug appeared all over the place.&lt;br /&gt;
| ARM11-kernelmode code exec maybe&lt;br /&gt;
| [[8.0.0-18|8.0.0-18]]&lt;br /&gt;
| &lt;br /&gt;
| April 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11-kernel didn&#039;t check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.&lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11|6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcStartInterProcessDma]]&lt;br /&gt;
| For svcStartInterProcessDma, the kernel code had the following flaws:&lt;br /&gt;
&lt;br /&gt;
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.&lt;br /&gt;
&lt;br /&gt;
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address &amp;gt;=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr-&amp;gt;physaddr conversion). &lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| DmaConfig issue: unknown. The rest: 2014&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] independently&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] Parameter checks&lt;br /&gt;
| For svcControlMemory the parameter check had these two flaws:&lt;br /&gt;
&lt;br /&gt;
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn&#039;t actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn&#039;t actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows on (addr0+size) are now checked that previously weren&#039;t (this also applies to most other address checks elsewhere in the kernel).&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] request/response buffer overflow&lt;br /&gt;
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.&lt;br /&gt;
&lt;br /&gt;
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of &amp;lt;nowiki&amp;gt;((size&amp;lt;&amp;lt;14) | 2)&amp;lt;/nowiki&amp;gt; to write arbitrary memory to any RW userland memory in the destination process.&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|SVC stack allocation overflows]]&lt;br /&gt;
| &lt;br /&gt;
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. &lt;br /&gt;
* The alignment (size+7)&amp;amp;~7 calculation before allocation was not checked for integer overflow.&lt;br /&gt;
&lt;br /&gt;
This might allow for ARM11 kernel code-execution.&lt;br /&gt;
&lt;br /&gt;
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] complementary&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions&lt;br /&gt;
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn&#039;t check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.1.0-8]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11 kernel didn&#039;t check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don&#039;t have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions&lt;br /&gt;
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== [[FIRM]] Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Services|&amp;quot;srv:pm&amp;quot;]] process registration&lt;br /&gt;
| Originally any process had access to the port &amp;quot;srv:pm&amp;quot;. The PID&#039;s used for the (un)registration commands are not checked either. This allowed any process to re-register itself with &amp;quot;srv:pm&amp;quot;, and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] &amp;quot;srv:pm&amp;quot; is now a service instead of a globally accessible port. Only processes with PID&#039;s less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for &amp;quot;srv:pm&amp;quot; open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.&lt;br /&gt;
&lt;br /&gt;
This flaw was needed for exploiting the &amp;lt;=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don&#039;t have access to those service(s).&lt;br /&gt;
| Access to arbitrary services&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| FSDIR null-deref&lt;br /&gt;
| [[Filesystem_services|FS]]-module may crash in some cases when handling directory reading. The trigger seems to be due to using [[FSDir:Close]] without closing the dir-handle afterwards?(Perhaps this is caused by out-of-memory?) This seems to be useless since it&#039;s just a null-deref.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| May 19(?)-20, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in system-module system-version&lt;br /&gt;
!  Last system-module system-version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Timeframe this was added to wiki&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[MP:SendDataFrame]] missing input array index validation&lt;br /&gt;
| [[MP:SendDataFrame]] doesn&#039;t validate the input index at cmdreq[1], unless the function for flag=non-zero is executed. This is used to calculate the following, without validating the index at all: someptr = stateptr + (index*0x924) + somestateoffset.&lt;br /&gt;
&lt;br /&gt;
After validating some flags from someptr, when input_flag=0 the input buffer data is copied to someptr+someotheroffset+0x14 with the u16 size loaded from someptr+someotheroffset.&lt;br /&gt;
&lt;br /&gt;
With a large input index someptr could be setup to be at a &amp;lt;target address&amp;gt;, for overwriting memory.&lt;br /&gt;
&lt;br /&gt;
This is probably difficult to exploit.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[8.0.0-18]](MP-sysmodule v2048)&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MP_Services|MP]] cmd1 out-of-bounds handle read&lt;br /&gt;
| MP-sysmodule handles the input parameter for cmd1 as a s32. It checks for &amp;gt;=16, but not &amp;lt;0. With &amp;lt;16 it basically does the following(array of entries 4-bytes each): *outhandle = ((Handle*)(stateptr+offsetinstate))[inputindex].&lt;br /&gt;
&lt;br /&gt;
Hence, this can be used to load any handle in MP-sysmodule memory. MP doesn&#039;t really have any service handles of interest however(can be obtained from elsewhere too).&lt;br /&gt;
| Reading any handle in MP-sysmodule memory.&lt;br /&gt;
| None&lt;br /&gt;
| [[8.0.0-18]](MP-sysmodule v2048)&lt;br /&gt;
| January 21, 2017&lt;br /&gt;
| January 22, 2017&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| AM stack/.bss infoleak via [[AM:ReadTwlBackupInfo]]([[AM:ReadTwlBackupInfoEx|Ex]])&lt;br /&gt;
| After writing the output-info structure to stack, it then copies that structure to the output buffer ptr using the size from the command. The size is not checked. This could be used to read data from the AM-service-thread stack handling the command + .bss.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This was not tested on hardware.&#039;&#039;&#039;&lt;br /&gt;
| Stack/.bss reading&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27]](AM v9217)&lt;br /&gt;
| Roughly October 17, 2016&lt;br /&gt;
| October 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MVD_Services|MVD]]: Stack buffer overflow with [[MVDSTD:SetupOutputBuffers]].&lt;br /&gt;
| The input total_entries is not validated when initially processing the input entry-list. This fixed-size input entry-list is copied to stack from the command request. The loop for processing this initializes a global table, the converted linearmem-&amp;gt;physaddrs used there are also copied to stack(0x8-bytes of physaddrs per entry).&lt;br /&gt;
&lt;br /&gt;
If total_entries is too large, MVD-sysmodule will crash due to reading unmapped memory following the stack(0x10000000). Afterwards if the out-of-bounds total_entries is smaller than that, it will crash due accessing address 0x0, hence this useless.&lt;br /&gt;
| MVD-sysmodule crash.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| April 22, 2016 (Tested on the 25th)&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]]: Using CTRSDK heap with UDS sharedmem from the user-process.&lt;br /&gt;
| See the HTTP-sysmodule section below.&lt;br /&gt;
&lt;br /&gt;
CTRSDK heap is used with the sharedmem from [[NWMUDS:InitializeWithVersion]]. Buffers are allocated/freed under this heap using [[NWMUDS:Bind]] and [[NWMUDS:Unbind]].&lt;br /&gt;
&lt;br /&gt;
Hence, overwriting sharedmem with gspwn then using [[NWMUDS:Unbind]] results in the usual controlled CTRSDK memchunk-header write, similar to HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This could be done by creating an UDS network, without any other nodes on the network.&lt;br /&gt;
&lt;br /&gt;
Besides CTRSDK memchunk-headers, there are no addresses stored under this sharedmem.&lt;br /&gt;
| ROP under NWM-module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20|9.0.0-X]]&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| April 16, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds memory access during spectator [[Download_Play|data-frame]] checksum calculation&lt;br /&gt;
| DLP doesn&#039;t validate the frame_size when receiving spectator data-frames at all, unlike non-spectator data-frames. The actual spectator data-frame parsing code doesn&#039;t use that field either. However, the data-frame checksum calculation code called during checksum verification does use the frame_size for loading the size of the framebuf.&lt;br /&gt;
&lt;br /&gt;
Hence, using a large frame_size like 0xFFFF will result in the checksum calculation code reading data out-of-bounds. This isn&#039;t really useful, you could trigger a remote local-WLAN DLP-sysmodule crash while a 3DS system is scanning for DLP networks(due to accessing unmapped memory), but that&#039;s about all(trying to infoleak with this likely isn&#039;t useful either).&lt;br /&gt;
| DLP-sysmodule crash, handled by dlplay system-application by a &amp;quot;connection interrupted&amp;quot; error eventually then a fatal-error via ErrDisp.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8, 2016 (Tested on the 10th)&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds output data writing during spectator sysupdate titlelist [[Download_Play|data-frame]] handling&lt;br /&gt;
| The total_entries and out_entryindex fields for the titlelist DLP spectator data-frames are not validated. This is parsed during DLP network scanning. Hence, the specified titlelist data can be written out-of-bounds using the specified out_entryindex and total_entries. A crash will occur while reading the input data-frame titlelist if total_entries is larger than 0x27A, due to accessing unmapped memory.&lt;br /&gt;
&lt;br /&gt;
There&#039;s not much non-zero data to overwrite following the output buffer(located in sharedmem), any ptrs are located in sharedmem. Overwriting certain ptr(s) are only known to cause a crash when attempting to use the DLP-client shutdown service-command.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to exploit the above crash, since the linked-list code involves writes zeros(with a controlled start ptr).&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8-9, 2016&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[IR_Services|IR]]: Stack buffer overflow with custom hardware&lt;br /&gt;
| Originally IR sysmodule used the read value from the I2C-IR registers TXLVL and RXLVL without validating them at all. See [[10.6.0-31|here]] for the fix. This is the size used for reading the data-recv FIFO, etc. The output buffer for reading is located on the stack.&lt;br /&gt;
&lt;br /&gt;
This should be exploitable if one could successfully setup the custom hardware for this and if the entire intended sizes actually get read from I2C.&lt;br /&gt;
| ROP under IR sysmodule.&lt;br /&gt;
| [[10.6.0-31|10.6.0-31]]&lt;br /&gt;
| &lt;br /&gt;
| February 23, 2016 (Unknown if it was noticed before then)&lt;br /&gt;
| February 23, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HTTP_Services|HTTP]]: Using CTRSDK heap with sharedmem from the user-process.&lt;br /&gt;
| The data from httpcAddPostDataAscii and other commands is stored under a CTRSDK heap. That heap is the sharedmem specified by the user-process via the HTTPC Initialize command.&lt;br /&gt;
Normally this sharedmem isn&#039;t accessible to the user-process once the sysmodule maps it, hence using it is supposed to be &amp;quot;safe&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This isn&#039;t the case due to gspwn however. Since CTRSDK heap code is so insecure in general, one can use gspwn to locate the HTTPC sharedmem + read/write it, then trigger a mem-write under the sysmodule. This can then be used to get ROP going under HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This is exploited by [https://github.com/yellows8/ctr-httpwn/ctr-httpwn ctr-httpwn].&lt;br /&gt;
| ROP under HTTP sysmdule.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] (Latest sysmodule version as of [[10.7.0-32|10.7.0-32]])&lt;br /&gt;
| Late 2015&lt;br /&gt;
| March 22, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NIM_Services|NIM]]: Downloading old title-versions from eShop&lt;br /&gt;
| Multiple NIM service commands(such as [[NIMS:StartDownload]]) use a title-version value specified by the user-process, NIM does not validate that this input version matches the latest version available via SOAP. Therefore, when combined with AM(PXI) [[#Process9|title-downgrading]] via deleting the target eShop title with System Settings Data Management(if the title was already installed), this allows downloading+installing any title-version from eShop &#039;&#039;if&#039;&#039; it&#039;s still available from CDN.&lt;br /&gt;
The easiest way to exploit this is to just patch the eShop system-application code using these NIM commands(ideally the code which loads the title-version).&lt;br /&gt;
&lt;br /&gt;
Originally this was tested with a debugging-system via modded-FIRM, eventually smea implemented it in HANS for the 32c3 release.&lt;br /&gt;
| Downloading old title-versions from eShop&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| October 24, 2015 (Unknown when exactly the first eShop title downgrade was actually tested, maybe November)&lt;br /&gt;
| January 7, 2016 (Same day Ironfall v1.0 was removed from CDN via the main-CXI files)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SPI_Services|SPI]] service out-of-bounds write&lt;br /&gt;
| cmd1 has out-of-bounds write allowing overwrite of some static variables in .data.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NFC_Services|NFC]] module service command buf-overflows&lt;br /&gt;
| NFC module copies data with certain commands, from command input buffers to stack without checking the size. These commands include the following, it&#039;s unknown if there&#039;s more commands with similar issues: &amp;quot;nfc:dev&amp;quot; &amp;lt;0x000C....&amp;gt; and &amp;quot;nfc:s&amp;quot; &amp;lt;0x0037....&amp;gt;.&lt;br /&gt;
Since both of these commands are stubbed in the Old3DS NFC module from the very first version(those just return an error), these issues only affect the New3DS NFC module.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known retail titles which have access to either of these services.&lt;br /&gt;
| ROP under NFC module.&lt;br /&gt;
| New3DS: None&lt;br /&gt;
| New3DS: [[9.5.0-22]]&lt;br /&gt;
| December 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[News_Services|NEWSS]] service command notificationID validation failure&lt;br /&gt;
| This module does not validate the input notificationID for &amp;lt;nowiki&amp;gt;&amp;quot;news:s&amp;quot;&amp;lt;/nowiki&amp;gt; service commands. This is an out-of-bounds array index bug. For example, [[NEWSS:SetNotificationHeader]] could be used to exploit news module: this copies the input data(size is properly checked) to: out = newsdb_savedata+0x10 + (someu32array[notificationID]*0x70).&lt;br /&gt;
| ROP under news module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.7.0-25|9.7.0-X]]&lt;br /&gt;
| December 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData]] heap buffer overflow&lt;br /&gt;
| input_size = 0x1E * &amp;lt;value the u8 from input_[[NWM_Services|networkstruct]]+0x1D&amp;gt;. Then input_tag0 is copied to a heap buffer. When input_size is larger than 0xFA-bytes, it will then copy input_tag1 to &amp;lt;end_address_of_previous_outbuf&amp;gt;, with size=input_size-0xFA.&lt;br /&gt;
&lt;br /&gt;
This can be triggered by either using this command directly, or by boadcasting a wifi beacon which triggers it while a 3DS system running the target process is in range, when the process is scanning for hosts to connect to. Processes will only pass tag data to this command when the wlancommID and other thing(s) match the values for the process.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to actually exploit this for getting ROP under NWM-module, at the time of originally adding this to the wiki. This is because the data which gets copied out-of-bounds *and* actually causes crash(es), can&#039;t be controlled it seems(with just broadcasting a beacon at least). It&#039;s unknown whether this could be exploited from just using NWMUDS service-cmd(s) directly.&lt;br /&gt;
| Without any actual way to exploit this: NWM-module DoS, resulting in process termination(process crash). This breaks *everything* involving wifi comms, a reboot is required to recover from this.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| ~September 23, 2014(see the [[NWMUDS:DecryptBeaconData]] page history)&lt;br /&gt;
| August 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HID_Services|HID]] module shared-mem&lt;br /&gt;
| HID module does not validate the index values in [[HID_Shared_Memory|sharedmem]](just changes index to 0 when index == maxval when updating), therefore large values will result in HID module writing HID data to arbitrary addresses.&lt;br /&gt;
| ROP under HID module, but this is *very* unlikely to be exploitable since the data written is HID data.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| gspwn&lt;br /&gt;
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you&#039;re running under, and gain real code-execution from a ROP-chain. Normally applets&#039; .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).&lt;br /&gt;
&lt;br /&gt;
FCRAM is gpu-accessible up to physaddr 0x26800000 on Old3DS, and 0x2D800000 on New3DS. This is BASE_memregion_start(aka SYSTEM_memregion_end)-0x400000 (0x800000 with New3DS) with the default memory-layout on Old3DS/New3DS. With [[11.3.0-36|11.3.0-X]] the cutoff now varies due to the new [[SVC]] 0x59. The New3DS &amp;quot;normal&amp;quot;(non-APPLICATION) cutoff was changed to 0x2D000000 due to the new [[SVC]] 0x59.&lt;br /&gt;
| User-mode code execution.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| Early 2014&lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Yellows8|Yellows8]]/others before then&lt;br /&gt;
|-&lt;br /&gt;
| rohax&lt;br /&gt;
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.&lt;br /&gt;
&lt;br /&gt;
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.&lt;br /&gt;
| Memory-mapping syscalls.&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| [[9.4.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Plutooo|plutoo]] joint effort&lt;br /&gt;
|-&lt;br /&gt;
| Region free&lt;br /&gt;
| Only [[Home Menu]] itself checks gamecards&#039; region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.&lt;br /&gt;
This essentially means launching the gamecard with the [[NS_and_APT_Services|&amp;quot;ns:s&amp;quot;]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].&lt;br /&gt;
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation&lt;br /&gt;
| None&lt;br /&gt;
| Last tested with [[10.1.0-27|10.1.0-X]].&lt;br /&gt;
| June(?) 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]] service-cmd state null-ptr deref&lt;br /&gt;
| The NWMUDS service command code loads a ptr from .data, adds an offset to that, then passes that as the state address for the actual command-handler function. The value of the ptr loaded from .data is not checked, therefore this will cause crashes due to that being 0x0 when NWMUDS was not properly initialized.&lt;br /&gt;
It&#039;s unknown whether any NWM services besides NWMUDS have this issue.&lt;br /&gt;
| This is rather useless since it&#039;s only a crash caused by a state ptr based at 0x0.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== General/CTRSDK ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|UDS]] beacon additional-data buffer overflow&lt;br /&gt;
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.&lt;br /&gt;
This was discovered while doing code RE with an old dlp-module version. It&#039;s unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown if there&#039;s any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can&#039;t be exploited with this).&lt;br /&gt;
&lt;br /&gt;
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.&lt;br /&gt;
| Perhaps ROP, very difficult if possible with anything at all&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| September(?) 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| CTPK buffer overflow&lt;br /&gt;
| At offset 0x20 in CTPK is an array for each texture, each entry is 0x20-bytes. This contains a wordindex(entry+0x18) for some srcdata relative to CTPK+0, and an u8 wordsize(entry+0x14) for this data. The CTRSDK function handling this doesn&#039;t validate the size, when copying srcdata using this size to the output buffer. Applications usually have the output buffer on the stack, hence stack buffer overflow.&lt;br /&gt;
&lt;br /&gt;
While CTPK(*.ctpk) are normally only loaded from RomFS, some application(s) load from elsewhere too.&lt;br /&gt;
| ROP under the target application.&lt;br /&gt;
| None?&lt;br /&gt;
| &amp;quot;[SDK+NINTENDO:CTR_SDK-11_4_0_200_none]&amp;quot;&lt;br /&gt;
| November 14, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=11.3.0-36&amp;diff=19476</id>
		<title>11.3.0-36</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=11.3.0-36&amp;diff=19476"/>
		<updated>2017-02-07T01:14:51Z</updated>

		<summary type="html">&lt;p&gt;SciresM: remove extraneous word&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Old3DS+New3DS 11.3.0-36 system update was released on February 6, 2017. This Old3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN. This New3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN.&lt;br /&gt;
&lt;br /&gt;
Security flaws fixed: &amp;lt;fill this in manually later, see the updatedetails page from the ninupdates-report page(s) once available for now&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Change-log==&lt;br /&gt;
[http://en-americas-support.nintendo.com/app/answers/detail/a_id/667/p/430/c/267 Official] USA change-log:&lt;br /&gt;
* Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience&lt;br /&gt;
&lt;br /&gt;
==System Titles==&lt;br /&gt;
===NATIVE_FIRM===&lt;br /&gt;
====Process9====&lt;br /&gt;
Actual code changed in Process9 .text. 2 functions were updated, and 1 new function was added which is called by the first function(see below).&lt;br /&gt;
&lt;br /&gt;
Process9 now sets a global flag when starting applications (other than unique ID 0xF802A), and the firmlaunch function panics when attempting to launch SAFE_FIRM if that flag has been set, to prevent safehax.&lt;br /&gt;
&lt;br /&gt;
====New3DS arm9loader====&lt;br /&gt;
New3DS arm9loader wasn&#039;t updated.&lt;br /&gt;
&lt;br /&gt;
====ARM11 kernel====&lt;br /&gt;
Numerous functions were updated, fixing fasthax.&lt;br /&gt;
&lt;br /&gt;
* Additional bound checks were added to timer-handling code (setting and/or incrementing a timer&#039;s value, etc.) and to the KTimerAndWDTManager second virtual function, so that a timer&#039;s value can never be set to either a negative value or the past (which is what fasthax needed to do).&lt;br /&gt;
* The two functions that either add a [[KTimeableInterruptEvent]] instance to the global queue of pending [[KTimeableInterruptEvent]] (see [[KTimerAndWDTManager]]), or remove one from it, now return a boolean indicating whether the interrupt event already is/was in the queue (if that is true, the function that adds the interrupt event will now update the timer registers in that case as well). This is especially used for the below fixes.&lt;br /&gt;
* When adding a timer to that queue, its reference count is incremented (if it wasn&#039;t already in the queue). It is only decremented when needed, after actually signaling the timer by the interrupt-handling code.&lt;br /&gt;
* A virtual method was added to the definition of abstract class [[KTimeableInterruptEvent]], which returns &amp;lt;code&amp;gt;static_cast&amp;lt;KAutoObject *&amp;gt;(this)-&amp;gt;referenceCount != 1&amp;lt;/code&amp;gt; for KTimer instances and &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; for KThread instances. Prior to (re)adding timer interrupt events (as well as some other objects) to the queue, objects with a refcount of 1 are removed from it.&lt;br /&gt;
&lt;br /&gt;
===Modules===&lt;br /&gt;
No section0 module was changed.&lt;br /&gt;
&lt;br /&gt;
====NS====&lt;br /&gt;
Only two constants were actually changed: the minimal value required for the kernel&#039;s minor version number (now 0x35, ie. 11.3 NFIRM, it used to be 0x23, ie. 5.0 NFIRM), and the version number used for [[FS:InitializeWithSdkVersion]]. &lt;br /&gt;
&lt;br /&gt;
====[[New_3DS]] GSP====&lt;br /&gt;
At least the 3 following functions were updated (11.3 N3DS addresses):&lt;br /&gt;
&lt;br /&gt;
* sub_102048: now writes 0 to LCD register 0x10202014 and ORs 0x1020200C with 0x10001&lt;br /&gt;
* sub_10B4F4&lt;br /&gt;
* sub_10B7DC&lt;br /&gt;
&lt;br /&gt;
===[[Home Menu]]===&lt;br /&gt;
Exactly 1 function was updated, this fixed [[3DS_System_Flaws|bossbannerhax]](the last exploit used by [[menuhax]]). Code was added to verify that the common and {region/language}-specific [[Extended_Banner|exbanner]] sections don&#039;t have a decompressed size &amp;gt;{max_size}, when that happens it jumps over the func-call for doing the actual decompression.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
System update report(s):&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=02-06-17_07-00-38&amp;amp;sys=ctr]&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=02-06-17_07-00-47&amp;amp;sys=ktr]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=11.3.0-36&amp;diff=19462</id>
		<title>11.3.0-36</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=11.3.0-36&amp;diff=19462"/>
		<updated>2017-02-06T23:16:57Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Safehax fix details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Old3DS+New3DS 11.3.0-36 system update was released on February 6, 2017. This Old3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN. This New3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN.&lt;br /&gt;
&lt;br /&gt;
Security flaws fixed: &amp;lt;fill this in manually later, see the updatedetails page from the ninupdates-report page(s) once available for now&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Change-log==&lt;br /&gt;
[http://en-americas-support.nintendo.com/app/answers/detail/a_id/667/p/430/c/267 Official] USA change-log:&lt;br /&gt;
* Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience&lt;br /&gt;
&lt;br /&gt;
==System Titles==&lt;br /&gt;
===NATIVE_FIRM===&lt;br /&gt;
====Process9====&lt;br /&gt;
Actual code changed in Process9 .text. 2 functions were updated, and 1 new function was added which is called by the first function(see below).&lt;br /&gt;
&lt;br /&gt;
Process9 now sets a global flag when starting applications (other than unique ID 0xF802A), and the firmlaunch function panics when attempting to launch SAFE_FIRM with if that flag has been set, to prevent safehax.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
System update report(s):&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=02-06-17_07-00-38&amp;amp;sys=ctr]&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=02-06-17_07-00-47&amp;amp;sys=ktr]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Pinouts&amp;diff=19349</id>
		<title>Pinouts</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Pinouts&amp;diff=19349"/>
		<updated>2017-01-22T00:43:37Z</updated>

		<summary type="html">&lt;p&gt;SciresM: My eyes, please don&amp;#039;t put complementary neon colors near each other, augh. Bright purple + orange =&amp;gt; eye pain.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CTR CPU B ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-family:Monospace;text-align:center;width:100%;table-layout:fixed;&amp;quot;&lt;br /&gt;
| style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #336600&amp;quot; | CS1 || style=&amp;quot;background: #336600&amp;quot; | ? || style=&amp;quot;background: #336600&amp;quot; | ? || style=&amp;quot;background: #a060a0&amp;quot; | D5  || style=&amp;quot;background: #a060a0&amp;quot; | D2  ||     || style=&amp;quot;background: #a060a0&amp;quot; | RST || style=&amp;quot;background: #a060a0&amp;quot; | CLK || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff0000&amp;quot; | X  || style=&amp;quot;background: #ff0000&amp;quot; | X  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||     ||     ||     ||     || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? ||     || style=&amp;quot;background: #666633&amp;quot; | IRIRQ || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #bbbbbb&amp;quot; |  G&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #336600&amp;quot; | CSx || style=&amp;quot;background: #336600&amp;quot; | CSy || style=&amp;quot;background: #336600&amp;quot; | ? || style=&amp;quot;background: #a060a0&amp;quot; | D6  || style=&amp;quot;background: #a060a0&amp;quot; | D3  || style=&amp;quot;background: #a060a0&amp;quot; | D0  || style=&amp;quot;background: #a060a0&amp;quot; | IRQ || style=&amp;quot;background: #a060a0&amp;quot; | CS1 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||     || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||     ||     || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? ||     ||     ||     || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc9900&amp;quot; | ? ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ffff00&amp;quot; | CLK || style=&amp;quot;background: #ffff00&amp;quot; | D0  ||style=&amp;quot;background: #ffffff&amp;quot; | ||  +  ||     || style=&amp;quot;background: #a060a0&amp;quot; | D7  || style=&amp;quot;background: #a060a0&amp;quot; | D4  || style=&amp;quot;background: #a060a0&amp;quot; | D1  || style=&amp;quot;background: #a060a0&amp;quot; | DET || style=&amp;quot;background: #a060a0&amp;quot; | CS2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #a52a2a&amp;quot; | ? || style=&amp;quot;background: #666633&amp;quot; | IRRX || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ffff00&amp;quot; | D1  || style=&amp;quot;background: #ffff00&amp;quot; | D2  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ffff00&amp;quot; | D3  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ffff00&amp;quot; | CMD || style=&amp;quot;background: #ffff00&amp;quot; | IRQ ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ffff00&amp;quot; | WP  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #00aaee&amp;quot; | CLK || style=&amp;quot;background: #00aaee&amp;quot; | D0  ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #00aaee&amp;quot; | D1  || style=&amp;quot;background: #00aaee&amp;quot; | D2  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #00aaee&amp;quot; | D3  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     || style=&amp;quot;background: #00aaee&amp;quot; | CMD ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #20b2aa&amp;quot; | ? || style=&amp;quot;background: #20b2aa&amp;quot; | ? ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #20b2aa&amp;quot; | ? || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     || style=&amp;quot;background: #20b2aa&amp;quot; | ? ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #20b2aa&amp;quot; | ? || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #33ffff&amp;quot; | SCL ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #33ffff&amp;quot; | SDA  ||     ||style=&amp;quot;background: #ffffff&amp;quot; | ||     || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 3v3 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
|     || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v8 || style=&amp;quot;background: #d9ffb3&amp;quot; | 1v2 || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||     || style=&amp;quot;background: #b19cd9&amp;quot; | ? || style=&amp;quot;background: #b19cd9&amp;quot; | ? ||     ||     ||     || style=&amp;quot;background: #b19cd9&amp;quot; | ?  || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #cc9900&amp;quot; | ? ||     ||     ||     || style=&amp;quot;background: #ff69b4&amp;quot; |  B  || style=&amp;quot;background: #ff69b4&amp;quot; | PADR || style=&amp;quot;background: #ff69b4&amp;quot; | PADD || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #4d4d33&amp;quot; | ? || style=&amp;quot;background: #4d4d33&amp;quot; | ? || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | ?  || style=&amp;quot;background: #cc6600&amp;quot; | ?  ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | ||style=&amp;quot;background: #ffffff&amp;quot; | || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #b19cd9&amp;quot; | ? ||     ||     ||     ||     ||     ||     ||     || style=&amp;quot;background: #b19cd9&amp;quot; | ?  || style=&amp;quot;background: #8efab4&amp;quot; | ?  || style=&amp;quot;background: #cc9900&amp;quot; | ? || style=&amp;quot;background: #cc9900&amp;quot; | ? ||     ||     ||     ||     || style=&amp;quot;background: #ff69b4&amp;quot; |  A      || style=&amp;quot;background: #ff69b4&amp;quot; | STRT || style=&amp;quot;background: #ff69b4&amp;quot; | PADU || style=&amp;quot;background: #ff69b4&amp;quot; |  L  || style=&amp;quot;background: #ff69b4&amp;quot; |  Y  || style=&amp;quot;background: #4d4d33&amp;quot; | ? || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #bbbbbb&amp;quot; |  G  || style=&amp;quot;background: #b19cd9&amp;quot; | ? || style=&amp;quot;background: #b19cd9&amp;quot; | ? ||     ||     ||     ||     ||     ||     ||     || style=&amp;quot;background: #b19cd9&amp;quot; | ?  || style=&amp;quot;background: #8efab4&amp;quot; | ?  || style=&amp;quot;background: #cc9900&amp;quot; | ? ||     ||     ||     ||     ||     ||     || style=&amp;quot;background: #ff69b4&amp;quot; | SLCT || style=&amp;quot;background: #ff69b4&amp;quot; | PADL ||  style=&amp;quot;background: #ff69b4&amp;quot; |  R  || style=&amp;quot;background: #ff69b4&amp;quot; |  X  || style=&amp;quot;background: #4d4d33&amp;quot; | ? || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  || style=&amp;quot;background: #ff2a7f&amp;quot; | ?  ||  style=&amp;quot;background: #bbbbbb&amp;quot; | G&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
legend:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-family:Monospace;text-align:center;table-layout:fixed;&amp;quot;&lt;br /&gt;
| style=&amp;quot;background: #ff0000&amp;quot; | Main&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #a060a0&amp;quot; | Gamecard&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ffff00&amp;quot; | SDCARD SDIO&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #00aaee&amp;quot; | NAND SDIO&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #20b2aa&amp;quot; | WIFI SDIO&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #336600&amp;quot; | SPI&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #8efab4&amp;quot; | I2C-X&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #0000ff&amp;quot; | I2C-Y&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #33ffff&amp;quot; | I2C-3&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff69b4&amp;quot; | Pad&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff2a7f&amp;quot; | FCRAM&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #b19cd9&amp;quot; | Camera&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #a52a2a&amp;quot; | WIFI&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #666633&amp;quot; | GPIO&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #ff8000&amp;quot; | LCD0 (small)&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc6600&amp;quot; | LCD1 (big)&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #cc9900&amp;quot; | CODEC (unknown)&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #4d4d33&amp;quot; | MCU (unknown)&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #d9ffb3&amp;quot; | POWER&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: #bbbbbb&amp;quot; | Ground&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Orientation: Triangle bottom right on the PCB.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=19301</id>
		<title>Bootloader</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Bootloader&amp;diff=19301"/>
		<updated>2017-01-18T02:25:08Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Make wording less wordy.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bootloader is the binary code stored in the ARM9 and ARM11 boot ROMs and hence is ran when the 3DS is powered on. It&#039;s purpose is initializing hardware and loading the [[FIRM|system firmware]] from the internal [[Flash_Filesystem|NAND memory]].&lt;br /&gt;
&lt;br /&gt;
Besides NATIVE_FIRM, the bootloader is also capable of booting other firmwares (such as TWL_FIRM and AGB_FIRM). However, this will result either in a japanese error-screen or a system shutdown, directly after FIRM-Launching.&lt;br /&gt;
&lt;br /&gt;
== Boot ROM ==&lt;br /&gt;
Upon boot, parts of the ARM9 and ARM11 boot ROMs are protected by writing to [[CONFIG#CFG_SYSPROT9|CFG_SYSPROT9]] and [[CONFIG#CFG_SYSPROT11|CFG_SYSPROT11]], respectively. The ARM9 and ARM11 boot ROMs are identical for all Old 3DS, 2DS and New 3DS consoles.&lt;br /&gt;
&lt;br /&gt;
== NAND FIRM boot ==&lt;br /&gt;
Boot9 is not hard-coded to only handle 2 FIRM partitions: it parses all 8 NCSD partitions for this. Boot9 will attempt to use every partition listed in the NCSD which is an actual FIRM partition, in the same order listed in the NCSD, until booting one of them succeeds. Among the not-yet-processed partitions, the FIRM which has the highest value at u32 firmhdr+4 will have a FIRM-boot attempted first. Since that value is normally 0x0, the order of FIRM-partition processing is normally identical to the order of the NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
Boot9 is hard-coded for using [[AES_Registers|AES]] keyslot 0x6 for NAND crypto.&lt;br /&gt;
&lt;br /&gt;
== Non-NAND FIRM boot ==&lt;br /&gt;
Boot9 can also boot from non-NAND. For this a different set of RSA pubks are used(separate pubks for retail/devunit like NAND). The spiflash FIRM image for this is also encrypted with AES-CBC using a normalkey stored in prot_boot9(separate for retail/devunit). This encryption is basically used instead of what is used for NAND-firm-partitions. This encryption is only used for the FIRM sections, the FIRM header is used raw. The AES keyslot for this is only overwritten afterwards when booting from non-NAND fails. AES keyslot 0x3F is used for this.&lt;br /&gt;
&lt;br /&gt;
  CTR_word[0] = firmimageoffset;//FIRM section offset from FIRM header&lt;br /&gt;
  CTR_word[1] = outbufaddr;//FIRM section load addr&lt;br /&gt;
  CTR_word[2] = readsize;//FIRM section size&lt;br /&gt;
  CTR_word[3] = readsize;//FIRM section size&lt;br /&gt;
&lt;br /&gt;
When booting from NAND fails, boot9 will then attempt to boot from Wifi SPI-flash(this only triggers when the wifi module hw is properly accessible/connected, which is normally the case). The base offset for spiflash FIRM is 0x400. Note that this region(all data prior to offset 0x1F300) is write-protected by the spiflash(not writable from 3DS-mode / DS-mode).&lt;br /&gt;
&lt;br /&gt;
For non-NAND booting, NCSD / FIRM-backup is not used.&lt;br /&gt;
&lt;br /&gt;
== SDMMC ==&lt;br /&gt;
&lt;br /&gt;
Boot9 has code implemented for using SD(HC) cards, but the input deviceids used by boot9 for those functions are hard-coded for NAND.&lt;br /&gt;
&lt;br /&gt;
== Boot9 RSA keyslots ==&lt;br /&gt;
&lt;br /&gt;
The following are initialized during main() startup, by initialize_rsakeyslots_pubk(). Each of these, for the ones which are actually set, have different keydata for retail/devunit.&lt;br /&gt;
* 0: Not set.&lt;br /&gt;
* 1: Used for the NAND FIRM signature.&lt;br /&gt;
* 2: Used for the non-NAND-FIRM signature.&lt;br /&gt;
* 3: Used for the NAND-NCSD FIRM signature.&lt;br /&gt;
&lt;br /&gt;
When FIRM loading is successful, initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk() is called, right before calling the final function in main(). Besides ITCM writing, this overwrites all 4 RSA keyslots with modulus + private-exponents loaded from boot9 data.&lt;br /&gt;
&lt;br /&gt;
initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk():&lt;br /&gt;
This initializes the 4 0x100-byte/0x200-byte chunks at 0x07ffb800+0x500(0x07ffbd00)/0x07ffb800+0x900(0x07ffc100). End address of the first section is 0x07ffc100(start addr of the second section), end address of the second section is 0x07ffc900. Hence, the first section total size is 0x400-bytes, while the second section total size is 0x800-bytes.&lt;br /&gt;
&lt;br /&gt;
These are initialized using via the boot9 data image, with ptrs from DTCM. Seperate keydata is used for retail/devunit.&lt;br /&gt;
&lt;br /&gt;
When initializing the first ITCM area: rsa_setkeyslot_privk() is called for all 4 RSA keyslots. The modulo for each one is also copied to (index*0x100) + 0x07ffb800 + 0x500. The private exponent is not copied into ITCM.&lt;br /&gt;
&lt;br /&gt;
The second ITCM area is initialized by copying 4 0x200-byte entries in a loop. These are RSA pubks+privks, which Boot9 doesn&#039;t use itself at all besides this copy loop.&lt;br /&gt;
&lt;br /&gt;
== Boot9 image data memory layout ==&lt;br /&gt;
0xffffb088 is the beginning of the boot9 image data section.&lt;br /&gt;
&lt;br /&gt;
* 0xffffb088 size 0x38-bytes: This is the array used during FIRM-section-loading for the memory-range blacklist for FIRM sections.&lt;br /&gt;
* 0xffffb0c0(end-addr of the above area) size 0x20-bytes: Unknown.&lt;br /&gt;
* 0xffffb0e0(end-addr of the above area) size 0x2f80-bytes: This is *all* of the keys stored in the image.&lt;br /&gt;
* 0xffffe060(end addr of the above key-area) size 0x230-bytes: This is the initial DTCM image @ 0xFFF00000, see below.&lt;br /&gt;
* 0xffffe290(DTCM_image_end) - {boot9 image end}: All-zero.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2f80-byte key-area at 0xffffb0e0:&lt;br /&gt;
* 0xffffb0e0 size 0x2600-bytes: This is the RSA key-data, see below.&lt;br /&gt;
* 0xffffd6e0(end-addr of the above area) size 0x40-bytes: This is the keydata used for crypting the entire OTP with keyslot 0x3f, used by main(). The first 0x20-bytes is for retail, the remaining 0x20-bytes starting at 0xffffd700 is for devunit. Chunk+0(retail=0xffffd6e0 devunit=0xffffd700) is the normalkey, chunk+0x10(retail=0xffffd6f0 devunit=0xffffd710) is the AES-IV.&lt;br /&gt;
* ...&lt;br /&gt;
* 0xffffd760: size 0x100-bytes: First 0x80-bytes is for retail, the remaining 0x80-bytes at 0xffffd7e0 is for devunit. This 0x80-byte block is copied to 0x07ffcd00 by a Boot9 function, however that code actually does the copy in two 0x40-bytes chunks.&lt;br /&gt;
* 0xffffd860(end-addr of the above area) size 0x400-bytes: This is the bootrom_dataptr passed to the aes-keyinit function for retail. See the below Tools section for how this is processed.&lt;br /&gt;
* 0xffffdc60(end-addr of the above area) size 0x400-bytes: This is the devunit version of the above the 0x400-byte chunk. This is very last chunk of data in the boot9 data-section key-area: end addr for this area is 0xffffe060.&lt;br /&gt;
&lt;br /&gt;
Layout of the 0x2600-byte RSA key-data at 0xffffb0e0:  &lt;br /&gt;
First 0x1300-bytes is for retail, the remaining 0x1300-bytes starting at 0xffffc3e0 is for devunit.&lt;br /&gt;
* +0x0 retail=0xffffb0e0 devunit=0xffffc3e0: RSA modulo for keyslot3, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x100 retail=0xffffb1e0 devunit=0xffffc4e0: RSA modulo for keyslot1, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x200 retail=0xffffb2e0 devunit=0xffffc5e0: RSA modulo for keyslot2, initialized by initialize_rsakeyslots_pubk().&lt;br /&gt;
* +0x300 size 0x200, retail=0xffffb3e0 devunit=0xffffc6e0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). This is for RSA-engine keyslot0 with initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), which also copies this modulo to the array starting at 0x07ffbd00.&lt;br /&gt;
* +0x500 size 0x200, retail=0xffffb5e0 devunit=0xffffc8e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0x700 size 0x200, retail=0xffffb7e0 devunit=0xffffcae0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x900 size 0x200, retail=0xffffb9e0 devunit=0xffffcce0: Used the same as the above block except for slot3.&lt;br /&gt;
* +0xb00 size 0x200, retail=0xffffbbe0 devunit=0xffffcee0: First 0x100-bytes is the RSA modulo, then the following 0x100-bytes is the RSA privk(private-exponent). The 0x200-bytes here is copied to slot0 in the array at 0x07ffc100 by initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk().&lt;br /&gt;
* +0xd00 size 0x200, retail=0xffffbde0 devunit=0xffffd0e0: Used the same as the above block except for slot1.&lt;br /&gt;
* +0xf00 size 0x200, retail=0xffffbfe0 devunit=0xffffd2e0: Used the same as the above block except for slot2.&lt;br /&gt;
* +0x1100 size 0x200, retail=0xffffc1e0 devunit=0xffffd4e0: Used the same as the above block except for slot3.&lt;br /&gt;
&lt;br /&gt;
== Boot9 DTCM layout ==&lt;br /&gt;
Most of this is just ptrs / other unknown data, not actual keys. However, there is an unknown 0x10-byte block @ +0x124(there&#039;s a ptr initialized for this block elsewhere).&lt;br /&gt;
&lt;br /&gt;
== Boot11 image data memory layout ==&lt;br /&gt;
0x0001817c..0x000181f4 size 0x78-bytes: This seems to be the bootrom error screen font gfx data. This begins at the exact end-address of the crt0 code, the rest of the protected boot11 code begins at this end-address(0x000181f4).  &lt;br /&gt;
&lt;br /&gt;
0x00019400 is the beginning of the boot11 data area, the first 8-bytes here are unknown.&lt;br /&gt;
* 0x00019408..0x0001b498 size 0x2090-bytes: This is the blowfish keydata which gets copied to arm9itcm_twlkeydata+0x3e0 later.&lt;br /&gt;
* ...&lt;br /&gt;
* 0x0001c498..0x0001c4f8 size 0x60-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x380.&lt;br /&gt;
* 0x0001c4f8..0x0001c538 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x340.&lt;br /&gt;
* 0x0001c538..0x0001c578 size 0x40-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x300.&lt;br /&gt;
* 0x0001c578..0x0001c5f8 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x280.&lt;br /&gt;
* 0x0001c5f8..0x0001c678 size 0x80-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x0.&lt;br /&gt;
* 0x0001c678..0x0001c878 size 0x200-bytes: This is the data which eventually gets copied to arm9itcm_twlkeydata+0x80.&lt;br /&gt;
* 0x0001c878..0x0001d078 size 0x800-bytes: These are the 3DS RSA-2048 modulus which are eventually copied to arm9_itcm+0x4900: on retail the first 4 are copied there by boot9, on devunit the last 4 are copied to itcm.&lt;br /&gt;
* 0x0001d078 size 0x120-bytes is the initial data for the .data section @ 0x1ffe8000, this is the very end of the protected arm11-bootrom.&lt;br /&gt;
&lt;br /&gt;
== AES keys ==&lt;br /&gt;
See the Tools section for how Boot9 initializes the keyslots.&lt;br /&gt;
&lt;br /&gt;
See also [[AES_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
For an issue with console-unique key-init, see [[OTP_Registers|here]].&lt;br /&gt;
&lt;br /&gt;
== BootROM Errors ==&lt;br /&gt;
Sample error-screen(where firm0+firm1 RSA signatures were corrupted):&lt;br /&gt;
&lt;br /&gt;
  BOOTROM 8046&lt;br /&gt;
  ERRCODE: 00F800FF&lt;br /&gt;
  DEDEFFFF FFFFFFFF&lt;br /&gt;
  00000000 00000000&lt;br /&gt;
&lt;br /&gt;
* 1st line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;BOOTROM %X&amp;quot;, 0x8046);//This last param comes from the .pool.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2nd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;ERRCODE:    %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0xC)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 3rd line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;, *((unsigned int*)(0x1FFFE000+0x10))`, `*((unsigned int*)(0x1fffe000+0x14)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
* 4th line is: &amp;lt;code&amp;gt;print_string(..., &amp;quot;%08X %08X&amp;quot;,*((unsigned int*)(0x1FFFE000+0x18))`, `*((unsigned int*)(0x1fffe000+0x1C)));//See below memory notes.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0x1FFFE000 memory ==&lt;br /&gt;
This memory is used by boot9 mainly for sending info to the arm11 for the error-screen. The data in this region is still stored in memory by the time the ARM9+ARM11 jumps to FIRM.&lt;br /&gt;
&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0xC: 8bit status-codes initialized by boot9 main(), for the FIRM-boot devices. +0 is NAND and +2 is wifi-spiflash.&lt;br /&gt;
* ...&lt;br /&gt;
* 8bit-entry-array 0x1FFFE000+0x10: Status-codes originally from nand_findfirmpartition_loadfirm(), for each of the 8 NCSD partitions.&lt;br /&gt;
&lt;br /&gt;
== BootROM Status Codes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| Success&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF(~32)&lt;br /&gt;
| Failed to read sector data from the device.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7(~8)&lt;br /&gt;
| A NAND FIRM from another partition was already found with a priority(firmhdr+4) &amp;gt;= to the value for the current partition&#039;s FIRM priority.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8(~7)&lt;br /&gt;
| The FIRM magicnum(firmhdr+0) is invalid.&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF(~0)&lt;br /&gt;
| Initial value for each entry in the 8-entry array of status-codes for the NAND NCSD partitions. Indicates that the partition is not a FIRM partition(partition fs type isn&#039;t 0x3 or partition fs crypt-type isn&#039;t 0x2).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Boot9 startup ==&lt;br /&gt;
&lt;br /&gt;
0xffff0000 jumps to 0xffff8000. 0xffff8000 is crt0:&lt;br /&gt;
* Very first thing this does is clear u8 register 0x10000002 ([[CONFIG_Registers#CFG_RST11|CFG_RST11]]) bit 0 to zero.&lt;br /&gt;
* Then sp is initialized for each cpumode, IRQs/FIQs are disabled during the first mode-switch.&lt;br /&gt;
* Order of mode-switches + sp initialization: svc-mode = 0xfff04000, irq-mode = 0xfff03f00, system-mode = 0xfff03b00. Hence, the rest of the code following this runs in system-mode.&lt;br /&gt;
* Then L_ffff80cc/mpu_init() is called.&lt;br /&gt;
* Then L_ffff0038() is called, which initializes the exception-handler addresses @ 0x08000000.&lt;br /&gt;
* Then L_ffff81b8() is called(r4 + lr are saved on the DTCM stack), which after calling a memclear function which doesn&#039;t do anything, it then clears 0x08000030 size 0x10. Here the DTCM at 0xfff00000 size 0x4000 is cleared.&lt;br /&gt;
* Then L_ffff81b4() is called, which branches to DTCM_init(). This copies the initial DTCM data from the Boot9 data image into boot9, then it clears 0xFFF00230 - 0xFFF01AC0.&lt;br /&gt;
* Then LT_ffff8228/main is jumped to, with LR set to the address of an infinite-branch-loop instruction.&lt;br /&gt;
&lt;br /&gt;
mpu_init():&lt;br /&gt;
* Bitmask 0x000f9005 is cleared in the cp15 control register. MCR instructions which do then following are then executed: flush entire instruction cache, flush entire data cache, and drain write buffer.&lt;br /&gt;
* Then the 8 [[Memory_layout|MPU]] memregions are initialized.&lt;br /&gt;
* ITCM memregion reg = 0x24: baseaddr=0x0, size = 128MB(0x08000000).&lt;br /&gt;
* DTCM memregion reg = 0xfff0000a: baseaddr=0xfff00000, size=16KB(0x00004000).&lt;br /&gt;
* Then instruction cachable and data cachable/bufferable bits for the MPU regions are setup.&lt;br /&gt;
* Then the instruction/data access permissions for the MPU regions are setup.&lt;br /&gt;
* Lastly bitmask 0x0005707d is orred in the cp15 control register.&lt;br /&gt;
&lt;br /&gt;
== Boot9 main() ==&lt;br /&gt;
&lt;br /&gt;
  The following functions are called: LT_ffff2024(), LT_ffff1ff8(), pxi_init(), rsa_init(), initialize_rsakeyslots_pubk(), crypto_initialize(), and aesengine_reset().&lt;br /&gt;
  Then AES keyslot 0x3F is setup: aesengine_setnormalkey(0x3f, 5, ptr) is called. ptr on retail(CFG_UNITINFO check) is 0xffffd6e0, 0xffffd700 for devunit. Then essentially, aesengine_setctr(5, ptr+0x10) is executed.&lt;br /&gt;
  Then AES keyslot 0x3f is selected.&lt;br /&gt;
  When calling the following functions, if any of them return zero, it will immediately jump to setting ptr to 0x10012000(otp), otherwise when all of them return non-zero ptr = sp+0x94. otp_decrypt(sp+4), otp_verify(sp+4), initialize_consoleunique_itcm(sp+4, 0x07ffb800).&lt;br /&gt;
  Then the following is executed: initialize_aeskeys_wrap(ptr, 0x70);&lt;br /&gt;
  Then sp+4 size 0x100 is cleared to zero.&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  NAND firm-boot code-block, is described below. Note that boot9 is basically hard-coded to use deviceid NAND, not SD.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called, then the AES keyslot for NAND-FIRM is selected(0x6).&lt;br /&gt;
  	Then LT_ffff56c8() is called, if that returns non-zero the statuscode variable is set to ~2 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then LT_ffff5774(0x201) is called, if that returns non-zero the statuscode variable is set to ~1 then it jumps to NAND_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_mmc() is called. Then nand_findfirmpartition_loadfirm(0) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  	Executes a loop which runs 8 times: write the output from get_errorcode_arrayentry_xfff005e8(loopindex) to u8 0x1fffe000+0x10+loopindex(copy the array of 32bit error-codes for all 8 NCSD partitions initialized by nand_findfirmpartition_loadfirm() to the array of 8bit entries at 0x1fffe000+0x10).&lt;br /&gt;
  &lt;br /&gt;
  	NAND_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xc.&lt;br /&gt;
  	Then LT_ffff5690(0x201, 0x1fffe018, 0x1fffe01c) is called.&lt;br /&gt;
  	Then LT_ffff5644() is called.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it continues to the next code-block.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Wifi spi-flash firm-boot code-block, executed when no FIRM was loaded successfully so far.&lt;br /&gt;
  {&lt;br /&gt;
  	timer_updatestoredstate() is called.&lt;br /&gt;
  &lt;br /&gt;
  	Then spi_wififlash_cmdgetstatusreg(sp+0x100) is executed. When bit0 of the output u8 at sp+0x100 is clear, it will continue this code-block, otherwise it will set the statuscode variable to ~1 then jump to SPIFLASH_BOOTEND.&lt;br /&gt;
  	Then fsdriver_setup_wififlash() is called.&lt;br /&gt;
  	Here read_firmhdr_validate_loadfirm(0, 2) is called, with the statuscode variable set to the retval.&lt;br /&gt;
  &lt;br /&gt;
  	SPIFLASH_BOOTEND:&lt;br /&gt;
  	Then the statuscode variable is written to u8 0x1fffe000+0xe.&lt;br /&gt;
  	Then timer_updatestoredstate() is called.&lt;br /&gt;
  	When statuscode==0 for success, it jumps to FIRMLOAD_END. Otherwise, it executes writenormalkey_keyslot3f(), then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_END:&lt;br /&gt;
  Here it calls firmhdr_getarm11_entrypoint() and firmhdr_getarm9_entrypoint(). Immediately after calling each function it checks if the retval is 0, if so it then jumps to FIRMLOAD_FAILURE.&lt;br /&gt;
  After calling initialize_x07ffbd00_x07ffc100_rsakeyslotsprivk(), it jumps to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_FAILURE:&lt;br /&gt;
  Here it clears 0x07ffb800 size 0x3c70 to zero, endaddr = 0x07fff470.&lt;br /&gt;
  Then it continues to FIRMLOAD_EXIT.&lt;br /&gt;
  &lt;br /&gt;
  FIRMLOAD_EXIT:&lt;br /&gt;
  Here firmboot() is called, which should never return. The instruction after this bl is a call for panic().&lt;br /&gt;
&lt;br /&gt;
== Boot Procedure ==&lt;br /&gt;
&lt;br /&gt;
* 0 seconds - unit is powered on. The ARM9 and ARM11 [[Memory_layout|bootroms]] begin execution.&lt;br /&gt;
&lt;br /&gt;
* 2 seconds - ARM9 bootrom attempts to initialize the NAND.&lt;br /&gt;
**If the NAND is successfully initialized:&lt;br /&gt;
***the ARM9 bootrom loads the [[FIRM|firmware]] stored in the NAND [[FIRM]] partition which handles booting the rest of the system (if verification for NAND firm0 fails, the ARM9 bootrom will attempt to use firm1 instead).&lt;br /&gt;
***The ARM11 kernel loaded from FIRM then launches the [[NCCH#CXI|CXI]] ARM11 system modules loaded from FIRM (i.e. sm, fs, pm, loader, and pxi). (Note that the ARM11 kernel does not handle any encryption/RSA verification, this is handled by the [[FIRM|ARM9]].)&lt;br /&gt;
**If the NAND cannot be initialized (i.e. the NAND chip is not connected/damaged/etc), a [[Bootloader#Error_Codes|blue error screen]] appears.&lt;br /&gt;
&lt;br /&gt;
* 3 seconds - all essential hardware is active.&lt;br /&gt;
**The [[Process_Manager_Services|PM]] module launches [[NS]]&lt;br /&gt;
**If [[Home_Menu#Auto-Boot_Function|auto-booting]] is needed, NS will [[NS#Auto-boot|auto-boot]] titles.&lt;br /&gt;
**Otherwise, NS will instead launch [[ErrDisp]] and the [[Configuration Memory#ACTIVEMENUTID|current active menu]] via the PM module. For retail units, this menu is usually the [[Home Menu]]. Note that the PM module first launches the module dependencies when launching a process, prior to actually launching the process.&lt;br /&gt;
**The further Home Menu startup process is described [[Home_Menu#Home_Menu_startup|here]].&lt;br /&gt;
&lt;br /&gt;
* 4 seconds - the LCD screens are initialized.&lt;br /&gt;
&lt;br /&gt;
* 7 seconds - [[Home Menu]] is fully initialized/loaded.&lt;br /&gt;
&lt;br /&gt;
== NAND Reads during Boot ==&lt;br /&gt;
During a successful boot on 6.x, the bootloader (and firm) reads the following sectors from NAND (in this order):&lt;br /&gt;
 00000000 (NCSD Partition Table)&lt;br /&gt;
 &lt;br /&gt;
 Only verify &#039;FIRM&#039; magic? (A second Header-read will be attempted even if everything except the magic is 0xFF...)&lt;br /&gt;
 0B130000 (FIRM Partition)&lt;br /&gt;
 0B530000 (Secondary FIRM Partition)&lt;br /&gt;
 &lt;br /&gt;
 Verify RSA signature and parse Header:&lt;br /&gt;
 0B130000 (FIRM: Header)&lt;br /&gt;
 0B130200 (FIRM: Section 1)&lt;br /&gt;
 0B163E00 (FIRM: Section 2)&lt;br /&gt;
 0B193E00 (FIRM: Section 3)&lt;br /&gt;
 &lt;br /&gt;
 00013000 .. Below is probably NATIVE_FIRM booting ..&lt;br /&gt;
 00014000&lt;br /&gt;
 00015000&lt;br /&gt;
 00016000&lt;br /&gt;
 00017000&lt;br /&gt;
 &lt;br /&gt;
 09011A00&lt;br /&gt;
 09011C00&lt;br /&gt;
 09012000&lt;br /&gt;
 09012400&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Error Codes ==&lt;br /&gt;
When the 3DS does not find the NAND chip, the following error is displayed:&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Bootrom_Error.jpg|240px]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Error&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000200 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Error when having SD-card reader connected to NAND during boot.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE 00000000 00000000 00000400 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND not found error (?)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000080 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT1 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00800000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT2 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FE FFFFFFFF FFFFFFFF 00000005 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| NAND error when DAT3 was used as DAT0.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800FF F8F8FFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Both the firm0 and firm1 partitions are corrupt (failed signature checks).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;00F800EE FFFFFFFF FFFFFFFF 00000000 00000000&amp;lt;/tt&amp;gt;&lt;br /&gt;
| [[NCSD]] header in sector 0 is corrupt (failed signature check).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
* [https://github.com/yellows8/boot9_tools boot9_tools]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=AES_Registers&amp;diff=19230</id>
		<title>AES Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=AES_Registers&amp;diff=19230"/>
		<updated>2017-01-11T05:48:02Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Keyslots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Registers ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  Name&lt;br /&gt;
!  Address&lt;br /&gt;
!  Width&lt;br /&gt;
!  RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_CNT|AES_CNT]]&lt;br /&gt;
| 0x10009000&lt;br /&gt;
| 4&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_BLKCNT|AES_BLKCNT]]&lt;br /&gt;
| 0x10009004&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_WRFIFO/AES_RDFIFO|AES_WRFIFO]]&lt;br /&gt;
| 0x10009008&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_WRFIFO/AES_RDFIFO|AES_RDFIFO]]&lt;br /&gt;
| 0x1000900C&lt;br /&gt;
| 4&lt;br /&gt;
| R&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYSEL&lt;br /&gt;
| 0x10009010&lt;br /&gt;
| 1&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_KEYCNT|AES_KEYCNT]]&lt;br /&gt;
| 0x10009011&lt;br /&gt;
| 1&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_CTR|AES_CTR]]&lt;br /&gt;
| 0x10009020&lt;br /&gt;
| 16&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_MAC|AES_MAC]]&lt;br /&gt;
| 0x10009030&lt;br /&gt;
| 16&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY0&lt;br /&gt;
| 0x10009040&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY1&lt;br /&gt;
| 0x10009070&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY2&lt;br /&gt;
| 0x100090A0&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY3&lt;br /&gt;
| 0x100090D0&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYFIFO&lt;br /&gt;
| 0x10009100&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYXFIFO&lt;br /&gt;
| 0x10009104&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYYFIFO&lt;br /&gt;
| 0x10009108&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AES_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 4-0&lt;br /&gt;
| Write FIFO count (0-16)&lt;br /&gt;
|-&lt;br /&gt;
| 9-5&lt;br /&gt;
| Read FIFO count (0-16)&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Flush write FIFO (1=Clear write FIFO)&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Flush read fifo (1=Clear read FIFO)&lt;br /&gt;
|-&lt;br /&gt;
| 12-13&lt;br /&gt;
| Write FIFO DMA size (0=16, 1=12, 2=8, 3=4 words)&lt;br /&gt;
|-&lt;br /&gt;
| 14-15&lt;br /&gt;
| Read FIFO DMA size (0=4, 1=8, 2=12, 3=16 words)&lt;br /&gt;
|-&lt;br /&gt;
| 18-16&lt;br /&gt;
| MAC size (encoding = (maclen-2)/2)&lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
|? (MAC related)&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| MAC input control (0 = read MAC from FIFO, 1 = read from MAC register)&lt;br /&gt;
|-&lt;br /&gt;
| 21&lt;br /&gt;
| MAC status (0 = invalid, 1 = verified)&lt;br /&gt;
|-&lt;br /&gt;
| 22&lt;br /&gt;
| Output endianness (1=Big endian, 0=Little endian)&lt;br /&gt;
|-&lt;br /&gt;
| 23&lt;br /&gt;
| Input endianness (1=Big endian, 0=Little endian)&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| Output word order (1=Normal order, 0=Reversed order)&lt;br /&gt;
|-&lt;br /&gt;
| 25&lt;br /&gt;
| Input word order (1=Normal order, 0=Reversed order)&lt;br /&gt;
|-&lt;br /&gt;
| 26&lt;br /&gt;
| Update keyslot (selects the keyslot specified by AES_KEYSEL when this bit is set)&lt;br /&gt;
|-&lt;br /&gt;
| 29-27&lt;br /&gt;
| Mode (0=CCM decrypt, 1=CCM encrypt, 2=CTR, 3=CTR, 4=CBC decrypt, 5=CBC encrypt, 6=ECB decrypt, 7=ECB encrypt)&lt;br /&gt;
|-&lt;br /&gt;
| 30&lt;br /&gt;
| Interrupt enable (1=enable, 0=disable)&lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| Start (1=enable/busy, 0=idle)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When bit31 is set, this register essentially becomes locked and doesn&#039;t change when written to. However if bit26 is &amp;quot;set&amp;quot;, keyslot-selection is cued to be handled when bit31 is cleared.&lt;br /&gt;
&lt;br /&gt;
Clearing bit31 while the AES engine is doing crypto will result in the AES engine stopping crypto, once it finishes processing the current block.&lt;br /&gt;
&lt;br /&gt;
Read/Write FIFO counts and the MAC status can never be set by writing to AES_CNT, they are read-only.&lt;br /&gt;
&lt;br /&gt;
Changing the input word order triggers the key/keyX/keyY FIFOs to be flushed.&lt;br /&gt;
&lt;br /&gt;
== AES_BLKCNT ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 31-16&lt;br /&gt;
| (Data length)&amp;gt;&amp;gt;4 (i.e. the number of blocks to process)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AES_WRFIFO/AES_RDFIFO ==&lt;br /&gt;
The AES engine can accept up to 64 bytes of input data (16 32-bit words) and can hold up to 64 bytes of output data at a time (for a total of 128 bytes of buffered data). Bits 12-13 and 14-15 in AES_CNT configure the DMA request for the relevant FIFO (see above).&lt;br /&gt;
&lt;br /&gt;
The input data for the AES crypto operation is written to AES_WRFIFO, the output data is read from AES_RDFIFO.&lt;br /&gt;
&lt;br /&gt;
Reading from AES_RDFIFO when there&#039;s no data available in the RDFIFO will result in reading the last word that was in the RDFIFO.&lt;br /&gt;
&lt;br /&gt;
When triggering either RDFIFO or WRFIFO to be flushed, the AES Engine does not clear either buffer.&lt;br /&gt;
&lt;br /&gt;
Word order and endianness can be changed between each read/write to these FIFOs. However changing the word order when writing to WRFIFO can cause the word to be written outside the current block, leaving uninitialized data in its place. Attempts to change endianness or word order are not honored when reading from RDFIFO when no more data is available.&lt;br /&gt;
&lt;br /&gt;
== AES_KEYCNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 5-0&lt;br /&gt;
| Keyslot&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Hardware key-generator type: 0 = 3DS, 1 = DSi.&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| This normally has value 1 written here when updating keys. 0 = disable key FIFO flush, 1 = enable key FIFO flush.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit6 is only used when keyslots &amp;gt;=4 are used, value1 has the same affect as doing key-init with the TWL keyslots. Bit6 is only checked when a keyY was completely written, for when the final-normalkey needs updated via the key-generator. Changing bit6 has no affect on the generated normalkey when writing to this bit immediately after writing the last keyY word.&lt;br /&gt;
&lt;br /&gt;
== AES_CTR ==&lt;br /&gt;
This register specifies the counter (CTR mode), nonce (CCM mode) or the initialization vector (CBC mode) depending on the mode of operation.&lt;br /&gt;
For CBC and CTR mode this register takes up the full 16 bytes, but for CCM mode the nonce is only the first 12 bytes.&lt;br /&gt;
The AES engine will automatically increment the counter up to the maximum BLKCNT, after which point it must be manually incremented and set again.&lt;br /&gt;
&lt;br /&gt;
== AES_MAC ==&lt;br /&gt;
This register specifies the message authentication code (MAC) for use in CCM mode.&lt;br /&gt;
&lt;br /&gt;
== AES_KEY0/1/2/3 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-15&lt;br /&gt;
| Normalkey&lt;br /&gt;
|-&lt;br /&gt;
| 16-31&lt;br /&gt;
| KeyX&lt;br /&gt;
|-&lt;br /&gt;
| 32-47&lt;br /&gt;
| KeyY&lt;br /&gt;
|-}&lt;br /&gt;
&lt;br /&gt;
These registers are the same as they were on TWL, and are likely preserved for compatibility reasons. The keyslot is updated immediately after *any* data(u8/u32/...) is written here, which was used on DSi to [[3DS_System_Flaws|break]] the key-generator.&lt;br /&gt;
&lt;br /&gt;
== Endianness and word order ==&lt;br /&gt;
When writing to the AES_CTR, AES_MAC or AES_KEY0/1/2/3 register, the hardware will process the written data according to the current input endianness specified in AES_CNT. However, the current specified input word order will not be honored for this register, and always defaults to reversed word order. Therefore, for normal word order, the reversal must be carried out manually if required.&lt;br /&gt;
&lt;br /&gt;
== CCM mode pitfall ==&lt;br /&gt;
Non-standard AES-CCM behaviour is observed on [[APT:Wrap|Wrap]]/[[APT:Unwrap|Unwrap]] function. According to [https://tools.ietf.org/html/rfc3610 RFC 3610], the first block B_0 for authentication should be generated from the message length and some other parameters. Using these function, it seems that the message length is aligned up to 16 when generating B_0. This makes the generated MAC not compliant with the standard when (inputsize-noncesize)%16!=0. It is very likely that this non-standard behaviour happens on the hardware level, but not confirmed yet.&lt;br /&gt;
&lt;br /&gt;
== Keyslot ranges ==&lt;br /&gt;
This is approximately a table of what is set by bootrom before booting into FIRM. Often it appears that keyslots in groups of 4 have the same keyX, and sometimes also same keyY set.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Keyslot&lt;br /&gt;
!  Name&lt;br /&gt;
!  KeyX&lt;br /&gt;
!  KeyY/Normal-key&lt;br /&gt;
!  Console unique.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00-0x03&lt;br /&gt;
| TWL keys.&lt;br /&gt;
| Probably unset.&lt;br /&gt;
| Probably unset.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x04-0x07&lt;br /&gt;
| NAND partition keys.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x08-0x0B&lt;br /&gt;
| See below.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C-0x0F&lt;br /&gt;
| SSL cert key.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x10-0x17&lt;br /&gt;
| -&lt;br /&gt;
| Not set.&lt;br /&gt;
| Not set.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x18-0x1B&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C-0x1F&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x20-0x23&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| Never used.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x25-0x27&lt;br /&gt;
| -&lt;br /&gt;
| Not set.&lt;br /&gt;
| Not set.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x28-0x2B&lt;br /&gt;
| Never used.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C-0x2F&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x30-0x33&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x34-0x37&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x38-0x3B&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C-0x3F&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Keyslot pairs (0x24, 0x28) and (0x38, 0x3C) shares the same normal-key, while at the same time having different keyX&#039;s. This suggests they were set to same normal-key by bootrom.&lt;br /&gt;
&lt;br /&gt;
== Keyslots ==&lt;br /&gt;
There are 0x40 keyslots, each of which stores three keys called keyX, keyY and normalkey. All keys can be set explicitly, but the normalkey can optionally be generated using a hardware key generator instead (see [[#Hardware_key_generator|below]]). There is no way to read the contents of a keyslot.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Keyslot&lt;br /&gt;
!  Description&lt;br /&gt;
!  KeyX set by&lt;br /&gt;
!  KeyY set by&lt;br /&gt;
!  Normal-key&lt;br /&gt;
!  Old3DS&lt;br /&gt;
|-&lt;br /&gt;
| 0x00-0x03&lt;br /&gt;
| TWL keys.&lt;br /&gt;
| NATIVE_FIRM hard-boot.&lt;br /&gt;
| NATIVE_FIRM hard-boot.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x04..0x07&lt;br /&gt;
| [[Flash_Filesystem|NAND]] partition keys.&lt;br /&gt;
&lt;br /&gt;
Keyslot is determined by [[NCSD]] partition FS type and encryption type. &lt;br /&gt;
The New3DS Process9 sets the keyY for keyslot 0x05 (New3DS CTRNAND) to a key from .(ro)data. Its keyX is console-unique and set by the bootloader.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| DSiWare export key.&lt;br /&gt;
&lt;br /&gt;
Used for encrypting the all-zero 0x10-byte block in the [[DSiWare_Exports|DSiWare_Exports]] header. Console-unique.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| This is console-unique. This keyslot is used for the NAND [[Title_Database|dbs]] images AES-CMACs, and the [[Nand/private/movable.sed]] AES-CMAC(when used).&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| SSL-certificate key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Temporary keyslot.&lt;br /&gt;
&lt;br /&gt;
Used by FIRM for general normal-key crypto. Also used by the New3DS [[FIRM]] arm9 binary loader.&lt;br /&gt;
| Arm9Loader. &lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Starting with [[5.0.0-11]], NATIVE_FIRM Process9 now sets the keyY for this to the same one it uses for initializing 3 of the keyslots&#039; keyYs from [[PSPXI:EncryptDecryptAes|here]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM boot.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| Used/initialized by the New3DS arm9 binary loader, see [[FIRM|here]].&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| See previous info for this keyslot.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| Used/initialized by the New3DS arm9 binary loader starting with [[9.5.0-22|9.5.0-X]], see [[FIRM|here]].&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| See previous info for this keyslot.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x18..0x1F&lt;br /&gt;
| These are the New3DS keyslots, where the keyX is generated with keyslot 0x11 by the New3DS arm9 binary [[FIRM|loader]]. As of [[FIRM]] [[9.6.0-24|9.6.0-X]] keyslots 0x1C..0x1F are not yet used by Process9.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM / see previous info for these keyslots.&lt;br /&gt;
| See previous info for these keyslots.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| New3DS [[9.3.0-21|9.3.0-X]] [[NCCH]] key, when ncchflag[3] is 0x0A.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| New3DS gamecard [[Savegames|savedata]] AES-CMAC key.&lt;br /&gt;
&lt;br /&gt;
Equivalent of keyslot 0x33, used when a [[NCSD]] flag is set to a certain value (implemented with [[9.3.0-21|9.3.0-X]]).&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| New3DS gamecard [[Savegames|savedata]] actual key.&lt;br /&gt;
&lt;br /&gt;
Equivalent of keyslot 0x37, used when a [[NCSD]] flag is set to a certain value (implemented with [[9.3.0-21|9.3.0-X]]).&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| New3DS [[9.6.0-24|9.6.0-X]] [[NCCH]] key, when ncchflag[3] is 0x0B.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| AGB_FIRM savegame AES-CMAC key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| AGB/NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| [[7.0.0-13|v7.0]] [[NCCH]] key, when ncchflag[3] is 0x01.&lt;br /&gt;
| NATIVE_FIRM [[Savegames#6.0.0-11_Savegame_keyY|boot]].&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| Original [[NCCH|NCCH]] key, when ncchflag[3] is 0x00 and always for certain NCCH sections.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Process9.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2D&lt;br /&gt;
| UDS local-WLAN CCMP key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2E&lt;br /&gt;
| Streetpass key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2F&lt;br /&gt;
| [[Savegames#6.0.0-11_Savegame_keyY|v6.0]] save key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| SD/NAND AES-CMAC key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for calculating the AES-CMACs under SD [[SD_Filesystem|/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;/]] (except [[DSiWare_Exports]]) and [[Flash_Filesystem|NAND]] /data/.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| APT wrap key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]]. NATIVE_FIRM sets this keyY to the same one used for keyslot 0x2E.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x32&lt;br /&gt;
| Unknown.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x33&lt;br /&gt;
| Gamecard [[Savegames|savedata]] AES-CMAC.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| SD key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for encrypting *all* SD card data under [[SD_Filesystem|/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;/]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| Movable.sed key.&lt;br /&gt;
&lt;br /&gt;
This is the keyslot used for movable.sed encryption + AES-CBC MAC with the import/export [[FSPXI:ImportIntegrityVerificationSeed|commands]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x36&lt;br /&gt;
| Unknown. Used by friends module.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x37&lt;br /&gt;
| Gamecard [[Savegames|savedata]] actual key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| BOSS key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| Download Play key, and the actual NFC key for generating retail [[Amiibo]] keys.&lt;br /&gt;
&lt;br /&gt;
This keyslot is used for two different keys. Both are available via [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]]. NATIVE_FIRM sets this keyY to the same one used for keyslot 0x2E.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3A&lt;br /&gt;
| DSiWare export key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for calculating the AES-CMACs for SD [[DSiWare_Exports]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| [[CTRCARD_Registers#CTRCARD_SECSEED|CTR-CARD hardware-crypto seed]] decryption key.&lt;br /&gt;
&lt;br /&gt;
AES-CCM is used, the keyY, nonce and MAC are stored in the [[NCSD#Card_Info_Header|Card Info Header]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| Common key.&lt;br /&gt;
&lt;br /&gt;
Used to decrypt title keys in [[Ticket]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| Used to decrypt the [[OTP_Registers|OTP]] and the FIRM sections when [[Bootloader#Non-NAND_FIRM_boot|booting from non-NAND]].&lt;br /&gt;
&lt;br /&gt;
The key used to decrypt OTP is overwritten with other keydata before FIRM boot.&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Updating keydata ===&lt;br /&gt;
The contents of the keyslot specified in AES_KEYCNT can be updated by consecutively writing four words to AES_KEYXFIFO (keyX), AES_KEYYFIFO(keyY), or AES_KEYFIFO (normalkey).&lt;br /&gt;
&lt;br /&gt;
After writing to a keyslot, the keyslot must be selected again(write AES_KEYSEL + set AES_CNT bit26), even when writing to the same keyslot. Writing the last word to a key FIFO immediately after selecting a keyslot will not affect the keyslot keydata that gets used at that time, the new keydata will not get used until the keyslot gets selected again.&lt;br /&gt;
&lt;br /&gt;
Writing to the key FIFOs with byte writes results in the AES engine converting the byte to a word for setting the key word, with this: word = (byteval) | (byteval&amp;lt;&amp;lt;8) | (byteval&amp;lt;&amp;lt;16) | (byteval&amp;lt;&amp;lt;24). The result is the same regardless of which FIFO register byte was written to.&lt;br /&gt;
&lt;br /&gt;
The TWL keyslots 0x00-0x03 can be set directly by writing to the AES_KEY0-AES_KEY3 registers.&lt;br /&gt;
&lt;br /&gt;
The key FIFOs can be written simultaneously. For example, executing the following will result in the keyX and keyY being set to all-zero(unknown for normalkey): memset(0x10009100, 0, 0x100);&lt;br /&gt;
&lt;br /&gt;
Each key FIFO has a 0x10-byte tmp-buffer for storing the words written to that FIFO. Once the last word is written to a key FIFO, the filled tmp-buffer is then written to the key-data for the keyslot selected by AES_KEYCNT at the time the last word was written.&lt;br /&gt;
&lt;br /&gt;
=== Hardware key generator ===&lt;br /&gt;
A dedicated hardware key generator can be used to generate a keyslot&#039;s normal-key from its keyX and keyY. The hardware key generator is triggered by writing the keyY, which is the only way to trigger it with the 3DS keyslots.&lt;br /&gt;
&lt;br /&gt;
The algorithm for generating the normal-key from keyX and keyY is as follows, in big-endian 128-bit unsigned wraparound arithmetic:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Mode&lt;br /&gt;
! Formula&lt;br /&gt;
|-&lt;br /&gt;
| 3DS&lt;br /&gt;
| NormalKey = (((KeyX ROL 2) XOR KeyY) + C1) ROR 41&lt;br /&gt;
|-&lt;br /&gt;
| DSi&lt;br /&gt;
| NormalKey = ((KeyX XOR KeyY) + C2) ROL 42&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unless noted otherwise, all keyslots on retail units use the hardware key generator.&lt;br /&gt;
&lt;br /&gt;
=== FIRM-launch key clearing ===&lt;br /&gt;
Starting with [[9.0.0-20]] the Process9 FIRM-launch code now &amp;quot;clears&amp;quot; the following AES keyslots, with certain keydata by writing the normal-key: 0x15 and 0x18-0x20. These are the keyslots used by the New3DS [[FIRM]] arm9bin loader(minus keyslot 0x11), the New3DS Process9 does this too.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=AES_Registers&amp;diff=19228</id>
		<title>AES Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=AES_Registers&amp;diff=19228"/>
		<updated>2017-01-11T05:37:11Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Keyslots */ Add slot 0x3F with information from Bootloader and yellows8&amp;#039;s boot9_keytool.sh.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Registers ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  Name&lt;br /&gt;
!  Address&lt;br /&gt;
!  Width&lt;br /&gt;
!  RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_CNT|AES_CNT]]&lt;br /&gt;
| 0x10009000&lt;br /&gt;
| 4&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_BLKCNT|AES_BLKCNT]]&lt;br /&gt;
| 0x10009004&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_WRFIFO/AES_RDFIFO|AES_WRFIFO]]&lt;br /&gt;
| 0x10009008&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_WRFIFO/AES_RDFIFO|AES_RDFIFO]]&lt;br /&gt;
| 0x1000900C&lt;br /&gt;
| 4&lt;br /&gt;
| R&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYSEL&lt;br /&gt;
| 0x10009010&lt;br /&gt;
| 1&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_KEYCNT|AES_KEYCNT]]&lt;br /&gt;
| 0x10009011&lt;br /&gt;
| 1&lt;br /&gt;
| RW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_CTR|AES_CTR]]&lt;br /&gt;
| 0x10009020&lt;br /&gt;
| 16&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| [[#AES_MAC|AES_MAC]]&lt;br /&gt;
| 0x10009030&lt;br /&gt;
| 16&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY0&lt;br /&gt;
| 0x10009040&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY1&lt;br /&gt;
| 0x10009070&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY2&lt;br /&gt;
| 0x100090A0&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEY3&lt;br /&gt;
| 0x100090D0&lt;br /&gt;
| 48&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYFIFO&lt;br /&gt;
| 0x10009100&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYXFIFO&lt;br /&gt;
| 0x10009104&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| AES_KEYYFIFO&lt;br /&gt;
| 0x10009108&lt;br /&gt;
| 4&lt;br /&gt;
| W&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AES_CNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 4-0&lt;br /&gt;
| Write FIFO count (0-16)&lt;br /&gt;
|-&lt;br /&gt;
| 9-5&lt;br /&gt;
| Read FIFO count (0-16)&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Flush write FIFO (1=Clear write FIFO)&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Flush read fifo (1=Clear read FIFO)&lt;br /&gt;
|-&lt;br /&gt;
| 12-13&lt;br /&gt;
| Write FIFO DMA size (0=16, 1=12, 2=8, 3=4 words)&lt;br /&gt;
|-&lt;br /&gt;
| 14-15&lt;br /&gt;
| Read FIFO DMA size (0=4, 1=8, 2=12, 3=16 words)&lt;br /&gt;
|-&lt;br /&gt;
| 18-16&lt;br /&gt;
| MAC size (encoding = (maclen-2)/2)&lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
|? (MAC related)&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| MAC input control (0 = read MAC from FIFO, 1 = read from MAC register)&lt;br /&gt;
|-&lt;br /&gt;
| 21&lt;br /&gt;
| MAC status (0 = invalid, 1 = verified)&lt;br /&gt;
|-&lt;br /&gt;
| 22&lt;br /&gt;
| Output endianness (1=Big endian, 0=Little endian)&lt;br /&gt;
|-&lt;br /&gt;
| 23&lt;br /&gt;
| Input endianness (1=Big endian, 0=Little endian)&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| Output word order (1=Normal order, 0=Reversed order)&lt;br /&gt;
|-&lt;br /&gt;
| 25&lt;br /&gt;
| Input word order (1=Normal order, 0=Reversed order)&lt;br /&gt;
|-&lt;br /&gt;
| 26&lt;br /&gt;
| Update keyslot (selects the keyslot specified by AES_KEYSEL when this bit is set)&lt;br /&gt;
|-&lt;br /&gt;
| 29-27&lt;br /&gt;
| Mode (0=CCM decrypt, 1=CCM encrypt, 2=CTR, 3=CTR, 4=CBC decrypt, 5=CBC encrypt, 6=ECB decrypt, 7=ECB encrypt)&lt;br /&gt;
|-&lt;br /&gt;
| 30&lt;br /&gt;
| Interrupt enable (1=enable, 0=disable)&lt;br /&gt;
|-&lt;br /&gt;
| 31&lt;br /&gt;
| Start (1=enable/busy, 0=idle)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When bit31 is set, this register essentially becomes locked and doesn&#039;t change when written to. However if bit26 is &amp;quot;set&amp;quot;, keyslot-selection is cued to be handled when bit31 is cleared.&lt;br /&gt;
&lt;br /&gt;
Clearing bit31 while the AES engine is doing crypto will result in the AES engine stopping crypto, once it finishes processing the current block.&lt;br /&gt;
&lt;br /&gt;
Read/Write FIFO counts and the MAC status can never be set by writing to AES_CNT, they are read-only.&lt;br /&gt;
&lt;br /&gt;
Changing the input word order triggers the key/keyX/keyY FIFOs to be flushed.&lt;br /&gt;
&lt;br /&gt;
== AES_BLKCNT ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 31-16&lt;br /&gt;
| (Data length)&amp;gt;&amp;gt;4 (i.e. the number of blocks to process)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AES_WRFIFO/AES_RDFIFO ==&lt;br /&gt;
The AES engine can accept up to 64 bytes of input data (16 32-bit words) and can hold up to 64 bytes of output data at a time (for a total of 128 bytes of buffered data). Bits 12-13 and 14-15 in AES_CNT configure the DMA request for the relevant FIFO (see above).&lt;br /&gt;
&lt;br /&gt;
The input data for the AES crypto operation is written to AES_WRFIFO, the output data is read from AES_RDFIFO.&lt;br /&gt;
&lt;br /&gt;
Reading from AES_RDFIFO when there&#039;s no data available in the RDFIFO will result in reading the last word that was in the RDFIFO.&lt;br /&gt;
&lt;br /&gt;
When triggering either RDFIFO or WRFIFO to be flushed, the AES Engine does not clear either buffer.&lt;br /&gt;
&lt;br /&gt;
Word order and endianness can be changed between each read/write to these FIFOs. However changing the word order when writing to WRFIFO can cause the word to be written outside the current block, leaving uninitialized data in its place. Attempts to change endianness or word order are not honored when reading from RDFIFO when no more data is available.&lt;br /&gt;
&lt;br /&gt;
== AES_KEYCNT ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Bit&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 5-0&lt;br /&gt;
| Keyslot&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Hardware key-generator type: 0 = 3DS, 1 = DSi.&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| This normally has value 1 written here when updating keys. 0 = disable key FIFO flush, 1 = enable key FIFO flush.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit6 is only used when keyslots &amp;gt;=4 are used, value1 has the same affect as doing key-init with the TWL keyslots. Bit6 is only checked when a keyY was completely written, for when the final-normalkey needs updated via the key-generator. Changing bit6 has no affect on the generated normalkey when writing to this bit immediately after writing the last keyY word.&lt;br /&gt;
&lt;br /&gt;
== AES_CTR ==&lt;br /&gt;
This register specifies the counter (CTR mode), nonce (CCM mode) or the initialization vector (CBC mode) depending on the mode of operation.&lt;br /&gt;
For CBC and CTR mode this register takes up the full 16 bytes, but for CCM mode the nonce is only the first 12 bytes.&lt;br /&gt;
The AES engine will automatically increment the counter up to the maximum BLKCNT, after which point it must be manually incremented and set again.&lt;br /&gt;
&lt;br /&gt;
== AES_MAC ==&lt;br /&gt;
This register specifies the message authentication code (MAC) for use in CCM mode.&lt;br /&gt;
&lt;br /&gt;
== AES_KEY0/1/2/3 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-15&lt;br /&gt;
| Normalkey&lt;br /&gt;
|-&lt;br /&gt;
| 16-31&lt;br /&gt;
| KeyX&lt;br /&gt;
|-&lt;br /&gt;
| 32-47&lt;br /&gt;
| KeyY&lt;br /&gt;
|-}&lt;br /&gt;
&lt;br /&gt;
These registers are the same as they were on TWL, and are likely preserved for compatibility reasons. The keyslot is updated immediately after *any* data(u8/u32/...) is written here, which was used on DSi to [[3DS_System_Flaws|break]] the key-generator.&lt;br /&gt;
&lt;br /&gt;
== Endianness and word order ==&lt;br /&gt;
When writing to the AES_CTR, AES_MAC or AES_KEY0/1/2/3 register, the hardware will process the written data according to the current input endianness specified in AES_CNT. However, the current specified input word order will not be honored for this register, and always defaults to reversed word order. Therefore, for normal word order, the reversal must be carried out manually if required.&lt;br /&gt;
&lt;br /&gt;
== CCM mode pitfall ==&lt;br /&gt;
Non-standard AES-CCM behaviour is observed on [[APT:Wrap|Wrap]]/[[APT:Unwrap|Unwrap]] function. According to [https://tools.ietf.org/html/rfc3610 RFC 3610], the first block B_0 for authentication should be generated from the message length and some other parameters. Using these function, it seems that the message length is aligned up to 16 when generating B_0. This makes the generated MAC not compliant with the standard when (inputsize-noncesize)%16!=0. It is very likely that this non-standard behaviour happens on the hardware level, but not confirmed yet.&lt;br /&gt;
&lt;br /&gt;
== Keyslot ranges ==&lt;br /&gt;
This is approximately a table of what is set by bootrom before booting into FIRM. Often it appears that keyslots in groups of 4 have the same keyX, and sometimes also same keyY set.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Keyslot&lt;br /&gt;
!  Name&lt;br /&gt;
!  KeyX&lt;br /&gt;
!  KeyY/Normal-key&lt;br /&gt;
!  Console unique.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00-0x03&lt;br /&gt;
| TWL keys.&lt;br /&gt;
| Probably unset.&lt;br /&gt;
| Probably unset.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x04-0x07&lt;br /&gt;
| NAND partition keys.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x08-0x0B&lt;br /&gt;
| See below.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C-0x0F&lt;br /&gt;
| SSL cert key.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x10-0x17&lt;br /&gt;
| -&lt;br /&gt;
| Not set.&lt;br /&gt;
| Not set.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x18-0x1B&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C-0x1F&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x20-0x23&lt;br /&gt;
| Never used.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| Never used.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x25-0x27&lt;br /&gt;
| -&lt;br /&gt;
| Not set.&lt;br /&gt;
| Not set.&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
| 0x28-0x2B&lt;br /&gt;
| Never used.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: orange&amp;quot; | Normalkey is not. keyX is. keyY unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C-0x2F&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x30-0x33&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x34-0x37&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Same for all, probably.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x38-0x3B&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Same for all.&lt;br /&gt;
| Different for all.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C-0x3F&lt;br /&gt;
| Various uniques.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| Individually set.&lt;br /&gt;
| style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Keyslot pairs (0x24, 0x28) and (0x38, 0x3C) shares the same normal-key, while at the same time having different keyX&#039;s. This suggests they were set to same normal-key by bootrom.&lt;br /&gt;
&lt;br /&gt;
== Keyslots ==&lt;br /&gt;
There are 0x40 keyslots, each of which stores three keys called keyX, keyY and normalkey. All keys can be set explicitly, but the normalkey can optionally be generated using a hardware key generator instead (see [[#Hardware_key_generator|below]]). There is no way to read the contents of a keyslot.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Keyslot&lt;br /&gt;
!  Description&lt;br /&gt;
!  KeyX set by&lt;br /&gt;
!  KeyY set by&lt;br /&gt;
!  Normal-key&lt;br /&gt;
!  Old3DS&lt;br /&gt;
|-&lt;br /&gt;
| 0x00-0x03&lt;br /&gt;
| TWL keys.&lt;br /&gt;
| NATIVE_FIRM hard-boot.&lt;br /&gt;
| NATIVE_FIRM hard-boot.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x04..0x07&lt;br /&gt;
| [[Flash_Filesystem|NAND]] partition keys.&lt;br /&gt;
&lt;br /&gt;
Keyslot is determined by [[NCSD]] partition FS type and encryption type. &lt;br /&gt;
The New3DS Process9 sets the keyY for keyslot 0x05 (New3DS CTRNAND) to a key from .(ro)data. Its keyX is console-unique and set by the bootloader.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| DSiWare export key.&lt;br /&gt;
&lt;br /&gt;
Used for encrypting the all-zero 0x10-byte block in the [[DSiWare_Exports|DSiWare_Exports]] header. Console-unique.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| This is console-unique. This keyslot is used for the NAND [[Title_Database|dbs]] images AES-CMACs, and the [[Nand/private/movable.sed]] AES-CMAC(when used).&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| See above keyslot info.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| SSL-certificate key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Temporary keyslot.&lt;br /&gt;
&lt;br /&gt;
Used by FIRM for general normal-key crypto. Also used by the New3DS [[FIRM]] arm9 binary loader.&lt;br /&gt;
| Arm9Loader. &lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Starting with [[5.0.0-11]], NATIVE_FIRM Process9 now sets the keyY for this to the same one it uses for initializing 3 of the keyslots&#039; keyYs from [[PSPXI:EncryptDecryptAes|here]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM boot.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| Used/initialized by the New3DS arm9 binary loader, see [[FIRM|here]].&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| See previous info for this keyslot.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| Used/initialized by the New3DS arm9 binary loader starting with [[9.5.0-22|9.5.0-X]], see [[FIRM|here]].&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| See previous info for this keyslot.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x18..0x1F&lt;br /&gt;
| These are the New3DS keyslots, where the keyX is generated with keyslot 0x11 by the New3DS arm9 binary [[FIRM|loader]]. As of [[FIRM]] [[9.6.0-24|9.6.0-X]] keyslots 0x1C..0x1F are not yet used by Process9.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM / see previous info for these keyslots.&lt;br /&gt;
| See previous info for these keyslots.&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| New3DS [[9.3.0-21|9.3.0-X]] [[NCCH]] key, when ncchflag[3] is 0x0A.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| New3DS gamecard [[Savegames|savedata]] AES-CMAC key.&lt;br /&gt;
&lt;br /&gt;
Equivalent of keyslot 0x33, used when a [[NCSD]] flag is set to a certain value (implemented with [[9.3.0-21|9.3.0-X]]).&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| New3DS gamecard [[Savegames|savedata]] actual key.&lt;br /&gt;
&lt;br /&gt;
Equivalent of keyslot 0x37, used when a [[NCSD]] flag is set to a certain value (implemented with [[9.3.0-21|9.3.0-X]]).&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| New3DS [[9.6.0-24|9.6.0-X]] [[NCCH]] key, when ncchflag[3] is 0x0B.&lt;br /&gt;
| Arm9Loader.&lt;br /&gt;
| NATIVE_FIRM&lt;br /&gt;
| -&lt;br /&gt;
| No&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| AGB_FIRM savegame AES-CMAC key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| AGB/NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x25&lt;br /&gt;
| [[7.0.0-13|v7.0]] [[NCCH]] key, when ncchflag[3] is 0x01.&lt;br /&gt;
| NATIVE_FIRM [[Savegames#6.0.0-11_Savegame_keyY|boot]].&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| Original [[NCCH|NCCH]] key, when ncchflag[3] is 0x00 and always for certain NCCH sections.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Process9.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2D&lt;br /&gt;
| UDS local-WLAN CCMP key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2E&lt;br /&gt;
| Streetpass key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x2F&lt;br /&gt;
| [[Savegames#6.0.0-11_Savegame_keyY|v6.0]] save key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| SD/NAND AES-CMAC key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for calculating the AES-CMACs under SD [[SD_Filesystem|/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;/]] (except [[DSiWare_Exports]]) and [[Flash_Filesystem|NAND]] /data/.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| APT wrap key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]]. NATIVE_FIRM sets this keyY to the same one used for keyslot 0x2E.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x32&lt;br /&gt;
| Unknown.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x33&lt;br /&gt;
| Gamecard [[Savegames|savedata]] AES-CMAC.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| SD key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for encrypting *all* SD card data under [[SD_Filesystem|/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;/]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| Movable.sed key.&lt;br /&gt;
&lt;br /&gt;
This is the keyslot used for movable.sed encryption + AES-CBC MAC with the import/export [[FSPXI:ImportIntegrityVerificationSeed|commands]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x36&lt;br /&gt;
| Unknown. Used by friends module.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x37&lt;br /&gt;
| Gamecard [[Savegames|savedata]] actual key.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| BOSS key.&lt;br /&gt;
&lt;br /&gt;
See [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| Download Play key, and the actual NFC key for generating retail [[Amiibo]] keys.&lt;br /&gt;
&lt;br /&gt;
This keyslot is used for two different keys. Both are available via [[PSPXI:EncryptDecryptAes|EncryptDecryptAes]]. NATIVE_FIRM sets this keyY to the same one used for keyslot 0x2E.&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3A&lt;br /&gt;
| DSiWare export key.&lt;br /&gt;
&lt;br /&gt;
This keyY is initialized via [[Nand/private/movable.sed|movable.sed]]. This is used for calculating the AES-CMACs for SD [[DSiWare_Exports]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| [[CTRCARD_Registers#CTRCARD_SECSEED|CTR-CARD hardware-crypto seed]] decryption key.&lt;br /&gt;
&lt;br /&gt;
AES-CCM is used, the keyY, nonce and MAC are stored in the [[NCSD#Card_Info_Header|Card Info Header]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| Common key.&lt;br /&gt;
&lt;br /&gt;
Used to decrypt title keys in [[Ticket]].&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| NATIVE_FIRM.&lt;br /&gt;
| -&lt;br /&gt;
| Yes&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| Used to decrypt the [[OTP_Registers|OTP]] and the FIRM sections when [[Bootloader#Non-NAND_FIRM_boot|booting from non-NAND]].&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| Bootrom.&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Updating keydata ===&lt;br /&gt;
The contents of the keyslot specified in AES_KEYCNT can be updated by consecutively writing four words to AES_KEYXFIFO (keyX), AES_KEYYFIFO(keyY), or AES_KEYFIFO (normalkey).&lt;br /&gt;
&lt;br /&gt;
After writing to a keyslot, the keyslot must be selected again(write AES_KEYSEL + set AES_CNT bit26), even when writing to the same keyslot. Writing the last word to a key FIFO immediately after selecting a keyslot will not affect the keyslot keydata that gets used at that time, the new keydata will not get used until the keyslot gets selected again.&lt;br /&gt;
&lt;br /&gt;
Writing to the key FIFOs with byte writes results in the AES engine converting the byte to a word for setting the key word, with this: word = (byteval) | (byteval&amp;lt;&amp;lt;8) | (byteval&amp;lt;&amp;lt;16) | (byteval&amp;lt;&amp;lt;24). The result is the same regardless of which FIFO register byte was written to.&lt;br /&gt;
&lt;br /&gt;
The TWL keyslots 0x00-0x03 can be set directly by writing to the AES_KEY0-AES_KEY3 registers.&lt;br /&gt;
&lt;br /&gt;
The key FIFOs can be written simultaneously. For example, executing the following will result in the keyX and keyY being set to all-zero(unknown for normalkey): memset(0x10009100, 0, 0x100);&lt;br /&gt;
&lt;br /&gt;
Each key FIFO has a 0x10-byte tmp-buffer for storing the words written to that FIFO. Once the last word is written to a key FIFO, the filled tmp-buffer is then written to the key-data for the keyslot selected by AES_KEYCNT at the time the last word was written.&lt;br /&gt;
&lt;br /&gt;
=== Hardware key generator ===&lt;br /&gt;
A dedicated hardware key generator can be used to generate a keyslot&#039;s normal-key from its keyX and keyY. The hardware key generator is triggered by writing the keyY, which is the only way to trigger it with the 3DS keyslots.&lt;br /&gt;
&lt;br /&gt;
The algorithm for generating the normal-key from keyX and keyY is as follows, in big-endian 128-bit unsigned wraparound arithmetic:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Mode&lt;br /&gt;
! Formula&lt;br /&gt;
|-&lt;br /&gt;
| 3DS&lt;br /&gt;
| NormalKey = (((KeyX ROL 2) XOR KeyY) + C1) ROR 41&lt;br /&gt;
|-&lt;br /&gt;
| DSi&lt;br /&gt;
| NormalKey = ((KeyX XOR KeyY) + C2) ROL 42&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unless noted otherwise, all keyslots on retail units use the hardware key generator.&lt;br /&gt;
&lt;br /&gt;
=== FIRM-launch key clearing ===&lt;br /&gt;
Starting with [[9.0.0-20]] the Process9 FIRM-launch code now &amp;quot;clears&amp;quot; the following AES keyslots, with certain keydata by writing the normal-key: 0x15 and 0x18-0x20. These are the keyslots used by the New3DS [[FIRM]] arm9bin loader(minus keyslot 0x11), the New3DS Process9 does this too.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Mysteries&amp;diff=19178</id>
		<title>Mysteries</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Mysteries&amp;diff=19178"/>
		<updated>2017-01-06T07:54:36Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Add question how CTRAging is launched. Copied from Factory Setup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of mysteries.&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
* What is the CTR abbreviation?&lt;br /&gt;
: C may stand for Chiheisen (&amp;quot;horizon&amp;quot; in Japanese, the O3DS&#039;s codename being &amp;quot;Project Horizon&amp;quot;).&lt;br /&gt;
:: Not true, Horizon refers to the OS.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Why are there two CTRCARD controllers? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; Also [http://problemkaputt.de/twl-core.jpg DSi SoC pinout] shows evidence of dual NTRCARD controllers on the final DSi SoC. (This was a [http://i.imgur.com/0kJlbEw.png planned feature] of the DSi before being axed later in development)&lt;br /&gt;
&lt;br /&gt;
=== Why are there two EMMC controllers? ===&lt;br /&gt;
&#039;&#039;&#039;Theory:&#039;&#039;&#039; At some point during 3DS hardware development there was an idea to split up CTR and TWL nand into two different chips.&lt;br /&gt;
=== Is there a JTAG? ===&lt;br /&gt;
=== Is there more than one revision of the bootrom? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; Bootrom visible portion has been dumped on 3DS, 3DSXL, 2DS, New3DS. All matching exactly.&lt;br /&gt;
=== What is the EMMC controller @ 0x10100000 doing? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; There&#039;s dead code in NWM referencing it.&lt;br /&gt;
=== Why did they put NTRCARD accessible from ARM11? ===&lt;br /&gt;
&#039;&#039;&#039;Theory:&#039;&#039;&#039; At some point during 3DS hardware development there was a concept where ARM11 ran a menu with DS(i) icons while ARM9 was in TWL mode.&lt;br /&gt;
&lt;br /&gt;
=== Is there a secret message embedded in the 3DS keyscrambler constant? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; TWL keyscrambler constant was Nintendo in Japanese, utf-8 encoded.&lt;br /&gt;
&lt;br /&gt;
=== What is the PDN abbreviation? ===&lt;br /&gt;
: Power distribution network&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
=== What was the problem in &amp;quot;initial program loader&amp;quot; that was mentioned in an FCC filing by Nintendo for 2DS? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; http://www.neogaf.com/forum/showthread.php?t=814624&amp;amp;page=1&lt;br /&gt;
=== What did SVC 0x74 in the ARM11 kernel do before it got stubbed? ===&lt;br /&gt;
=== What is the PTM abbreviation? ===&lt;br /&gt;
=== Why is the DTCM not used anywhere except bootrom? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; Bootrom is known to use part of DTCM as state, memsetting it to 0 when it&#039;s done. After that, it is never used again.&lt;br /&gt;
=== How is CTRAging launched during factory setup? ===&lt;br /&gt;
&#039;&#039;&#039;Background:&#039;&#039;&#039; No TestMenu version is capable of launching CTRAging directly: O3DS factory TestMenu can only launch DevMenu installed on NAND, the inserted cartridge and the TWL/AGB test apps; N3DS factory TestMenu can only launch DevMenu installed on NAND, the inserted cartridge and System Settings.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=19144</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=19144"/>
		<updated>2017-01-03T06:23:11Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Plaintext OTP */ Fix leftover from ITCM c/p.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This region (0x10012000-0x10012100) is used as persistent storage on SoC and for passing the TWL console ID around (0x10012100-0x10012108).&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Console-unique keys are derived from here. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is the console-unique data store, including [[CTCert]] etc, that ends up in ITCM at 0x01FFB800. After decryption, the first 0x90-bytes of plaintext are copied to 0x01FFB800 if hash verification passes. Refer to [[Memory_layout#ARM9_ITCM]] for what is contained in the decrypted OTP.&lt;br /&gt;
&lt;br /&gt;
On [[FIRM]] versions prior to [[3.0.0-6|3.0.0-X]], this region was left unprotected. On versions since [[3.0.0-6|3.0.0-X]], this has been fixed, and the region disable is now done by Kernel9 after doing console-unique TWL keyinit, by setting bit 1 of [[CONFIG|REG_SYSPROT9]]. However, with the [[New_3DS]] FIRM ARM9 binary this is now done in the [[FIRM]] ARM9 binary loader, which also uses the 0x10012000 region for New 3DS key generation.&lt;br /&gt;
&lt;br /&gt;
On development units ([[CONFIG|UNITINFO]] != 0) ARM9 uses the first 8-bytes from 0x10012000 for the TWL Console ID. This region doesn&#039;t seem to be used by NATIVE_FIRM on retail at all, besides New3DS key-generation in the [[FIRM|ARM9-loader]].&lt;br /&gt;
&lt;br /&gt;
Normally [[Bootloader|Boot9]] will pass plaintext_otp+0x90 to the AES keyinit function, but when hash verification fails it will pass 0x10012000(otp+0) instead.&lt;br /&gt;
&lt;br /&gt;
== Sections ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| Console-unique data encrypted with AES-CBC. The normalkey and IV are stored in Boot9. The last 0x20-bytes of plaintext are a SHA256 hash over the first 0xE0-bytes of plaintext.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x8&lt;br /&gt;
| Before writing REG_SYSPROT9 bit1, the ARM9 copies the 8-byte TWL Console ID here. This sets the registers at 0x4004D00 for ARM7.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Plaintext OTP ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x90&lt;br /&gt;
| Copied into ITCM. The encrypted version of this is what New3DS-arm9loader hashes for key-generation.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is always 0xDEADB00F.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the u32 DeviceId.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is the fall-back keyY used for movable.sed keyY when movable.sed doesn&#039;t exist in NAND(the last two words here are used on retail for generating console-unique TWL keydata/etc). This is also used for &amp;quot;LocalFriendCodeSeed&amp;quot;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| 0x1&lt;br /&gt;
| This is the [[CTCert]] issuer type: 0 = retail &amp;quot;Nintendo CA - G3_NintendoCTR2prod&amp;quot;, non-zero = dev &amp;quot;Nintendo CA - G3_NintendoCTR2dev&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| 0x6&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the CTCert ECDSA exponent, this is byte-swapped when plaintext_otp+0x18 is &amp;gt;=5.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1E&lt;br /&gt;
| This is the CTCert ECDSA privk.&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x3C&lt;br /&gt;
| This is the CTCert ECDSA signature.&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is all-zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x90&lt;br /&gt;
| 0x70&lt;br /&gt;
| Used by Boot9 for generating the console-unique AES [[AES_Registers|keyXs]].&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=19143</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=19143"/>
		<updated>2017-01-03T06:17:25Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Copy over plaintext OTP info from the ITCM page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This region (0x10012000-0x10012100) is used as persistent storage on SoC and for passing the TWL console ID around (0x10012100-0x10012108).&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Console-unique keys are derived from here. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is the console-unique data store, including [[CTCert]] etc, that ends up in ITCM at 0x01FFB800. After decryption, the first 0x90-bytes of plaintext are copied to 0x01FFB800 if hash verification passes. Refer to [[Memory_layout#ARM9_ITCM]] for what is contained in the decrypted OTP.&lt;br /&gt;
&lt;br /&gt;
On [[FIRM]] versions prior to [[3.0.0-6|3.0.0-X]], this region was left unprotected. On versions since [[3.0.0-6|3.0.0-X]], this has been fixed, and the region disable is now done by Kernel9 after doing console-unique TWL keyinit, by setting bit 1 of [[CONFIG|REG_SYSPROT9]]. However, with the [[New_3DS]] FIRM ARM9 binary this is now done in the [[FIRM]] ARM9 binary loader, which also uses the 0x10012000 region for New 3DS key generation.&lt;br /&gt;
&lt;br /&gt;
On development units ([[CONFIG|UNITINFO]] != 0) ARM9 uses the first 8-bytes from 0x10012000 for the TWL Console ID. This region doesn&#039;t seem to be used by NATIVE_FIRM on retail at all, besides New3DS key-generation in the [[FIRM|ARM9-loader]].&lt;br /&gt;
&lt;br /&gt;
Normally [[Bootloader|Boot9]] will pass plaintext_otp+0x90 to the AES keyinit function, but when hash verification fails it will pass 0x10012000(otp+0) instead.&lt;br /&gt;
&lt;br /&gt;
== Sections ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| Console-unique data encrypted with AES-CBC. The normalkey and IV are stored in Boot9. The last 0x20-bytes of plaintext are a SHA256 hash over the first 0xE0-bytes of plaintext.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x8&lt;br /&gt;
| Before writing REG_SYSPROT9 bit1, the ARM9 copies the 8-byte TWL Console ID here. This sets the registers at 0x4004D00 for ARM7.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Plaintext OTP ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x90&lt;br /&gt;
| Copied into ITCM. The encrypted version of this is what New3DS-arm9loader hashes for key-generation.&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is always 0xDEADB00F.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the u32 DeviceId.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is the fall-back keyY used for movable.sed keyY when movable.sed doesn&#039;t exist in NAND(the last two words here are used on retail for generating console-unique TWL keydata/etc). This is also used for &amp;quot;LocalFriendCodeSeed&amp;quot;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| 0x1&lt;br /&gt;
| This is the [[CTCert]] issuer type: 0 = retail &amp;quot;Nintendo CA - G3_NintendoCTR2prod&amp;quot;, non-zero = dev &amp;quot;Nintendo CA - G3_NintendoCTR2dev&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| 0x6&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the CTCert ECDSA exponent, this is byte-swapped when *((u8*)(0x01FFB800+0x18)) is &amp;gt;=5.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x26&lt;br /&gt;
| 0x1E&lt;br /&gt;
| This is the CTCert ECDSA privk.&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x3C&lt;br /&gt;
| This is the CTCert ECDSA signature.&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is all-zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x90&lt;br /&gt;
| 0x70&lt;br /&gt;
| Used by Boot9 for generating the console-unique AES [[AES_Registers|keyXs]].&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=19075</id>
		<title>3DS System Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=19075"/>
		<updated>2016-12-30T07:26:10Z</updated>

		<summary type="html">&lt;p&gt;SciresM: vectors -&amp;gt; uninitialized ram has been exploited.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of publicly known system flaws, for userland applications/applets flaws see [[3DS_Userland_Flaws|here]].&lt;br /&gt;
&lt;br /&gt;
=Stale / Rejected Efforts=&lt;br /&gt;
* Neimod has been working on a RAM dumping setup for a little while now. He&#039;s de-soldered the 3DS&#039;s RAM chip and hooked it and the RAM pinouts on the 3DS&#039; PCB up to a custom RAM dumping setup. A while ago he published photos showing his setup to be working quite well, with the 3DS successfully booting up. However, his flickr stream is now private along with most of his work.&lt;br /&gt;
&lt;br /&gt;
* Someone (who will remain unnamed) has released CFW and CIA installers, all of which is copied from the work of others, or copyrighted material.&lt;br /&gt;
&lt;br /&gt;
==Tips and info==&lt;br /&gt;
The 3DS uses the XN feature of the ARM11 processor. There&#039;s no official way from applications to enable executable permission for memory containing arbitrary unsigned code(there&#039;s a [[SVC]] for this, but only [[RO_Services|RO-module]] has access to it). A usable userland exploit would still be useful: you could only do return-oriented-programming with it initially. From ROP one could then exploit system flaw(s), see below.&lt;br /&gt;
&lt;br /&gt;
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped(accessing SD data is far easier by running code on the target 3DS however).&lt;br /&gt;
&lt;br /&gt;
=System flaws=&lt;br /&gt;
== Hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed with hardware model/revision&lt;br /&gt;
!  Newest hardware model/revision this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| ARM9/ARM11 bootrom vectors point at uninitialized RAM&lt;br /&gt;
| ARM9&#039;s and ARM11&#039;s exception vectors are hardcoded to point at the CPU&#039;s internal memory (0x08000000 region for ARM9, AXIWRAM for ARM11). While the bootrom does set them up to point to an endless loop at some point during boot, it does not do so immediately. As such, a carefully-timed fault injection (via hardware) to trigger an exception (such as an invalid instruction) will cause execution to fall into ARM9 RAM. &lt;br /&gt;
Since RAM isn&#039;t cleared on boot (see below), one can immediately start execution of their own code here to dump bootrom, OTP, etc.&lt;br /&gt;
The ARM9 bootrom does the following at reset:  reset vector branches to another instruction, then branches to bootrom+0x8000. Hence, there&#039;s no way to know for certain when exactly the ARM9 exception-vector data stored in memory gets initialized.&lt;br /&gt;
&lt;br /&gt;
This requires *very* *precise* timing for triggering the hardware fault.&lt;br /&gt;
&lt;br /&gt;
It has been exploited by derrek (others?) to dump the ARM9 bootrom as of Summer 2015.&lt;br /&gt;
| None: all available 3DS models at the time of writing have the exact same ARM9/ARM11 bootrom for the unprotected areas.&lt;br /&gt;
| New3DS&lt;br /&gt;
| End of February 2014&lt;br /&gt;
| [[User:Derrek|derrek]], WulfyStylez (May 2015) independently&lt;br /&gt;
|-&lt;br /&gt;
| Missing AES key clearing&lt;br /&gt;
| The hardware AES engine does not clear keys when doing a hard reset/reboot.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| August 2014&lt;br /&gt;
| Mathieulh/Others&lt;br /&gt;
|-&lt;br /&gt;
| No RAM clearing on reboots&lt;br /&gt;
| On an MCU-triggered reboot all RAM including FCRAM/ARM9 memory/AXIWRAM/VRAM keeps its contents.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2014&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| 32bits of actual console-unique TWLNAND keydata&lt;br /&gt;
| On retail the 8-bytes at ARM9 address [[Memory_layout|0x01FFB808]] are XORed with hard-coded data, to generate the TWL console-unique keys, including TWLNAND. On Old3DS the high u32 is always 0x0, while on New3DS that u32 is always 0x2. On top of this, the lower u32&#039;s highest bit is always ORed. only 31 bits of the TWL console-unique keydata / TWL consoleID are actually console-unique.&lt;br /&gt;
This allows one to easily bruteforce the TWL console-unique keydata with *just* data from TWLNAND. On DSi the actual console-unique data for key generation is 8-bytes(all bytes actually set).&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| DSi / 3DS-TWL key-generator&lt;br /&gt;
| After using the key generator to generate the normal-key, you could overwrite parts of the normal-key with your own data and then recover the key-generator output by comparing the new crypto output with the original crypto output. From the normal-key outputs, you could deduce the TWL key-generator function.&lt;br /&gt;
This applies to the keyX/keyY too.&lt;br /&gt;
&lt;br /&gt;
This attack does not work for the 3DS key-generator because keyslots 0-3 are only for TWL keys.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2011&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| 3DS key-generator&lt;br /&gt;
| The algorithm for generating the normal-keys for keyslots is cryptographically weak.  As a result, it is easily susceptible to differential cryptanalysis if the normal-key corresponding to any scrambler-generated keyslot is discovered.&lt;br /&gt;
&lt;br /&gt;
Several such pairs of matching normal-keys and KeyY values were found, leading to deducing the key-generator function.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| FIRM partitions known-plaintext&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are encrypted with AES-CTR without a MAC. Since this works by XOR&#039;ing data with a static (per-console in this case) keystream, one can deduce the keystream of a portion of each FIRM partition if they have the actual FIRM binary stored in it.&lt;br /&gt;
&lt;br /&gt;
This can be paired with many exploits. For example, it allows minor FIRM downgrades (i.e. 10.4 to 9.6 or 9.5 to 9.4, but not 9.6 to 9.5).&lt;br /&gt;
&lt;br /&gt;
This can be somewhat addressed by having a FIRM header skip over previously used section offsets, but this would just air-gap newer FIRMs without fixing the core bug. This can also only be done a limited number of times due to the size of FIRM versus the size of the partitions.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| &lt;br /&gt;
| Everyone&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM9 software ==&lt;br /&gt;
=== arm9loader ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Rearrangable keys in the NAND keystore&lt;br /&gt;
| Due to the keystore being encrypted with AES-ECB, one can rearrange blocks and still have the NAND keystore decrypt in a deterministic way. &lt;br /&gt;
&lt;br /&gt;
Using 10.0 FIRM it is possible to rearrange keys such that ARM9 memory is executed. As such using existing ARM9 execution 10.0 FIRM can be written to NAND and a payload written to memory, with the payload to be executed post-K9L using an MCU reboot.&lt;br /&gt;
| arm9loaderhax given existing ARM9 code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Early 2016&lt;br /&gt;
| 27 September 2016&lt;br /&gt;
| Myria, [[User:Dark samus|dark_samus]]; mathieulh (independently); [[User:Plutooo|plutoo]] (independently) + others&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared OTP hash keydata in console-unique 0x11 key-generation&lt;br /&gt;
| Kernel9Loader does not clear the [[SHA_Registers#SHA_HASH|SHA_HASH register]] after use. As a result, the data stored here as K9L hands over to Kernel9 is the hash of [[OTP_Registers|OTP data]] used to seed the [[FIRM#New_3DS_FIRM|console-unique NAND keystore decryption key]] set on keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Retrieving this keydata and the [[Flash_Filesystem#0x12C00|NAND keystore]] of the same device allows calculating the decrypted New3DS NAND keystore (non-unique, common to all New3DS units), which contains AES normal keys, also set on keyslot 0x11, which are then used to derive all current [[AES_Registers#Keyslots|New3DS-only AES keyXs]] including the newer batch introduced in [[9.6.0-24#arm9loader|9.6.0-X]]. From there, it is trivial to perform the same key derivation in order to initialize those keys on any system version, and even on Old3DS.&lt;br /&gt;
&lt;br /&gt;
This can be performed by exploiting the &amp;quot;arm9loaderhax&amp;quot; vulnerability to obtain post-K9L code execution after an MCU reboot (the bootrom section-loading fail is not relevant here, this attack was performed without OTP data by brute-forcing keys), and using this to dump the SHA_HASH register. This attack works on any FIRM version shipping a vulnerable version of K9L, whereas OTP dumping required a boot of &amp;lt;[[3.0.0-6|3.0.0-X]].&lt;br /&gt;
&lt;br /&gt;
This attack results in obtaining the entire (0x200-bytes) NAND keystore - it was confirmed at a later date that this keystore is encrypted with the same key (by comparing the decrypted data from multiple units), and therefore using another key in this store will not remedy the issue as all keys are known (i.e. later, unused keys decrypt to the same 0x200-bytes constant with the same OTP hash). Later keys could have been encrypted differently but this is not the case. As a result of this, it is not possible for Nintendo to use K9L again in its current format for its intended purpose, though this was not news from the moment people dumped a New3DS OTP.&lt;br /&gt;
| Derivation of all New3DS keys generated via the NAND keystore (0x1B &amp;quot;Secure4&amp;quot; etc.)&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| ~April 2015, implemented in May 2015&lt;br /&gt;
| 13 January 2016&lt;br /&gt;
| [[User:WulfyStylez|WulfyStylez]], [[User:Dazzozo|Dazzozo]], [[User:Shinyquagsire23|shinyquagsire23]] (complimentary + implemented), [[User:Plutooo|plutoo]], Normmatt (discovered independently)&lt;br /&gt;
|-&lt;br /&gt;
| enhanced-arm9loaderhax&lt;br /&gt;
| See the 32c3 3ds talk.&lt;br /&gt;
Since this is a combination of a trick with the arm9-bootrom + arm9loaderhax, and since you have to manually write FIRM to the firm0/firm1 NAND partitions, this can&#039;t be completely fixed. Any system with existing ARM9 code execution and an OTP/OTP hash dump can exploit this. Additionally, by using the FIRM partition known-plaintext bug and bruteforcing the second entry in the keystore, this can currently be exploited on all New3DS systems without any other prerequisite hacks.&lt;br /&gt;
| arm9loaderhax which automatically occurs at hard-boot.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| Theorized around mid July, 2015. Later implemented+tested by [[User:Plutooo|plutoo]] and [[User:Derrek|derrek]].&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Missing verification-block for the 9.6 keys (arm9loaderhax)&lt;br /&gt;
| Starting with [[9.6.0-24|9.6.0-X]] a new set of NAND-based keys were introduced. However, no verification block was added to verify that the new key read from NAND is correct. This was technically an issue from [[9.5.0-22|9.5.0-X]] with the original sector+0 keydata, however the below is only possible with [[9.6.0-24|9.6.0-X]] since keyslots 0x15 and 0x16 are generated from different 0x11 keyXs.&lt;br /&gt;
&lt;br /&gt;
Writing an incorrect key to NAND will cause arm9loader to decrypt the ARM9 kernel as garbage and then jump to it.&lt;br /&gt;
&lt;br /&gt;
This allows an hardware-based attack where you can boot into an older exploited firmware, fill all memory with NOP sleds/jump-instructions, and then reboot into executing garbage. By automating this process with various input keydata, eventually you&#039;ll find some garbage that jumps to your code.&lt;br /&gt;
&lt;br /&gt;
This gives very early ARM9 code execution (pre-ARM9 kernel). As such, it is possible to dump RSA keyslots with this and calculate the 6.x [[Savegames#6.0.0-11_Savegame_keyY|save]], and 7.x [[NCCH]] keys. This cannot be used to recover keys initialized by arm9loader itself. This is due to it wiping the area used for its stack during NAND sector decryption and keyslot init. &lt;br /&gt;
&lt;br /&gt;
Due to FIRMs on both Old and New 3DS using the same RSA data, this can be exploited on Old3DS as well, but only if one already has the actual plaintext normalkey from New3DS NAND sector 0x96 offset-0 and has dumped the OTP area of the Old3DS.&lt;br /&gt;
| Recovery of 6.x [[Savegames#6.0.0-11_Savegame_keyY|save key]]/7.x [[NCCH]] key, access to uncleared OTP hash keydata&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared New3DS keyslot 0x11&lt;br /&gt;
| Originally the New3DS [[FIRM]] arm9bin loader only cleared keyslot 0x11 when it gets executed at firmlaunch. This was fixed with [[9.5.0-22|9.5.0-X]] by completely clearing keyslot 0x11 immediately after the loader finishes using keyslot 0x11.&lt;br /&gt;
This means that any ARM9 code that can execute before the loader clears the keyslot at firmlaunch(including firmlaunch-hax) can get access to the uncleared keyslot 0x11, which then allows one to generate all &amp;lt;=v9.5 New3DS keyXs which are generated by keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Therefore, to completely fix this the loader would have to generate more keys using different keyslot 0x11 keydata. This was done with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| New3DS keyXs generation&lt;br /&gt;
| Mostly fixed with [[9.5.0-22|9.5.0-X]], completely fixed with new keys with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| &lt;br /&gt;
| February 3, 2015 (one day after [[9.5.0-22|9.5.0-X]] release)&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Process9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-scrambler key&lt;br /&gt;
| New 3DS firmware versions [[8.1.0-0 New3DS|8.1.0]] through [[9.2.0-20|9.2.0]] set the encryption key for [[Amiibo]] data using a hardcoded normal-key in Process9.  In firmware [[9.3.0-21|9.3.0]], Nintendo &amp;quot;fixed&amp;quot; this by using the key scrambler instead, by calculating the keyY value for keyslot 0x39 that results in the same normal-key, then hardcoding that keyY into Process9.&lt;br /&gt;
&lt;br /&gt;
Nintendo&#039;s fix is actually the problem: Nintendo revealed the normal-key matching an unknown keyX and a known keyY.  Combined with the key scrambler using an insecure scrambling algorithm (see &amp;quot;Hardware&amp;quot; above), the key scrambler function could be deduced.&lt;br /&gt;
| Deducing the keyX for keyslot 0x39 and the key scrambler algorithm&lt;br /&gt;
| New 3DS [[9.3.0-21|9.3.0-X]], sort of&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| Sometime in 2015 after the hardware key-generator was broken.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-generator key&lt;br /&gt;
| During the 3DS&#039; development (June/July 2010) Nintendo added support installing encrypted content ([[CIA]]). Common-key index1 was intended to be a [[AES|hardware generated key]]. However while they added code to generate the key in hardware, they forgot to remove the normal-key for index1 (used elsewhere, likely old debug code). Nintendo later removed the normal key sometime before the first non-prototype firmware release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing the keyY and the normal-key for common-key index1, the devkit key-generator algorithm can be deduced (see &amp;quot;Hardware&amp;quot; above). Additionally the remaining devkit common-keys can be generated once the common-key keyX is recovered.&lt;br /&gt;
&lt;br /&gt;
Note the devkit key-generator was discovered to be the same as the retail key-generator.&lt;br /&gt;
| Deducing the keyX for keyslot 0x3D and hardware key-generator algorithm. Generate remaining devkit common-keys.&lt;br /&gt;
| pre-[[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| Shortly after the key-generator was revealed to be flawed at the 32c3 3ds talk&lt;br /&gt;
| January 20, 2016&lt;br /&gt;
| [[User:Jakcron|jakcron]]&lt;br /&gt;
|-&lt;br /&gt;
| ntrcardhax&lt;br /&gt;
| &lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| 10.4.0-29&lt;br /&gt;
| &lt;br /&gt;
| March 2015&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Title downgrading via [[Application_Manager_Services|AM]]([[Application_Manager_Services_PXI|PXI]])&lt;br /&gt;
| When a title is *already* installed, Process9 will compare the installed title-version with the title-version being installed. When the one being installed is older, Process9 would return an error.&lt;br /&gt;
&lt;br /&gt;
However, this can be bypassed by just deleting the title first via the service command(s) for that: with the title removed from the [[Title_Database]], Process9 can&#039;t compare the input title-version with anything. Hence, titles can be downgraded this way.&lt;br /&gt;
&lt;br /&gt;
[[11.0.0-33|11.0.0-X]] fixed this for key system titles (MSET, Home Menu, spider, ErrDisp, SKATER, NATIVE_FIRM, and every retail system module), by checking the version of the title to install against a hard-coded list of (titleID, minimumVersionRequired) pairs.&lt;br /&gt;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], for key system titles.&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| FAT FS code null-deref&lt;br /&gt;
| When FSFile:Read is used with a file which is corrupted on a FAT filesystem(in particular SD), Process9 can crash. This particular crash is caused by a function returning NULL instead of an actual ptr due to an error. The caller of that function doesn&#039;t check for NULL which then triggers a read based at NULL.&lt;br /&gt;
&lt;br /&gt;
Sample &amp;quot;fsck.vfat -n -v -V &amp;lt;fat image backup&amp;gt;&amp;quot; output for the above crash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;...&lt;br /&gt;
Starting check/repair pass.&lt;br /&gt;
&amp;lt;FilePath0&amp;gt; and&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 share clusters.&lt;br /&gt;
 Truncating second to 3375104 bytes.&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 File size is 2787392 bytes, cluster chain length is 16384 bytes.&lt;br /&gt;
 Truncating file to 16384 bytes.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Reclaimed 1 unused cluster (16384 bytes).&lt;br /&gt;
Checking free cluster summary.&lt;br /&gt;
Free cluster summary wrong (1404490 vs. really 1404491)&lt;br /&gt;
 Auto-correcting.&lt;br /&gt;
Starting verification pass.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Leaving filesystem unchanged.&amp;lt;/pre&amp;gt;&lt;br /&gt;
| Useless null-based-read&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| July 8-9, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| RSA signature padding checks&lt;br /&gt;
| The TWL_FIRM RSA sig padding check code used for all TWL RSA sig-checks has issues, see [[FIRM|here]].&lt;br /&gt;
The main 3DS RSA padding check code(non-certificate, including NATIVE_FIRM) uses the function used with the above to extract more padding + the actual hash from the additional padding. This isn&#039;t really a problem here because there&#039;s proper padding check code which is executed prior to this.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ValidateDSiWareSectionMAC]] [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| When the input DSiWare section index is higher than &amp;lt;max number of DSiWare sections supported by this FIRM&amp;gt;, Process9 uses keyid 0x40 for calculating the AESMAC, which translates to keyslot 0x40. The result is that the keyslot is left at whatever was already selected before, since the AES selectkeyslot code will immediately  return when keyslot is &amp;gt;=0x40. However, actually exploiting this is difficult: the calculated AESMAC is never returned, this command just compares the calculated AESMAC with the input AESMAC(result-code depends on whether the AESMACs match). It&#039;s unknown whether a timing attack would work with this.&lt;br /&gt;
This is basically a different form of the pxips9 keyslot vuln, except with AESMAC etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March 15, 2015&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| pxips9 [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| This requires access to the [[Process_Services|ps:ps]]/pxi:ps9 services. One way to get access to this would be snshax on system-version &amp;lt;=10.1.0-X(see 32c3 3ds talk).&lt;br /&gt;
When an invalid key-type value is passed to any of the PS commands, Process9 will try to select keyslot 0x40. That aesengine_setkeyslot() code will then immediately return due to the invalid keyslot value. Since that function doesn&#039;t return any errors, Process9 will just continue to do crypto with whatever AES keyslot was selected before the PS command was sent.&lt;br /&gt;
| Reusing the previously used keyslot, for crypto with PS.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Roughly the same time(same day?) as firmlaunch-hax.&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| firmlaunch-hax: FIRM header ToCToU&lt;br /&gt;
| This can&#039;t be exploited from ARM11 userland.&lt;br /&gt;
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn&#039;t expect &amp;quot;anything&amp;quot; besides the ARM9 to access this data.&lt;br /&gt;
With [[9.5.0-22]] the address of this FIRM header was changed from a FCRAM address, to ARM9-only address 0x01fffc00.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| &lt;br /&gt;
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Uninitialized data output for (PXI) command replies&lt;br /&gt;
| PXI commands for various services(including some [[Filesystem_services_PXI|here]] and many others) can write uninitialized data (like from ARM registers) to the command reply. This happens with stubbed commands, but this can also occur with certain commands when returning an error.&lt;br /&gt;
Certain ARM11 service commands have this same issue as well.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions&lt;br /&gt;
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.&lt;br /&gt;
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ExportDSiWare]] export path&lt;br /&gt;
| Process9 allocates memory on Process9 heap for the export path then verifies that the actual allocated size matches the input size. Then Process9 copies the input path from FCRAM to this buffer, and uses it with the Process9 FS openfile code, which use paths in the form of &amp;quot;&amp;lt;mountpoint&amp;gt;:/&amp;lt;path&amp;gt;&amp;quot;.&lt;br /&gt;
Process9 does not check the contents of this path at all before passing it to the FS code, besides writing a NUL-terminator to the end of the buffer.&lt;br /&gt;
| Exporting of DSiWare to arbitrary Process9 file-paths, such as &amp;quot;nand:/&amp;lt;path&amp;gt;&amp;quot; etc. This isn&#039;t really useful since the data which gets written can&#039;t be controlled.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DSiWare_Exports]] [[CTCert]] verification&lt;br /&gt;
| Just like DSi originally did, 3DS verifies the APCert for DSiWare on SD with the CTCert also in the DSiWare .bin. On DSi this was fixed with with system-version 1.4.2 by verifying with the actual console-unique cert instead(stored in NAND), while on 3DS it&#039;s still not(?) fixed.&lt;br /&gt;
On 3DS however this is rather useless, due to the entire DSiWare .bin being encrypted with the console-unique movable.sed keyY.&lt;br /&gt;
| When the movable.sed keyY for the target 3DS is known and the target 3DS CTCert private-key is unknown, importing of modified DSiWare SD .bin files.&lt;br /&gt;
| Unknown, probably none.&lt;br /&gt;
| ?&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Gamecard_Services_PXI]] unchecked REG_CTRCARDCNT transfer-size&lt;br /&gt;
| The u8 REG_CTRCARDCNT transfer-size parameter for the [[Gamecard_Services_PXI]] read/write CTRCARD commands is used as an index for an array of u16 values. Before [[5.0.0-11|5.0.0-X]] this u8 value wasn&#039;t checked, thus out-of-bounds reads could be triggered(which is rather useless in this case).&lt;br /&gt;
| Out-of-bounds read for a value which gets written to a register.&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] cmdbuf buffer overrun&lt;br /&gt;
| The Process9 code responsible [[PXI_Registers|PXI]] communications didn&#039;t verify the size of the incoming command before writing it to a C++ member variable. &lt;br /&gt;
| Probably ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015, original timeframe if any unknown&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]/[[User:Yellows8|Yellows8]]/maybe others(?)&lt;br /&gt;
|-&lt;br /&gt;
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])&lt;br /&gt;
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be &amp;lt;=0x2800.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Process_Services_PXI|PS RSA]] commands buffer overflows&lt;br /&gt;
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9&#039;s .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads&#039; stacks. SignRsaSha256 also has a buf overflow, but this isn&#039;t exploitable.&lt;br /&gt;
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] pxi_id bad check&lt;br /&gt;
| The Process9 code responsible for [[PXI_Registers|PXI]] communications read pxi_id as a signed char. There were two flaws:&lt;br /&gt;
* They used it as index to a lookup-table without checking the value at all.&lt;br /&gt;
* Another function verified that pxi_id &amp;lt; 7, allowing negative values to pass the check. This would also cause an out-of-range table-lookup.&lt;br /&gt;
| Maybe ARM9 code execution&lt;br /&gt;
| [[3.0.0-5|3.0.0-5]]&lt;br /&gt;
|&lt;br /&gt;
| March 2015, originally 2012 for the first issue at least&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]], maybe others(?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Kernel9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit1 not set by Kernel9&lt;br /&gt;
| Old versions of Kernel9 never set bit1 of [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]]. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!). Since it&#039;s never locked, you can dump it once you get ARM9 code execution.&lt;br /&gt;
&lt;br /&gt;
From [[3.0.0-5|3.0.0-X]] this was fixed by setting the bit in Kernel9 after poking some registers in that region. On New3DS arm9loader sets this bit instead of Kernel9, which is exploitable through a hardware + software vulnerability (see arm9loaderhax / description).&lt;br /&gt;
&lt;br /&gt;
This flaw resurged when it gained a new practical use: retrieving the OTP data for a New3DS console in order to decrypt the key data used in arm9loader (see enhanced-arm9loaderhax / description). This was performed by downgrading to a vulnerable system version. By accounting for differences in CTR-NAND crypto (0x05 -&amp;gt; 0x04, see partition encryption types [[Flash_Filesystem#NAND_structure|here]]), it is possible to boot a New3DS using Old3DS firmware 1.0-2.X and an Old3DS [[NCSD#NCSD_header|NCSD Header]] to retrieve the required OTP data using this flaw.&lt;br /&gt;
| Dumping of the [[OTP Registers|OTP]] area&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Plutooo|plutoo]], Normmatt independently&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM11 software ==&lt;br /&gt;
=== Kernel11 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC]] table too small&lt;br /&gt;
|  The table of function pointers for SVC&#039;s only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.&lt;br /&gt;
&lt;br /&gt;
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn&#039;t mapped as executable.&lt;br /&gt;
| &lt;br /&gt;
|  None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC|svcBackdoor (0x7B)]]&lt;br /&gt;
|  This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11 (with NATIVE_FIRM) required patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]] (deleted)&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| veryslowpidhax&lt;br /&gt;
| &#039;&#039;&#039;This is completely different from the kernelmode-code-execution vuln described in the below separate entry.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When updating the kernel global PID counter under [[SVC|svcCreateProcess]] the kernel does not check for wraparound to 0x0(the PID for the very first process). This only matters because [[Services|SM-module]] allows processes with PID value less than &amp;lt;total ARM11 FIRM modules&amp;gt; to access &#039;&#039;all&#039;&#039; services, without checking exheader service-access-control; and because Kernel11 checks for the PID to be 1 (loader) to use the input mem-region value on ControlMemory. This alone does not affect access the [[SVC|SVCs]] access table at all.&lt;br /&gt;
&lt;br /&gt;
Inlined ldrex+strex code is used for updating the above counter. [[11.2.0-35|11.2.0-X]] had changes for similar code, but it was only for dedicated ldrex+strex functions(mainly for kernel objects) and hence this PID code was not affected.&lt;br /&gt;
&lt;br /&gt;
With launching+terminating a sysmodule repeatedly with this via ns:s, it would take weeks to finish(if not at least about a month?).&lt;br /&gt;
| Access to all [[Services_API|services]], ControlMemory on any given mem-region.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2012 maybe?&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|  slowhax/waithax&lt;br /&gt;
|  svcWaitSynchronizationN does not decrement the references to valid handles in an array before returning an error when it encounters an invalid handle. This allows one to (slowly) overflow the reference count for a handle object to zero.&lt;br /&gt;
| ARM11 kernel-mode code execution&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2016&lt;br /&gt;
| nedwill, [[User:Derrek|derrek]], others?&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2.1&lt;br /&gt;
| Nintendo&#039;s fix for memchunkhax2 in [[10.4.0-29|10.4.0-X]] did not fix the GPU case: one may cause the requisite ToCToU race using gspwn, bypassing the new validation.&lt;br /&gt;
derrek&#039;s original 32c3 presentation for memchunkhax2 commented that a GPU-based attack was possible, but would be difficult.  However, memchunkhax2.1 showed that it was possible to do fairly reliably.&lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]], aliaspider&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2&lt;br /&gt;
| When allocating a block of memory, the &amp;quot;next&amp;quot; pointer of the [[Memory_Management#MemoryBlockHeader|memchunkhdr]] is accessed without being checked after being mapped to userland.&lt;br /&gt;
This allows a race condition, where the process can change the next pointer just before it&#039;s accessed. By pointing the next pointer to a crafted memchunckhdr in the kernel SlabHeap, some of the SlabHeap is allocated to the calling process, allowing to change vtables of kernel objects. &lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]] (partially, see memchunkhax2.1)&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| heaphax&lt;br /&gt;
| Can change the size of free memchunk structures stored in FCRAM using DMA, which leads to the ability to allocate memory chunks over already-allocated memory. This can be used in the SYSTEM region to allocate RW memory over any part of the NS system module, which is enough to take it over.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading) Code execution within any applet.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
| snshax&lt;br /&gt;
| Can force creation of Safe NS process into gspwn-able memory, allowing for takeover.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading)&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
|  AffinityMask/processorid validation&lt;br /&gt;
|  With [[10.0.0-27|10.0.0-X]] the following functions were updated: svcGetThreadAffinityMask, svcGetProcessAffinityMask, svcSetProcessAffinityMask, and svcCreateThread. The code changes for all but svcCreateThread are identical.&lt;br /&gt;
The original code with the first 3 did the following: &lt;br /&gt;
* if(u32_processorcount &amp;gt; ~0x80000001)return 0xe0e01bfd;&lt;br /&gt;
* if(s32_processorcount &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
The following code replaced the above:&lt;br /&gt;
* if(u32_processorcount &amp;gt;= &amp;lt;total_cores+1&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
In theory the latter should catch everything that the former did, so it&#039;s unknown if this was really a security issue.&lt;br /&gt;
&lt;br /&gt;
The svcCreateThread changes with [[10.0.0-27|10.0.0-X]] definitely did fix a security issue.&lt;br /&gt;
* Original code: &amp;quot;if(s32_processorid &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
* New code: &amp;quot;if(s32_processorid &amp;gt;= &amp;lt;total_cores&amp;gt; || s32_processorid &amp;lt;= -4)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
This fixed an off-by-one issue: if one would use processorid=total_cores, which isn&#039;t actually a valid value, svcCreateThread would accept that value on &amp;lt;[[10.0.0-27|10.0.0-X]]. This results in data being written out-of-bounds(baseaddr = arrayaddr + entrysize*processorid), which has the following result:&lt;br /&gt;
* Old3DS: Useless kernel-mode crash due to accessing unmapped memory.&lt;br /&gt;
* New3DS: uncontrolled data write into a kernel-mode L1 MMU-table. This isn&#039;t really useful: the data can&#039;t be controlled, and the data which gets overwritten is all-zero anyway(this isn&#039;t anywhere near MMU L1 entries for actually mapped memory).&lt;br /&gt;
The previous version also allowed large negative s32_processorid values(negative processorid values are special values not actual procids), but it appears using values like that won&#039;t actually do anything(meaning no crash) besides the thread not running / thread not running for a while(besides triggering a kernelpanic with certain s32_processorid value(s)).&lt;br /&gt;
| Nothing useful&lt;br /&gt;
|  [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| svcCreateThread issue: May 31, 2015. The rest: September 8, 2015, via v9.6-&amp;gt;v10.0 ARM11-kernel code-diff.&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax&lt;br /&gt;
| The kernel originally did not validate the data stored in the FCRAM kernel heap [[Memchunkhdr|memchunk-headers]] for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.&lt;br /&gt;
&lt;br /&gt;
There are &#039;&#039;multiple&#039;&#039; ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.&lt;br /&gt;
| When combined with other flaws: ARM11-kernelmode code execution&lt;br /&gt;
| [[9.3.0-21|9.3.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| February 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Multiple [[KLinkedListNode|KLinkedListNode]] SlabHeap use after free bugs&lt;br /&gt;
| The ARM11-kernel did access the &#039;key&#039; field of [[KLinkedListNode|KLinkedListNode]] objects, which are located on the SlabHeap, after freeing them. Thus, triggering an allocation of a new [[KLinkedListNode|KLinkedListNode]] object at the right time could result in a type-confusion. Pseudo-code:&lt;br /&gt;
SlabHeap_free(KLinkedListNode);&lt;br /&gt;
KObject *obj = KLinkedListNode-&amp;gt;key;  // the object there might have changed!&lt;br /&gt;
This bug appeared all over the place.&lt;br /&gt;
| ARM11-kernelmode code exec maybe&lt;br /&gt;
| [[8.0.0-18|8.0.0-18]]&lt;br /&gt;
| &lt;br /&gt;
| April 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11-kernel didn&#039;t check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.&lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11|6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcStartInterProcessDma]]&lt;br /&gt;
| For svcStartInterProcessDma, the kernel code had the following flaws:&lt;br /&gt;
&lt;br /&gt;
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.&lt;br /&gt;
&lt;br /&gt;
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address &amp;gt;=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr-&amp;gt;physaddr conversion). &lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| DmaConfig issue: unknown. The rest: 2014&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] independently&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] Parameter checks&lt;br /&gt;
| For svcControlMemory the parameter check had these two flaws:&lt;br /&gt;
&lt;br /&gt;
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn&#039;t actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn&#039;t actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows on (addr0+size) are now checked that previously weren&#039;t (this also applies to most other address checks elsewhere in the kernel).&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] request/response buffer overflow&lt;br /&gt;
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.&lt;br /&gt;
&lt;br /&gt;
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of &amp;lt;nowiki&amp;gt;((size&amp;lt;&amp;lt;14) | 2)&amp;lt;/nowiki&amp;gt; to write arbitrary memory to any RW userland memory in the destination process.&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|SVC stack allocation overflows]]&lt;br /&gt;
| &lt;br /&gt;
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. &lt;br /&gt;
* The alignment (size+7)&amp;amp;~7 calculation before allocation was not checked for integer overflow.&lt;br /&gt;
&lt;br /&gt;
This might allow for ARM11 kernel code-execution.&lt;br /&gt;
&lt;br /&gt;
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] complementary&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions&lt;br /&gt;
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn&#039;t check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.1.0-8]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11 kernel didn&#039;t check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don&#039;t have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions&lt;br /&gt;
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== [[FIRM]] Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Services|&amp;quot;srv:pm&amp;quot;]] process registration&lt;br /&gt;
| Originally any process had access to the port &amp;quot;srv:pm&amp;quot;. The PID&#039;s used for the (un)registration commands are not checked either. This allowed any process to re-register itself with &amp;quot;srv:pm&amp;quot;, and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] &amp;quot;srv:pm&amp;quot; is now a service instead of a globally accessible port. Only processes with PID&#039;s less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for &amp;quot;srv:pm&amp;quot; open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.&lt;br /&gt;
&lt;br /&gt;
This flaw was needed for exploiting the &amp;lt;=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don&#039;t have access to those service(s).&lt;br /&gt;
| Access to arbitrary services&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| FSDIR null-deref&lt;br /&gt;
| [[Filesystem_services|FS]]-module may crash in some cases when handling directory reading. The trigger seems to be due to using [[FSDir:Close]] without closing the dir-handle afterwards?(Perhaps this is caused by out-of-memory?) This seems to be useless since it&#039;s just a null-deref.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| May 19(?)-20, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in system-module system-version&lt;br /&gt;
!  Last system-module system-version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Timeframe this was added to wiki&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| AM stack/.bss infoleak via [[AM:ReadTwlBackupInfo]]([[AM:ReadTwlBackupInfoEx|Ex]])&lt;br /&gt;
| After writing the output-info structure to stack, it then copies that structure to the output buffer ptr using the size from the command. The size is not checked. This could be used to read data from the AM-service-thread stack handling the command + .bss.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This was not tested on hardware.&#039;&#039;&#039;&lt;br /&gt;
| Stack/.bss reading&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27]](AM v9217)&lt;br /&gt;
| Roughly October 17, 2016&lt;br /&gt;
| October 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MVD_Services|MVD]]: Stack buffer overflow with [[MVDSTD:SetupOutputBuffers]].&lt;br /&gt;
| The input total_entries is not validated when initially processing the input entry-list. This fixed-size input entry-list is copied to stack from the command request. The loop for processing this initializes a global table, the converted linearmem-&amp;gt;physaddrs used there are also copied to stack(0x8-bytes of physaddrs per entry).&lt;br /&gt;
&lt;br /&gt;
If total_entries is too large, MVD-sysmodule will crash due to reading unmapped memory following the stack(0x10000000). Afterwards if the out-of-bounds total_entries is smaller than that, it will crash due accessing address 0x0, hence this useless.&lt;br /&gt;
| MVD-sysmodule crash.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| April 22, 2016 (Tested on the 25th)&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]]: Using CTRSDK heap with UDS sharedmem from the user-process.&lt;br /&gt;
| See the HTTP-sysmodule section below.&lt;br /&gt;
&lt;br /&gt;
CTRSDK heap is used with the sharedmem from [[NWMUDS:InitializeWithVersion]]. Buffers are allocated/freed under this heap using [[NWMUDS:Bind]] and [[NWMUDS:Unbind]].&lt;br /&gt;
&lt;br /&gt;
Hence, overwriting sharedmem with gspwn then using [[NWMUDS:Unbind]] results in the usual controlled CTRSDK memchunk-header write, similar to HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This could be done by creating an UDS network, without any other nodes on the network.&lt;br /&gt;
&lt;br /&gt;
Besides CTRSDK memchunk-headers, there are no addresses stored under this sharedmem.&lt;br /&gt;
| ROP under NWM-module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20|9.0.0-X]]&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| April 16, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds memory access during spectator [[Download_Play|data-frame]] checksum calculation&lt;br /&gt;
| DLP doesn&#039;t validate the frame_size when receiving spectator data-frames at all, unlike non-spectator data-frames. The actual spectator data-frame parsing code doesn&#039;t use that field either. However, the data-frame checksum calculation code called during checksum verification does use the frame_size for loading the size of the framebuf.&lt;br /&gt;
&lt;br /&gt;
Hence, using a large frame_size like 0xFFFF will result in the checksum calculation code reading data out-of-bounds. This isn&#039;t really useful, you could trigger a remote local-WLAN DLP-sysmodule crash while a 3DS system is scanning for DLP networks(due to accessing unmapped memory), but that&#039;s about all(trying to infoleak with this likely isn&#039;t useful either).&lt;br /&gt;
| DLP-sysmodule crash, handled by dlplay system-application by a &amp;quot;connection interrupted&amp;quot; error eventually then a fatal-error via ErrDisp.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8, 2016 (Tested on the 10th)&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds output data writing during spectator sysupdate titlelist [[Download_Play|data-frame]] handling&lt;br /&gt;
| The total_entries and out_entryindex fields for the titlelist DLP spectator data-frames are not validated. This is parsed during DLP network scanning. Hence, the specified titlelist data can be written out-of-bounds using the specified out_entryindex and total_entries. A crash will occur while reading the input data-frame titlelist if total_entries is larger than 0x27A, due to accessing unmapped memory.&lt;br /&gt;
&lt;br /&gt;
There&#039;s not much non-zero data to overwrite following the output buffer(located in sharedmem), any ptrs are located in sharedmem. Overwriting certain ptr(s) are only known to cause a crash when attempting to use the DLP-client shutdown service-command.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to exploit the above crash, since the linked-list code involves writes zeros(with a controlled start ptr).&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8-9, 2016&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[IR_Services|IR]]: Stack buffer overflow with custom hardware&lt;br /&gt;
| Originally IR sysmodule used the read value from the I2C-IR registers TXLVL and RXLVL without validating them at all. See [[10.6.0-31|here]] for the fix. This is the size used for reading the data-recv FIFO, etc. The output buffer for reading is located on the stack.&lt;br /&gt;
&lt;br /&gt;
This should be exploitable if one could successfully setup the custom hardware for this and if the entire intended sizes actually get read from I2C.&lt;br /&gt;
| ROP under IR sysmodule.&lt;br /&gt;
| [[10.6.0-31|10.6.0-31]]&lt;br /&gt;
| &lt;br /&gt;
| February 23, 2016 (Unknown if it was noticed before then)&lt;br /&gt;
| February 23, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HTTP_Services|HTTP]]: Using CTRSDK heap with sharedmem from the user-process.&lt;br /&gt;
| The data from httpcAddPostDataAscii and other commands is stored under a CTRSDK heap. That heap is the sharedmem specified by the user-process via the HTTPC Initialize command.&lt;br /&gt;
Normally this sharedmem isn&#039;t accessible to the user-process once the sysmodule maps it, hence using it is supposed to be &amp;quot;safe&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This isn&#039;t the case due to gspwn however. Since CTRSDK heap code is so insecure in general, one can use gspwn to locate the HTTPC sharedmem + read/write it, then trigger a mem-write under the sysmodule. This can then be used to get ROP going under HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This is exploited by [https://github.com/yellows8/ctr-httpwn/ctr-httpwn ctr-httpwn].&lt;br /&gt;
| ROP under HTTP sysmdule.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] (Latest sysmodule version as of [[10.7.0-32|10.7.0-32]])&lt;br /&gt;
| Late 2015&lt;br /&gt;
| March 22, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NIM_Services|NIM]]: Downloading old title-versions from eShop&lt;br /&gt;
| Multiple NIM service commands(such as [[NIMS:StartDownload]]) use a title-version value specified by the user-process, NIM does not validate that this input version matches the latest version available via SOAP. Therefore, when combined with AM(PXI) [[#Process9|title-downgrading]] via deleting the target eShop title with System Settings Data Management(if the title was already installed), this allows downloading+installing any title-version from eShop &#039;&#039;if&#039;&#039; it&#039;s still available from CDN.&lt;br /&gt;
The easiest way to exploit this is to just patch the eShop system-application code using these NIM commands(ideally the code which loads the title-version).&lt;br /&gt;
&lt;br /&gt;
Originally this was tested with a debugging-system via modded-FIRM, eventually smea implemented it in HANS for the 32c3 release.&lt;br /&gt;
| Downloading old title-versions from eShop&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| October 24, 2015 (Unknown when exactly the first eShop title downgrade was actually tested, maybe November)&lt;br /&gt;
| January 7, 2016 (Same day Ironfall v1.0 was removed from CDN via the main-CXI files)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SPI_Services|SPI]] service out-of-bounds write&lt;br /&gt;
| cmd1 has out-of-bounds write allowing overwrite of some static variables in .data.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NFC_Services|NFC]] module service command buf-overflows&lt;br /&gt;
| NFC module copies data with certain commands, from command input buffers to stack without checking the size. These commands include the following, it&#039;s unknown if there&#039;s more commands with similar issues: &amp;quot;nfc:dev&amp;quot; &amp;lt;0x000C....&amp;gt; and &amp;quot;nfc:s&amp;quot; &amp;lt;0x0037....&amp;gt;.&lt;br /&gt;
Since both of these commands are stubbed in the Old3DS NFC module from the very first version(those just return an error), these issues only affect the New3DS NFC module.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known retail titles which have access to either of these services.&lt;br /&gt;
| ROP under NFC module.&lt;br /&gt;
| New3DS: None&lt;br /&gt;
| New3DS: [[9.5.0-22]]&lt;br /&gt;
| December 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[News_Services|NEWSS]] service command notificationID validation failure&lt;br /&gt;
| This module does not validate the input notificationID for &amp;lt;nowiki&amp;gt;&amp;quot;news:s&amp;quot;&amp;lt;/nowiki&amp;gt; service commands. This is an out-of-bounds array index bug. For example, [[NEWSS:SetNotificationHeader]] could be used to exploit news module: this copies the input data(size is properly checked) to: out = newsdb_savedata+0x10 + (someu32array[notificationID]*0x70).&lt;br /&gt;
| ROP under news module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.7.0-25|9.7.0-X]]&lt;br /&gt;
| December 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData]] heap buffer overflow&lt;br /&gt;
| input_size = 0x1E * &amp;lt;value the u8 from input_[[NWM_Services|networkstruct]]+0x1D&amp;gt;. Then input_tag0 is copied to a heap buffer. When input_size is larger than 0xFA-bytes, it will then copy input_tag1 to &amp;lt;end_address_of_previous_outbuf&amp;gt;, with size=input_size-0xFA.&lt;br /&gt;
&lt;br /&gt;
This can be triggered by either using this command directly, or by boadcasting a wifi beacon which triggers it while a 3DS system running the target process is in range, when the process is scanning for hosts to connect to. Processes will only pass tag data to this command when the wlancommID and other thing(s) match the values for the process.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to actually exploit this for getting ROP under NWM-module, at the time of originally adding this to the wiki. This is because the data which gets copied out-of-bounds *and* actually causes crash(es), can&#039;t be controlled it seems(with just broadcasting a beacon at least). It&#039;s unknown whether this could be exploited from just using NWMUDS service-cmd(s) directly.&lt;br /&gt;
| Without any actual way to exploit this: NWM-module DoS, resulting in process termination(process crash). This breaks *everything* involving wifi comms, a reboot is required to recover from this.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| ~September 23, 2014(see the [[NWMUDS:DecryptBeaconData]] page history)&lt;br /&gt;
| August 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HID_Services|HID]] module shared-mem&lt;br /&gt;
| HID module does not validate the index values in [[HID_Shared_Memory|sharedmem]](just changes index to 0 when index == maxval when updating), therefore large values will result in HID module writing HID data to arbitrary addresses.&lt;br /&gt;
| ROP under HID module, but this is *very* unlikely to be exploitable since the data written is HID data.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| gspwn&lt;br /&gt;
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you&#039;re running under, and gain real code-execution from a ROP-chain. Normally applets&#039; .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).&lt;br /&gt;
&lt;br /&gt;
FCRAM is gpu-accessible up to physaddr 0x26800000 on Old3DS, and 0x2DC00000 on New3DS. This is BASE_memregion_start(aka SYSTEM_memregion_end)-0x400000 with the default memory-layout on Old3DS/New3DS.&lt;br /&gt;
| User-mode code execution.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| Early 2014&lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Yellows8|Yellows8]]/others before then&lt;br /&gt;
|-&lt;br /&gt;
| rohax&lt;br /&gt;
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.&lt;br /&gt;
&lt;br /&gt;
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.&lt;br /&gt;
| Memory-mapping syscalls.&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| [[9.4.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Plutooo|plutoo]] joint effort&lt;br /&gt;
|-&lt;br /&gt;
| Region free&lt;br /&gt;
| Only [[Home Menu]] itself checks gamecards&#039; region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.&lt;br /&gt;
This essentially means launching the gamecard with the [[NS_and_APT_Services|&amp;quot;ns:s&amp;quot;]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].&lt;br /&gt;
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation&lt;br /&gt;
| None&lt;br /&gt;
| Last tested with [[10.1.0-27|10.1.0-X]].&lt;br /&gt;
| June(?) 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]] service-cmd state null-ptr deref&lt;br /&gt;
| The NWMUDS service command code loads a ptr from .data, adds an offset to that, then passes that as the state address for the actual command-handler function. The value of the ptr loaded from .data is not checked, therefore this will cause crashes due to that being 0x0 when NWMUDS was not properly initialized.&lt;br /&gt;
It&#039;s unknown whether any NWM services besides NWMUDS have this issue.&lt;br /&gt;
| This is rather useless since it&#039;s only a crash caused by a state ptr based at 0x0.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== General/CTRSDK ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|UDS]] beacon additional-data buffer overflow&lt;br /&gt;
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.&lt;br /&gt;
This was discovered while doing code RE with an old dlp-module version. It&#039;s unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown if there&#039;s any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can&#039;t be exploited with this).&lt;br /&gt;
&lt;br /&gt;
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.&lt;br /&gt;
| Perhaps ROP, very difficult if possible with anything at all&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| September(?) 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| CTPK buffer overflow&lt;br /&gt;
| At offset 0x20 in CTPK is an array for each texture, each entry is 0x20-bytes. This contains a wordindex(entry+0x18) for some srcdata relative to CTPK+0, and an u8 wordsize(entry+0x14) for this data. The CTRSDK function handling this doesn&#039;t validate the size, when copying srcdata using this size to the output buffer. Applications usually have the output buffer on the stack, hence stack buffer overflow.&lt;br /&gt;
&lt;br /&gt;
While CTPK(*.ctpk) are normally only loaded from RomFS, some application(s) load from elsewhere too.&lt;br /&gt;
| ROP under the target application.&lt;br /&gt;
| None?&lt;br /&gt;
| &amp;quot;[SDK+NINTENDO:CTR_SDK-11_4_0_200_none]&amp;quot;&lt;br /&gt;
| November 14, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=18500</id>
		<title>3DS System Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=18500"/>
		<updated>2016-10-26T19:30:03Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Kernel11 */ Fix duplicated entry.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of publicly known system flaws, for userland applications/applets flaws see [[3DS_Userland_Flaws|here]].&lt;br /&gt;
&lt;br /&gt;
=Stale / Rejected Efforts=&lt;br /&gt;
* Neimod has been working on a RAM dumping setup for a little while now. He&#039;s de-soldered the 3DS&#039;s RAM chip and hooked it and the RAM pinouts on the 3DS&#039; PCB up to a custom RAM dumping setup. A while ago he published photos showing his setup to be working quite well, with the 3DS successfully booting up. However, his flickr stream is now private along with most of his work.&lt;br /&gt;
&lt;br /&gt;
* Someone (who will remain unnamed) has released CFW and CIA installers, all of which is copied from the work of others, or copyrighted material.&lt;br /&gt;
&lt;br /&gt;
==Tips and info==&lt;br /&gt;
The 3DS uses the XN feature of the ARM11 processor. There&#039;s no official way from applications to enable executable permission for memory containing arbitrary unsigned code(there&#039;s a [[SVC]] for this, but only [[RO_Services|RO-module]] has access to it). An usable userland exploit would still be useful: you could only do return-oriented-programming with it initially. From ROP one could then exploit system flaw(s), see below.&lt;br /&gt;
&lt;br /&gt;
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped(accessing SD data is far easier by running code on the target 3DS however).&lt;br /&gt;
&lt;br /&gt;
=System flaws=&lt;br /&gt;
== Hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed with hardware model/revision&lt;br /&gt;
!  Newest hardware model/revision this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| ARM9/ARM11 bootrom vectors point at unitialized RAM&lt;br /&gt;
| ARM9&#039;s and ARM11&#039;s exception vectors are hardcoded to point at the CPU&#039;s internal memory (0x08000000 region for ARM9, AXIWRAM for ARM11). While the bootrom does set them up to point to an endless loop at some point during boot, it does not do so immediately. As such, a carefully-timed fault injection (via hardware) to trigger an exception (such as an invalid instruction) will cause execution to fall into ARM9 RAM. &lt;br /&gt;
Since RAM isn&#039;t cleared on boot (see below), one can immediately start execution of their own code here to dump bootrom, OTP, etc.&lt;br /&gt;
The ARM9 bootrom does the following at reset:  reset vector branches to another instruction, then branches to bootrom+0x8000. Hence, there&#039;s no way to know for certain when exactly the ARM9 exception-vector data stored in memory gets initialized.&lt;br /&gt;
&lt;br /&gt;
This requires *very* *precise* timing for triggering the hardware fault: it&#039;s unknown if anyone actually exploited this successfully at the time of writing(the one who attempted+discovered it *originally* as listed in this wiki section hasn&#039;t).&lt;br /&gt;
| None: all available 3DS models at the time of writing have the exact same ARM9/ARM11 bootrom for the unprotected areas.&lt;br /&gt;
| New3DS&lt;br /&gt;
| End of February 2014&lt;br /&gt;
| [[User:Derrek|derrek]], WulfyStylez (May 2015) independently&lt;br /&gt;
|-&lt;br /&gt;
| Missing AES key clearing&lt;br /&gt;
| The hardware AES engine does not clear keys when doing a hard reset/reboot.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| August 2014&lt;br /&gt;
| Mathieulh/Others&lt;br /&gt;
|-&lt;br /&gt;
| No RAM clearing on reboots&lt;br /&gt;
| On an MCU-triggered reboot all RAM including FCRAM/ARM9 memory/AXIWRAM/VRAM keeps its contents.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2014&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| 32bits of actual console-unique TWLNAND keydata&lt;br /&gt;
| On retail the 8-bytes at ARM9 address [[Memory_layout|0x01FFB808]] are XORed with hard-coded data, to generate the TWL console-unique keys, including TWLNAND. On Old3DS the high u32 is always 0x0, while on New3DS that u32 is always 0x2. On top of this, the lower u32&#039;s highest bit is always ORed. only 31 bits of the TWL console-unique keydata / TWL consoleID are actually console-unique.&lt;br /&gt;
This allows one to easily bruteforce the TWL console-unique keydata with *just* data from TWLNAND. On DSi the actual console-unique data for key generation is 8-bytes(all bytes actually set).&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| DSi / 3DS-TWL key-generator&lt;br /&gt;
| After using the key generator to generate the normal-key, you could overwrite parts of the normal-key with your own data and then recover the key-generator output by comparing the new crypto output with the original crypto output. From the normal-key outputs, you could deduce the TWL key-generator function.&lt;br /&gt;
This applies to the keyX/keyY too.&lt;br /&gt;
&lt;br /&gt;
This attack does not work for the 3DS key-generator because keyslots 0-3 are only for TWL keys.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2011&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| 3DS key-generator&lt;br /&gt;
| The algorithm for generating the normal-keys for keyslots is cryptographically weak.  As a result, it is easily susceptible to differential cryptanalysis if the normal-key corresponding to any scrambler-generated keyslot is discovered.&lt;br /&gt;
&lt;br /&gt;
Several such pairs of matching normal-keys and KeyY values were found, leading to deducing the key-generator function.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| FIRM partitions known-plaintext&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are encrypted with AES-CTR without a MAC. Since this works by XOR&#039;ing data with a static (per-console in this case) keystream, one can deduce the keystream of a portion of each FIRM partition if they have the actual FIRM binary stored in it.&lt;br /&gt;
&lt;br /&gt;
This can be paired with many exploits. For example, it allows minor FIRM downgrades (i.e. 10.4 to 9.6 or 9.5 to 9.4, but not 9.6 to 9.5).&lt;br /&gt;
&lt;br /&gt;
This can be somewhat addressed by having a FIRM header skip over previously used section offsets, but this would just air-gap newer FIRMs without fixing the core bug. This can also only be done a limited number of times due to the size of FIRM versus the size of the partitions.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| &lt;br /&gt;
| Everyone&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM9 software ==&lt;br /&gt;
=== arm9loader ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Rearrangable keys in the NAND keystore&lt;br /&gt;
| Due to the keystore being encrypted with AES-ECB, one can rearrange blocks and still have the NAND keystore decrypt in a deterministic way. &lt;br /&gt;
&lt;br /&gt;
Using 10.0 FIRM it is possible to rearrange keys such that ARM9 memory is executed. As such using existing ARM9 execution 10.0 FIRM can be written to NAND and a payload written to memory, with the payload to be executed post-K9L using an MCU reboot.&lt;br /&gt;
| arm9loaderhax given existing ARM9 code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Early 2016&lt;br /&gt;
| 27 September 2016&lt;br /&gt;
| Myria, [[User:Dark samus|dark_samus]]; mathieulh (independently); [[User:Plutooo|plutoo]] (independently) + others&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared OTP hash keydata in console-unique 0x11 key-generation&lt;br /&gt;
| Kernel9Loader does not clear the [[SHA_Registers#SHA_HASH|SHA_HASH register]] after use. As a result, the data stored here as K9L hands over to Kernel9 is the hash of [[OTP_Registers|OTP data]] used to seed the [[FIRM#New_3DS_FIRM|console-unique NAND keystore decryption key]] set on keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Retrieving this keydata and the [[Flash_Filesystem#0x12C00|NAND keystore]] of the same device allows calculating the decrypted New3DS NAND keystore (non-unique, common to all New3DS units), which contains AES normal keys, also set on keyslot 0x11, which are then used to derive all current [[AES_Registers#Keyslots|New3DS-only AES keyXs]] including the newer batch introduced in [[9.6.0-24#arm9loader|9.6.0-X]]. From there, it is trivial to perform the same key derivation in order to initialize those keys on any system version, and even on Old3DS.&lt;br /&gt;
&lt;br /&gt;
This can be performed by exploiting the &amp;quot;arm9loaderhax&amp;quot; vulnerability to obtain post-K9L code execution after an MCU reboot (the bootrom section-loading fail is not relevant here, this attack was performed without OTP data by brute-forcing keys), and using this to dump the SHA_HASH register. This attack works on any FIRM version shipping a vulnerable version of K9L, whereas OTP dumping required a boot of &amp;lt;[[3.0.0-6|3.0.0-X]].&lt;br /&gt;
&lt;br /&gt;
This attack results in obtaining the entire (0x200-bytes) NAND keystore - it was confirmed at a later date that this keystore is encrypted with the same key (by comparing the decrypted data from multiple units), and therefore using another key in this store will not remedy the issue as all keys are known (i.e. later, unused keys decrypt to the same 0x200-bytes constant with the same OTP hash). Later keys could have been encrypted differently but this is not the case. As a result of this, it is not possible for Nintendo to use K9L again in its current format for its intended purpose, though this was not news from the moment people dumped a New3DS OTP.&lt;br /&gt;
| Derivation of all New3DS keys generated via the NAND keystore (0x1B &amp;quot;Secure4&amp;quot; etc.)&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| ~April 2015, implemented in May 2015&lt;br /&gt;
| 13 January 2016&lt;br /&gt;
| [[User:WulfyStylez|WulfyStylez]], [[User:Dazzozo|Dazzozo]], [[User:Shinyquagsire23|shinyquagsire23]] (complimentary + implemented), [[User:Plutooo|plutoo]], Normmatt (discovered independently)&lt;br /&gt;
|-&lt;br /&gt;
| enhanced-arm9loaderhax&lt;br /&gt;
| See the 32c3 3ds talk.&lt;br /&gt;
Since this is a combination of a trick with the arm9-bootrom + arm9loaderhax, and since you have to manually write FIRM to the firm0/firm1 NAND partitions, this can&#039;t be completely fixed. Any system with existing ARM9 code execution and an OTP/OTP hash dump can exploit this. Additionally, by using the FIRM partition known-plaintext bug and bruteforcing the second entry in the keystore, this can currently be exploited on all New3DS systems without any other prerequisite hacks.&lt;br /&gt;
| arm9loaderhax which automatically occurs at hard-boot.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| Theorized around mid July, 2015. Later implemented+tested by [[User:Plutooo|plutoo]] and derrek.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Missing verification-block for the 9.6 keys (arm9loaderhax)&lt;br /&gt;
| Starting with [[9.6.0-24|9.6.0-X]] a new set of NAND-based keys were introduced. However, no verification block was added to verify that the new key read from NAND is correct. This was technically an issue from [[9.5.0-22|9.5.0-X]] with the original sector+0 keydata, however the below is only possible with [[9.6.0-24|9.6.0-X]] since keyslots 0x15 and 0x16 are generated from different 0x11 keyXs.&lt;br /&gt;
&lt;br /&gt;
Writing an incorrect key to NAND will cause arm9loader to decrypt the ARM9 kernel as garbage and then jump to it.&lt;br /&gt;
&lt;br /&gt;
This allows an hardware-based attack where you can boot into an older exploited firmware, fill all memory with NOP sleds/jump-instructions, and then reboot into executing garbage. By automating this process with various input keydata, eventually you&#039;ll find some garbage that jumps to your code.&lt;br /&gt;
&lt;br /&gt;
This gives very early ARM9 code execution (pre-ARM9 kernel). As such, it is possible to dump RSA keyslots with this and calculate the 6.x [[Savegames#6.0.0-11_Savegame_keyY|save]], and 7.x [[NCCH]] keys. This cannot be used to recover keys initialized by arm9loader itself. This is due to it wiping the area used for its stack during NAND sector decryption and keyslot init. &lt;br /&gt;
&lt;br /&gt;
Due to FIRMs on both Old and New 3DS using the same RSA data, this can be exploited on Old3DS as well, but only if one already has the actual plaintext normalkey from New3DS NAND sector 0x96 offset-0 and has dumped the OTP area of the Old3DS.&lt;br /&gt;
| Recovery of 6.x [[Savegames#6.0.0-11_Savegame_keyY|save key]]/7.x [[NCCH]] key, access to uncleared OTP hash keydata&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared New3DS keyslot 0x11&lt;br /&gt;
| Originally the New3DS [[FIRM]] arm9bin loader only cleared keyslot 0x11 when it gets executed at firmlaunch. This was fixed with [[9.5.0-22|9.5.0-X]] by completely clearing keyslot 0x11 immediately after the loader finishes using keyslot 0x11.&lt;br /&gt;
This means that any ARM9 code that can execute before the loader clears the keyslot at firmlaunch(including firmlaunch-hax) can get access to the uncleared keyslot 0x11, which then allows one to generate all &amp;lt;=v9.5 New3DS keyXs which are generated by keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Therefore, to completely fix this the loader would have to generate more keys using different keyslot 0x11 keydata. This was done with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| New3DS keyXs generation&lt;br /&gt;
| Mostly fixed with [[9.5.0-22|9.5.0-X]], completely fixed with new keys with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| &lt;br /&gt;
| February 3, 2015 (one day after [[9.5.0-22|9.5.0-X]] release)&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Process9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-scrambler key&lt;br /&gt;
| New 3DS firmware versions [[8.1.0-0 New3DS|8.1.0]] through [[9.2.0-20|9.2.0]] set the encryption key for [[Amiibo]] data using a hardcoded normal-key in Process9.  In firmware [[9.3.0-21|9.3.0]], Nintendo &amp;quot;fixed&amp;quot; this by using the key scrambler instead, by calculating the keyY value for keyslot 0x39 that results in the same normal-key, then hardcoding that keyY into Process9.&lt;br /&gt;
&lt;br /&gt;
Nintendo&#039;s fix is actually the problem: Nintendo revealed the normal-key matching an unknown keyX and a known keyY.  Combined with the key scrambler using an insecure scrambling algorithm (see &amp;quot;Hardware&amp;quot; above), the key scrambler function could be deduced.&lt;br /&gt;
| Deducing the keyX for keyslot 0x39 and the key scrambler algorithm&lt;br /&gt;
| New 3DS [[9.3.0-21|9.3.0-X]], sort of&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| Sometime in 2015 after the hardware key-generator was broken.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-generator key&lt;br /&gt;
| During the 3DS&#039; development (June/July 2010) Nintendo added support installing encrypted content ([[CIA]]). Common-key index1 was intended to be a [[AES|hardware generated key]]. However while they added code to generate the key in hardware, they forgot to remove the normal-key for index1 (used elsewhere, likely old debug code). Nintendo later removed the normal key sometime before the first non-prototype firmware release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing the keyY and the normal-key for common-key index1, the devkit key-generator algorithm can be deduced (see &amp;quot;Hardware&amp;quot; above). Additionally the remaining devkit common-keys can be generated once the common-key keyX is recovered.&lt;br /&gt;
&lt;br /&gt;
Note the devkit key-generator was discovered to be the same as the retail key-generator.&lt;br /&gt;
| Deducing the keyX for keyslot 0x3D and hardware key-generator algorithm. Generate remaining devkit common-keys.&lt;br /&gt;
| pre-[[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| Shortly after the key-generator was revealed to be flawed at the 32c3 3ds talk&lt;br /&gt;
| January 20, 2016&lt;br /&gt;
| [[User:Jakcron|jakcron]]&lt;br /&gt;
|-&lt;br /&gt;
| ntrcardhax&lt;br /&gt;
| &lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| 10.4.0-29&lt;br /&gt;
| &lt;br /&gt;
| March 2015&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Title downgrading via [[Application_Manager_Services|AM]]([[Application_Manager_Services_PXI|PXI]])&lt;br /&gt;
| When a title is *already* installed, Process9 will compare the installed title-version with the title-version being installed. When the one being installed is older, Process9 would return an error.&lt;br /&gt;
&lt;br /&gt;
However, this can be bypassed by just deleting the title first via the service command(s) for that: with the title removed from the [[Title_Database]], Process9 can&#039;t compare the input title-version with anything. Hence, titles can be downgraded this way.&lt;br /&gt;
&lt;br /&gt;
[[11.0.0-33|11.0.0-X]] fixed this for key system titles (MSET, Home Menu, spider, ErrDisp, SKATER, NATIVE_FIRM, and every retail system module), by checking the version of the title to install against a hard-coded list of (titleID, minimumVersionRequired) pairs.&lt;br /&gt;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], for key system titles.&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| FAT FS code null-deref&lt;br /&gt;
| When FSFile:Read is used with a file which is corrupted on a FAT filesystem(in particular SD), Process9 can crash. This particular crash is caused by a function returning NULL instead of an actual ptr due to an error. The caller of that function doesn&#039;t check for NULL which then triggers a read based at NULL.&lt;br /&gt;
&lt;br /&gt;
Sample &amp;quot;fsck.vfat -n -v -V &amp;lt;fat image backup&amp;gt;&amp;quot; output for the above crash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;...&lt;br /&gt;
Starting check/repair pass.&lt;br /&gt;
&amp;lt;FilePath0&amp;gt; and&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 share clusters.&lt;br /&gt;
 Truncating second to 3375104 bytes.&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 File size is 2787392 bytes, cluster chain length is 16384 bytes.&lt;br /&gt;
 Truncating file to 16384 bytes.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Reclaimed 1 unused cluster (16384 bytes).&lt;br /&gt;
Checking free cluster summary.&lt;br /&gt;
Free cluster summary wrong (1404490 vs. really 1404491)&lt;br /&gt;
 Auto-correcting.&lt;br /&gt;
Starting verification pass.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Leaving filesystem unchanged.&amp;lt;/pre&amp;gt;&lt;br /&gt;
| Useless null-based-read&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| July 8-9, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| RSA signature padding checks&lt;br /&gt;
| The TWL_FIRM RSA sig padding check code used for all TWL RSA sig-checks has issues, see [[FIRM|here]].&lt;br /&gt;
The main 3DS RSA padding check code(non-certificate, including NATIVE_FIRM) uses the function used with the above to extract more padding + the actual hash from the additional padding. This isn&#039;t really a problem here because there&#039;s proper padding check code which is executed prior to this.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ValidateDSiWareSectionMAC]] [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| When the input DSiWare section index is higher than &amp;lt;max number of DSiWare sections supported by this FIRM&amp;gt;, Process9 uses keyid 0x40 for calculating the AESMAC, which translates to keyslot 0x40. The result is that the keyslot is left at whatever was already selected before, since the AES selectkeyslot code will immediately  return when keyslot is &amp;gt;=0x40. However, actually exploiting this is difficult: the calculated AESMAC is never returned, this command just compares the calculated AESMAC with the input AESMAC(result-code depends on whether the AESMACs match). It&#039;s unknown whether a timing attack would work with this.&lt;br /&gt;
This is basically a different form of the pxips9 keyslot vuln, except with AESMAC etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March 15, 2015&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| pxips9 [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| This requires access to the [[Process_Services|ps:ps]]/pxi:ps9 services. One way to get access to this would be snshax on system-version &amp;lt;=10.1.0-X(see 32c3 3ds talk).&lt;br /&gt;
When an invalid key-type value is passed to any of the PS commands, Process9 will try to select keyslot 0x40. That aesengine_setkeyslot() code will then immediately return due to the invalid keyslot value. Since that function doesn&#039;t return any errors, Process9 will just continue to do crypto with whatever AES keyslot was selected before the PS command was sent.&lt;br /&gt;
| Reusing the previously used keyslot, for crypto with PS.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Roughly the same time(same day?) as firmlaunch-hax.&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| firmlaunch-hax: FIRM header ToCToU&lt;br /&gt;
| This can&#039;t be exploited from ARM11 userland.&lt;br /&gt;
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn&#039;t expect &amp;quot;anything&amp;quot; besides the ARM9 to access this data.&lt;br /&gt;
With [[9.5.0-22]] the address of this FIRM header was changed from a FCRAM address, to ARM9-only address 0x01fffc00.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| &lt;br /&gt;
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Uninitialized data output for (PXI) command replies&lt;br /&gt;
| PXI commands for various services(including some [[Filesystem_services_PXI|here]] and many others) can write uninitialized data (like from ARM registers) to the command reply. This happens with stubbed commands, but this can also occur with certain commands when returning an error.&lt;br /&gt;
Certain ARM11 service commands have this same issue as well.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions&lt;br /&gt;
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.&lt;br /&gt;
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ExportDSiWare]] export path&lt;br /&gt;
| Process9 allocates memory on Process9 heap for the export path then verifies that the actual allocated size matches the input size. Then Process9 copies the input path from FCRAM to this buffer, and uses it with the Process9 FS openfile code, which use paths in the form of &amp;quot;&amp;lt;mountpoint&amp;gt;:/&amp;lt;path&amp;gt;&amp;quot;.&lt;br /&gt;
Process9 does not check the contents of this path at all before passing it to the FS code, besides writing a NUL-terminator to the end of the buffer.&lt;br /&gt;
| Exporting of DSiWare to arbitrary Process9 file-paths, such as &amp;quot;nand:/&amp;lt;path&amp;gt;&amp;quot; etc. This isn&#039;t really useful since the data which gets written can&#039;t be controlled.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DSiWare_Exports]] [[CTCert]] verification&lt;br /&gt;
| Just like DSi originally did, 3DS verifies the APCert for DSiWare on SD with the CTCert also in the DSiWare .bin. On DSi this was fixed with with system-version 1.4.2 by verifying with the actual console-unique cert instead(stored in NAND), while on 3DS it&#039;s still not(?) fixed.&lt;br /&gt;
On 3DS however this is rather useless, due to the entire DSiWare .bin being encrypted with the console-unique movable.sed keyY.&lt;br /&gt;
| When the movable.sed keyY for the target 3DS is known and the target 3DS CTCert private-key is unknown, importing of modified DSiWare SD .bin files.&lt;br /&gt;
| Unknown, probably none.&lt;br /&gt;
| ?&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Gamecard_Services_PXI]] unchecked REG_CTRCARDCNT transfer-size&lt;br /&gt;
| The u8 REG_CTRCARDCNT transfer-size parameter for the [[Gamecard_Services_PXI]] read/write CTRCARD commands is used as an index for an array of u16 values. Before [[5.0.0-11|5.0.0-X]] this u8 value wasn&#039;t checked, thus out-of-bounds reads could be triggered(which is rather useless in this case).&lt;br /&gt;
| Out-of-bounds read for a value which gets written to a register.&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] cmdbuf buffer overrun&lt;br /&gt;
| The Process9 code responsible [[PXI_Registers|PXI]] communications didn&#039;t verify the size of the incoming command before writing it to a C++ member variable. &lt;br /&gt;
| Probably ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015, original timeframe if any unknown&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]/[[User:Yellows8|Yellows8]]/maybe others(?)&lt;br /&gt;
|-&lt;br /&gt;
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])&lt;br /&gt;
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be &amp;lt;=0x2800.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Process_Services_PXI|PS RSA]] commands buffer overflows&lt;br /&gt;
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9&#039;s .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads&#039; stacks. SignRsaSha256 also has a buf overflow, but this isn&#039;t exploitable.&lt;br /&gt;
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] pxi_id bad check&lt;br /&gt;
| The Process9 code responsible for [[PXI_Registers|PXI]] communications read pxi_id as a signed char. There were two flaws:&lt;br /&gt;
* They used it as index to a lookup-table without checking the value at all.&lt;br /&gt;
* Another function verified that pxi_id &amp;lt; 7, allowing negative values to pass the check. This would also cause an out-of-range table-lookup.&lt;br /&gt;
| Maybe ARM9 code execution&lt;br /&gt;
| [[3.0.0-5|3.0.0-5]]&lt;br /&gt;
|&lt;br /&gt;
| March 2015, originally 2012 for the first issue at least&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]], maybe others(?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Kernel9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit1 not set by Kernel9&lt;br /&gt;
| Old versions of Kernel9 never set bit1 of [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]]. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!). Since it&#039;s never locked, you can dump it once you get ARM9 code execution.&lt;br /&gt;
&lt;br /&gt;
From [[3.0.0-5|3.0.0-X]] this was fixed by setting the bit in Kernel9 after poking some registers in that region. On New3DS arm9loader sets this bit instead of Kernel9, which is exploitable through a hardware + software vulnerability (see arm9loaderhax / description).&lt;br /&gt;
&lt;br /&gt;
This flaw resurged when it gained a new practical use: retrieving the OTP data for a New3DS console in order to decrypt the key data used in arm9loader (see enhanced-arm9loaderhax / description). This was performed by downgrading to a vulnerable system version. By accounting for differences in CTR-NAND crypto (0x05 -&amp;gt; 0x04, see partition encryption types [[Flash_Filesystem#NAND_structure|here]]), it is possible to boot a New3DS using Old3DS firmware 1.0-2.X and an Old3DS [[NCSD#NCSD_header|NCSD Header]] to retrieve the required OTP data using this flaw.&lt;br /&gt;
| Dumping of the [[OTP Registers|OTP]] area&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Plutooo|plutoo]], Normmatt independently&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM11 software ==&lt;br /&gt;
=== Kernel11 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC]] table too small&lt;br /&gt;
|  The table of function pointers for SVC&#039;s only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.&lt;br /&gt;
&lt;br /&gt;
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn&#039;t mapped as executable.&lt;br /&gt;
| &lt;br /&gt;
|  None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC|svcBackdoor (0x7B)]]&lt;br /&gt;
|  This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11 (with NATIVE_FIRM) required patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]] (deleted)&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  slowhax&lt;br /&gt;
|  svcWaitSynchronizationN does not decrement the references to valid handles in an array before returning an error when it encounters an invalid handle. This allows one to (slowly) overflow the reference count for a handle object to zero.&lt;br /&gt;
| ARM11 kernel-mode code execution&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2016?&lt;br /&gt;
| nedwill, derrek, others?&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2.1&lt;br /&gt;
| Nintendo&#039;s fix for memchunkhax2 in [[10.4.0-29|10.4.0-X]] did not fix the GPU case: one may cause the requisite ToCToU race using gspwn, bypassing the new validation.&lt;br /&gt;
derrek&#039;s original 32c3 presentation for memchunkhax2 commented that a GPU-based attack was possible, but would be difficult.  However, memchunkhax2.1 showed that it was possible to do fairly reliably.&lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| derrek, aliaspider&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2&lt;br /&gt;
| &lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]] (partially)&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| derrek&lt;br /&gt;
|-&lt;br /&gt;
| heaphax&lt;br /&gt;
| Can change the size of free memchunk structures stored in FCRAM using DMA, which leads to the ability to allocate memory chunks over already-allocated memory. This can be used in the SYSTEM region to allocate RW memory over any part of the NS system module, which is enough to take it over.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading) Code execution within any applet.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
| snshax&lt;br /&gt;
| Can force creation of Safe NS process into gspwn-able memory, allowing for takeover.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading)&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
|  AffinityMask/processorid validation&lt;br /&gt;
|  With [[10.0.0-27|10.0.0-X]] the following functions were updated: svcGetThreadAffinityMask, svcGetProcessAffinityMask, svcSetProcessAffinityMask, and svcCreateThread. The code changes for all but svcCreateThread are identical.&lt;br /&gt;
The original code with the first 3 did the following: &lt;br /&gt;
* if(u32_processorcount &amp;gt; ~0x80000001)return 0xe0e01bfd;&lt;br /&gt;
* if(s32_processorcount &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
The following code replaced the above:&lt;br /&gt;
* if(u32_processorcount &amp;gt;= &amp;lt;total_cores+1&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
In theory the latter should catch everything that the former did, so it&#039;s unknown if this was really a security issue.&lt;br /&gt;
&lt;br /&gt;
The svcCreateThread changes with [[10.0.0-27|10.0.0-X]] definitely did fix a security issue.&lt;br /&gt;
* Original code: &amp;quot;if(s32_processorid &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
* New code: &amp;quot;if(s32_processorid &amp;gt;= &amp;lt;total_cores&amp;gt; || s32_processorid &amp;lt;= -4)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
This fixed an off-by-one issue: if one would use processorid=total_cores, which isn&#039;t actually a valid value, svcCreateThread would accept that value on &amp;lt;[[10.0.0-27|10.0.0-X]]. This results in data being written out-of-bounds(baseaddr = arrayaddr + entrysize*processorid), which has the following result:&lt;br /&gt;
* Old3DS: Useless kernel-mode crash due to accessing unmapped memory.&lt;br /&gt;
* New3DS: uncontrolled data write into a kernel-mode L1 MMU-table. This isn&#039;t really useful: the data can&#039;t be controlled, and the data which gets overwritten is all-zero anyway(this isn&#039;t anywhere near MMU L1 entries for actually mapped memory).&lt;br /&gt;
The previous version also allowed large negative s32_processorid values(negative processorid values are special values not actual procids), but it appears using values like that won&#039;t actually do anything(meaning no crash) besides the thread not running / thread not running for a while(besides triggering a kernelpanic with certain s32_processorid value(s)).&lt;br /&gt;
| Nothing useful&lt;br /&gt;
|  [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| svcCreateThread issue: May 31, 2015. The rest: September 8, 2015, via v9.6-&amp;gt;v10.0 ARM11-kernel code-diff.&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax&lt;br /&gt;
| The kernel originally did not validate the data stored in the FCRAM kernel heap [[Memchunkhdr|memchunk-headers]] for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.&lt;br /&gt;
&lt;br /&gt;
There are &#039;&#039;multiple&#039;&#039; ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.&lt;br /&gt;
| When combined with other flaws: ARM11-kernelmode code execution&lt;br /&gt;
| [[9.3.0-21|9.3.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| February 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Multiple [[KLinkedListNode|KLinkedListNode]] SlabHeap use after free bugs&lt;br /&gt;
| The ARM11-kernel did access the &#039;key&#039; field of [[KLinkedListNode|KLinkedListNode]] objects, which are located on the SlabHeap, after freeing them. Thus, triggering an allocation of a new [[KLinkedListNode|KLinkedListNode]] object at the right time could result in a type-confusion. Pseudo-code:&lt;br /&gt;
SlabHeap_free(KLinkedListNode);&lt;br /&gt;
KObject *obj = KLinkedListNode-&amp;gt;key;  // the object there might have changed!&lt;br /&gt;
This bug appeared all over the place.&lt;br /&gt;
| ARM11-kernelmode code exec maybe&lt;br /&gt;
| [[8.0.0-18|8.0.0-18]]&lt;br /&gt;
| &lt;br /&gt;
| April 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11-kernel didn&#039;t check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.&lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11|6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcStartInterProcessDma]]&lt;br /&gt;
| For svcStartInterProcessDma, the kernel code had the following flaws:&lt;br /&gt;
&lt;br /&gt;
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.&lt;br /&gt;
&lt;br /&gt;
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address &amp;gt;=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr-&amp;gt;physaddr conversion). &lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| DmaConfig issue: unknown. The rest: 2014&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] independently&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] Parameter checks&lt;br /&gt;
| For svcControlMemory the parameter check had these two flaws:&lt;br /&gt;
&lt;br /&gt;
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn&#039;t actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn&#039;t actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows on (addr0+size) are now checked that previously weren&#039;t (this also applies to most other address checks elsewhere in the kernel).&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] request/response buffer overflow&lt;br /&gt;
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.&lt;br /&gt;
&lt;br /&gt;
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of &amp;lt;nowiki&amp;gt;((size&amp;lt;&amp;lt;14) | 2)&amp;lt;/nowiki&amp;gt; to write arbitrary memory to any RW userland memory in the destination process.&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|SVC stack allocation overflows]]&lt;br /&gt;
| &lt;br /&gt;
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. &lt;br /&gt;
* The alignment (size+7)&amp;amp;~7 calculation before allocation was not checked for integer overflow.&lt;br /&gt;
&lt;br /&gt;
This might allow for ARM11 kernel code-execution.&lt;br /&gt;
&lt;br /&gt;
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] complementary&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions&lt;br /&gt;
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn&#039;t check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.1.0-8]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11 kernel didn&#039;t check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don&#039;t have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions&lt;br /&gt;
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== [[FIRM]] Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Services|&amp;quot;srv:pm&amp;quot;]] process registration&lt;br /&gt;
| Originally any process had access to the port &amp;quot;srv:pm&amp;quot;. The PID&#039;s used for the (un)registration commands are not checked either. This allowed any process to re-register itself with &amp;quot;srv:pm&amp;quot;, and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] &amp;quot;srv:pm&amp;quot; is now a service instead of a globally accessible port. Only processes with PID&#039;s less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for &amp;quot;srv:pm&amp;quot; open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.&lt;br /&gt;
&lt;br /&gt;
This flaw was needed for exploiting the &amp;lt;=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don&#039;t have access to those service(s).&lt;br /&gt;
| Access to arbitrary services&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| FSDIR null-deref&lt;br /&gt;
| [[Filesystem_services|FS]]-module may crash in some cases when handling directory reading. The trigger seems to be due to using [[FSDir:Close]] without closing the dir-handle afterwards?(Perhaps this is caused by out-of-memory?) This seems to be useless since it&#039;s just a null-deref.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| May 19(?)-20, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in system-module system-version&lt;br /&gt;
!  Last system-module system-version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Timeframe this was added to wiki&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| AM stack/.bss infoleak via [[AM:ReadTwlBackupInfo]]([[AM:ReadTwlBackupInfoEx|Ex]])&lt;br /&gt;
| After writing the output-info structure to stack, it then copies that structure to the output buffer ptr using the size from the command. The size is not checked. This could be used to read data from the AM-service-thread stack handling the command + .bss.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This was not tested on hardware.&#039;&#039;&#039;&lt;br /&gt;
| Stack/.bss reading&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27]](AM v9217)&lt;br /&gt;
| Roughly October 17, 2016&lt;br /&gt;
| October 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MVD_Services|MVD]]: Stack buffer overflow with [[MVDSTD:SetupOutputBuffers]].&lt;br /&gt;
| The input total_entries is not validated when initially processing the input entry-list. This fixed-size input entry-list is copied to stack from the command request. The loop for processing this initializes a global table, the converted linearmem-&amp;gt;physaddrs used there are also copied to stack(0x8-bytes of physaddrs per entry).&lt;br /&gt;
&lt;br /&gt;
If total_entries is too large, MVD-sysmodule will crash due to reading unmapped memory following the stack(0x10000000). Afterwards if the out-of-bounds total_entries is smaller than that, it will crash due accessing address 0x0, hence this useless.&lt;br /&gt;
| MVD-sysmodule crash.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| April 22, 2016 (Tested on the 25th)&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]]: Using CTRSDK heap with UDS sharedmem from the user-process.&lt;br /&gt;
| See the HTTP-sysmodule section below.&lt;br /&gt;
&lt;br /&gt;
CTRSDK heap is used with the sharedmem from [[NWMUDS:InitializeWithVersion]]. Buffers are allocated/freed under this heap using [[NWMUDS:Bind]] and [[NWMUDS:Unbind]].&lt;br /&gt;
&lt;br /&gt;
Hence, overwriting sharedmem with gspwn then using [[NWMUDS:Unbind]] results in the usual controlled CTRSDK memchunk-header write, similar to HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This could be done by creating an UDS network, without any other nodes on the network.&lt;br /&gt;
&lt;br /&gt;
Besides CTRSDK memchunk-headers, there are no addresses stored under this sharedmem.&lt;br /&gt;
| ROP under NWM-module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20|9.0.0-X]]&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| April 16, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds memory access during spectator [[Download_Play|data-frame]] checksum calculation&lt;br /&gt;
| DLP doesn&#039;t validate the frame_size when receiving spectator data-frames at all, unlike non-spectator data-frames. The actual spectator data-frame parsing code doesn&#039;t use that field either. However, the data-frame checksum calculation code called during checksum verification does use the frame_size for loading the size of the framebuf.&lt;br /&gt;
&lt;br /&gt;
Hence, using a large frame_size like 0xFFFF will result in the checksum calculation code reading data out-of-bounds. This isn&#039;t really useful, you could trigger a remote local-WLAN DLP-sysmodule crash while a 3DS system is scanning for DLP networks(due to accessing unmapped memory), but that&#039;s about all(trying to infoleak with this likely isn&#039;t useful either).&lt;br /&gt;
| DLP-sysmodule crash, handled by dlplay system-application by a &amp;quot;connection interrupted&amp;quot; error eventually then a fatal-error via ErrDisp.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8, 2016 (Tested on the 10th)&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds output data writing during spectator sysupdate titlelist [[Download_Play|data-frame]] handling&lt;br /&gt;
| The total_entries and out_entryindex fields for the titlelist DLP spectator data-frames are not validated. This is parsed during DLP network scanning. Hence, the specified titlelist data can be written out-of-bounds using the specified out_entryindex and total_entries. A crash will occur while reading the input data-frame titlelist if total_entries is larger than 0x27A, due to accessing unmapped memory.&lt;br /&gt;
&lt;br /&gt;
There&#039;s not much non-zero data to overwrite following the output buffer(located in sharedmem), any ptrs are located in sharedmem. Overwriting certain ptr(s) are only known to cause a crash when attempting to use the DLP-client shutdown service-command.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to exploit the above crash, since the linked-list code involves writes zeros(with a controlled start ptr).&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8-9, 2016&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[IR_Services|IR]]: Stack buffer overflow with custom hardware&lt;br /&gt;
| Originally IR sysmodule used the read value from the I2C-IR registers TXLVL and RXLVL without validating them at all. See [[10.6.0-31|here]] for the fix. This is the size used for reading the data-recv FIFO, etc. The output buffer for reading is located on the stack.&lt;br /&gt;
&lt;br /&gt;
This should be exploitable if one could successfully setup the custom hardware for this and if the entire intended sizes actually get read from I2C.&lt;br /&gt;
| ROP under IR sysmodule.&lt;br /&gt;
| [[10.6.0-31|10.6.0-31]]&lt;br /&gt;
| &lt;br /&gt;
| February 23, 2016 (Unknown if it was noticed before then)&lt;br /&gt;
| February 23, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HTTP_Services|HTTP]]: Using CTRSDK heap with sharedmem from the user-process.&lt;br /&gt;
| The data from httpcAddPostDataAscii and other commands is stored under a CTRSDK heap. That heap is the sharedmem specified by the user-process via the HTTPC Initialize command.&lt;br /&gt;
Normally this sharedmem isn&#039;t accessible to the user-process once the sysmodule maps it, hence using it is supposed to be &amp;quot;safe&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This isn&#039;t the case due to gspwn however. Since CTRSDK heap code is so insecure in general, one can use gspwn to locate the HTTPC sharedmem + read/write it, then trigger a mem-write under the sysmodule. This can then be used to get ROP going under HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This is exploited by [https://github.com/yellows8/ctr-httpwn/ctr-httpwn ctr-httpwn].&lt;br /&gt;
| ROP under HTTP sysmdule.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] (Latest sysmodule version as of [[10.7.0-32|10.7.0-32]])&lt;br /&gt;
| Late 2015&lt;br /&gt;
| March 22, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NIM_Services|NIM]]: Downloading old title-versions from eShop&lt;br /&gt;
| Multiple NIM service commands(such as [[NIMS:StartDownload]]) use a title-version value specified by the user-process, NIM does not validate that this input version matches the latest version available via SOAP. Therefore, when combined with AM(PXI) [[#Process9|title-downgrading]] via deleting the target eShop title with System Settings Data Management(if the title was already installed), this allows downloading+installing any title-version from eShop &#039;&#039;if&#039;&#039; it&#039;s still available from CDN.&lt;br /&gt;
The easiest way to exploit this is to just patch the eShop system-application code using these NIM commands(ideally the code which loads the title-version).&lt;br /&gt;
&lt;br /&gt;
Originally this was tested with a debugging-system via modded-FIRM, eventually smea implemented it in HANS for the 32c3 release.&lt;br /&gt;
| Downloading old title-versions from eShop&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| October 24, 2015 (Unknown when exactly the first eShop title downgrade was actually tested, maybe November)&lt;br /&gt;
| January 7, 2016 (Same day Ironfall v1.0 was removed from CDN via the main-CXI files)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SPI_Services|SPI]] service out-of-bounds write&lt;br /&gt;
| cmd1 has out-of-bounds write allowing overwrite of some static variables in .data.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NFC_Services|NFC]] module service command buf-overflows&lt;br /&gt;
| NFC module copies data with certain commands, from command input buffers to stack without checking the size. These commands include the following, it&#039;s unknown if there&#039;s more commands with similar issues: &amp;quot;nfc:dev&amp;quot; &amp;lt;0x000C....&amp;gt; and &amp;quot;nfc:s&amp;quot; &amp;lt;0x0037....&amp;gt;.&lt;br /&gt;
Since both of these commands are stubbed in the Old3DS NFC module from the very first version(those just return an error), these issues only affect the New3DS NFC module.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known retail titles which have access to either of these services.&lt;br /&gt;
| ROP under NFC module.&lt;br /&gt;
| New3DS: None&lt;br /&gt;
| New3DS: [[9.5.0-22]]&lt;br /&gt;
| December 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[News_Services|NEWSS]] service command notificationID validation failure&lt;br /&gt;
| This module does not validate the input notificationID for &amp;lt;nowiki&amp;gt;&amp;quot;news:s&amp;quot;&amp;lt;/nowiki&amp;gt; service commands. This is an out-of-bounds array index bug. For example, [[NEWSS:SetNotificationHeader]] could be used to exploit news module: this copies the input data(size is properly checked) to: out = newsdb_savedata+0x10 + (someu32array[notificationID]*0x70).&lt;br /&gt;
| ROP under news module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.7.0-25|9.7.0-X]]&lt;br /&gt;
| December 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData]] heap buffer overflow&lt;br /&gt;
| input_size = 0x1E * &amp;lt;value the u8 from input_[[NWM_Services|networkstruct]]+0x1D&amp;gt;. Then input_tag0 is copied to a heap buffer. When input_size is larger than 0xFA-bytes, it will then copy input_tag1 to &amp;lt;end_address_of_previous_outbuf&amp;gt;, with size=input_size-0xFA.&lt;br /&gt;
&lt;br /&gt;
This can be triggered by either using this command directly, or by boadcasting a wifi beacon which triggers it while a 3DS system running the target process is in range, when the process is scanning for hosts to connect to. Processes will only pass tag data to this command when the wlancommID and other thing(s) match the values for the process.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to actually exploit this for getting ROP under NWM-module, at the time of originally adding this to the wiki. This is because the data which gets copied out-of-bounds *and* actually causes crash(es), can&#039;t be controlled it seems(with just broadcasting a beacon at least). It&#039;s unknown whether this could be exploited from just using NWMUDS service-cmd(s) directly.&lt;br /&gt;
| Without any actual way to exploit this: NWM-module DoS, resulting in process termination(process crash). This breaks *everything* involving wifi comms, a reboot is required to recover from this.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| ~September 23, 2014(see the [[NWMUDS:DecryptBeaconData]] page history)&lt;br /&gt;
| August 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HID_Services|HID]] module shared-mem&lt;br /&gt;
| HID module does not validate the index values in [[HID_Shared_Memory|sharedmem]](just changes index to 0 when index == maxval when updating), therefore large values will result in HID module writing HID data to arbitrary addresses.&lt;br /&gt;
| ROP under HID module, but this is *very* unlikely to be exploitable since the data written is HID data.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| gspwn&lt;br /&gt;
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you&#039;re running under, and gain real code-execution from a ROP-chain. Normally applets&#039; .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).&lt;br /&gt;
&lt;br /&gt;
FCRAM is gpu-accessible up to physaddr 0x26800000 on Old3DS, and 0x2DC00000 on New3DS. This is BASE_memregion_start(aka SYSTEM_memregion_end)-0x400000 with the default memory-layout on Old3DS/New3DS.&lt;br /&gt;
| User-mode code execution.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| Early 2014&lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Yellows8|Yellows8]]/others before then&lt;br /&gt;
|-&lt;br /&gt;
| rohax&lt;br /&gt;
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.&lt;br /&gt;
&lt;br /&gt;
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.&lt;br /&gt;
| Memory-mapping syscalls.&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| [[9.4.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Plutooo|plutoo]] joint effort&lt;br /&gt;
|-&lt;br /&gt;
| Region free&lt;br /&gt;
| Only [[Home Menu]] itself checks gamecards&#039; region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.&lt;br /&gt;
This essentially means launching the gamecard with the [[NS_and_APT_Services|&amp;quot;ns:s&amp;quot;]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].&lt;br /&gt;
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation&lt;br /&gt;
| None&lt;br /&gt;
| Last tested with [[10.1.0-27|10.1.0-X]].&lt;br /&gt;
| June(?) 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]] service-cmd state null-ptr deref&lt;br /&gt;
| The NWMUDS service command code loads a ptr from .data, adds an offset to that, then passes that as the state address for the actual command-handler function. The value of the ptr loaded from .data is not checked, therefore this will cause crashes due to that being 0x0 when NWMUDS was not properly initialized.&lt;br /&gt;
It&#039;s unknown whether any NWM services besides NWMUDS have this issue.&lt;br /&gt;
| This is rather useless since it&#039;s only a crash caused by a state ptr based at 0x0.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== General/CTRSDK ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|UDS]] beacon additional-data buffer overflow&lt;br /&gt;
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.&lt;br /&gt;
This was discovered while doing code RE with an old dlp-module version. It&#039;s unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown if there&#039;s any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can&#039;t be exploited with this).&lt;br /&gt;
&lt;br /&gt;
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.&lt;br /&gt;
| Perhaps ROP, very difficult if possible with anything at all&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| September(?) 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=18499</id>
		<title>3DS System Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=18499"/>
		<updated>2016-10-26T19:27:05Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Kernel11 */ slowhax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Exploits are used to execute unofficial code (homebrew) on the Nintendo 3DS. This page is a list of publicly known system flaws, for userland applications/applets flaws see [[3DS_Userland_Flaws|here]].&lt;br /&gt;
&lt;br /&gt;
=Stale / Rejected Efforts=&lt;br /&gt;
* Neimod has been working on a RAM dumping setup for a little while now. He&#039;s de-soldered the 3DS&#039;s RAM chip and hooked it and the RAM pinouts on the 3DS&#039; PCB up to a custom RAM dumping setup. A while ago he published photos showing his setup to be working quite well, with the 3DS successfully booting up. However, his flickr stream is now private along with most of his work.&lt;br /&gt;
&lt;br /&gt;
* Someone (who will remain unnamed) has released CFW and CIA installers, all of which is copied from the work of others, or copyrighted material.&lt;br /&gt;
&lt;br /&gt;
==Tips and info==&lt;br /&gt;
The 3DS uses the XN feature of the ARM11 processor. There&#039;s no official way from applications to enable executable permission for memory containing arbitrary unsigned code(there&#039;s a [[SVC]] for this, but only [[RO_Services|RO-module]] has access to it). An usable userland exploit would still be useful: you could only do return-oriented-programming with it initially. From ROP one could then exploit system flaw(s), see below.&lt;br /&gt;
&lt;br /&gt;
SD card [[extdata]] and SD savegames can be attacked, for consoles where the console-unique [[Nand/private/movable.sed|movable.sed]] was dumped(accessing SD data is far easier by running code on the target 3DS however).&lt;br /&gt;
&lt;br /&gt;
=System flaws=&lt;br /&gt;
== Hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed with hardware model/revision&lt;br /&gt;
!  Newest hardware model/revision this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| ARM9/ARM11 bootrom vectors point at unitialized RAM&lt;br /&gt;
| ARM9&#039;s and ARM11&#039;s exception vectors are hardcoded to point at the CPU&#039;s internal memory (0x08000000 region for ARM9, AXIWRAM for ARM11). While the bootrom does set them up to point to an endless loop at some point during boot, it does not do so immediately. As such, a carefully-timed fault injection (via hardware) to trigger an exception (such as an invalid instruction) will cause execution to fall into ARM9 RAM. &lt;br /&gt;
Since RAM isn&#039;t cleared on boot (see below), one can immediately start execution of their own code here to dump bootrom, OTP, etc.&lt;br /&gt;
The ARM9 bootrom does the following at reset:  reset vector branches to another instruction, then branches to bootrom+0x8000. Hence, there&#039;s no way to know for certain when exactly the ARM9 exception-vector data stored in memory gets initialized.&lt;br /&gt;
&lt;br /&gt;
This requires *very* *precise* timing for triggering the hardware fault: it&#039;s unknown if anyone actually exploited this successfully at the time of writing(the one who attempted+discovered it *originally* as listed in this wiki section hasn&#039;t).&lt;br /&gt;
| None: all available 3DS models at the time of writing have the exact same ARM9/ARM11 bootrom for the unprotected areas.&lt;br /&gt;
| New3DS&lt;br /&gt;
| End of February 2014&lt;br /&gt;
| [[User:Derrek|derrek]], WulfyStylez (May 2015) independently&lt;br /&gt;
|-&lt;br /&gt;
| Missing AES key clearing&lt;br /&gt;
| The hardware AES engine does not clear keys when doing a hard reset/reboot.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| August 2014&lt;br /&gt;
| Mathieulh/Others&lt;br /&gt;
|-&lt;br /&gt;
| No RAM clearing on reboots&lt;br /&gt;
| On an MCU-triggered reboot all RAM including FCRAM/ARM9 memory/AXIWRAM/VRAM keeps its contents.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| March 2014&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| 32bits of actual console-unique TWLNAND keydata&lt;br /&gt;
| On retail the 8-bytes at ARM9 address [[Memory_layout|0x01FFB808]] are XORed with hard-coded data, to generate the TWL console-unique keys, including TWLNAND. On Old3DS the high u32 is always 0x0, while on New3DS that u32 is always 0x2. On top of this, the lower u32&#039;s highest bit is always ORed. only 31 bits of the TWL console-unique keydata / TWL consoleID are actually console-unique.&lt;br /&gt;
This allows one to easily bruteforce the TWL console-unique keydata with *just* data from TWLNAND. On DSi the actual console-unique data for key generation is 8-bytes(all bytes actually set).&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| DSi / 3DS-TWL key-generator&lt;br /&gt;
| After using the key generator to generate the normal-key, you could overwrite parts of the normal-key with your own data and then recover the key-generator output by comparing the new crypto output with the original crypto output. From the normal-key outputs, you could deduce the TWL key-generator function.&lt;br /&gt;
This applies to the keyX/keyY too.&lt;br /&gt;
&lt;br /&gt;
This attack does not work for the 3DS key-generator because keyslots 0-3 are only for TWL keys.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| 2011&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| 3DS key-generator&lt;br /&gt;
| The algorithm for generating the normal-keys for keyslots is cryptographically weak.  As a result, it is easily susceptible to differential cryptanalysis if the normal-key corresponding to any scrambler-generated keyslot is discovered.&lt;br /&gt;
&lt;br /&gt;
Several such pairs of matching normal-keys and KeyY values were found, leading to deducing the key-generator function.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| FIRM partitions known-plaintext&lt;br /&gt;
| The [[Flash_Filesystem|FIRM partitions]] are encrypted with AES-CTR without a MAC. Since this works by XOR&#039;ing data with a static (per-console in this case) keystream, one can deduce the keystream of a portion of each FIRM partition if they have the actual FIRM binary stored in it.&lt;br /&gt;
&lt;br /&gt;
This can be paired with many exploits. For example, it allows minor FIRM downgrades (i.e. 10.4 to 9.6 or 9.5 to 9.4, but not 9.6 to 9.5).&lt;br /&gt;
&lt;br /&gt;
This can be somewhat addressed by having a FIRM header skip over previously used section offsets, but this would just air-gap newer FIRMs without fixing the core bug. This can also only be done a limited number of times due to the size of FIRM versus the size of the partitions.&lt;br /&gt;
| None&lt;br /&gt;
| New3DS&lt;br /&gt;
| &lt;br /&gt;
| Everyone&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM9 software ==&lt;br /&gt;
=== arm9loader ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Rearrangable keys in the NAND keystore&lt;br /&gt;
| Due to the keystore being encrypted with AES-ECB, one can rearrange blocks and still have the NAND keystore decrypt in a deterministic way. &lt;br /&gt;
&lt;br /&gt;
Using 10.0 FIRM it is possible to rearrange keys such that ARM9 memory is executed. As such using existing ARM9 execution 10.0 FIRM can be written to NAND and a payload written to memory, with the payload to be executed post-K9L using an MCU reboot.&lt;br /&gt;
| arm9loaderhax given existing ARM9 code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Early 2016&lt;br /&gt;
| 27 September 2016&lt;br /&gt;
| Myria, [[User:Dark samus|dark_samus]]; mathieulh (independently); [[User:Plutooo|plutoo]] (independently) + others&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared OTP hash keydata in console-unique 0x11 key-generation&lt;br /&gt;
| Kernel9Loader does not clear the [[SHA_Registers#SHA_HASH|SHA_HASH register]] after use. As a result, the data stored here as K9L hands over to Kernel9 is the hash of [[OTP_Registers|OTP data]] used to seed the [[FIRM#New_3DS_FIRM|console-unique NAND keystore decryption key]] set on keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Retrieving this keydata and the [[Flash_Filesystem#0x12C00|NAND keystore]] of the same device allows calculating the decrypted New3DS NAND keystore (non-unique, common to all New3DS units), which contains AES normal keys, also set on keyslot 0x11, which are then used to derive all current [[AES_Registers#Keyslots|New3DS-only AES keyXs]] including the newer batch introduced in [[9.6.0-24#arm9loader|9.6.0-X]]. From there, it is trivial to perform the same key derivation in order to initialize those keys on any system version, and even on Old3DS.&lt;br /&gt;
&lt;br /&gt;
This can be performed by exploiting the &amp;quot;arm9loaderhax&amp;quot; vulnerability to obtain post-K9L code execution after an MCU reboot (the bootrom section-loading fail is not relevant here, this attack was performed without OTP data by brute-forcing keys), and using this to dump the SHA_HASH register. This attack works on any FIRM version shipping a vulnerable version of K9L, whereas OTP dumping required a boot of &amp;lt;[[3.0.0-6|3.0.0-X]].&lt;br /&gt;
&lt;br /&gt;
This attack results in obtaining the entire (0x200-bytes) NAND keystore - it was confirmed at a later date that this keystore is encrypted with the same key (by comparing the decrypted data from multiple units), and therefore using another key in this store will not remedy the issue as all keys are known (i.e. later, unused keys decrypt to the same 0x200-bytes constant with the same OTP hash). Later keys could have been encrypted differently but this is not the case. As a result of this, it is not possible for Nintendo to use K9L again in its current format for its intended purpose, though this was not news from the moment people dumped a New3DS OTP.&lt;br /&gt;
| Derivation of all New3DS keys generated via the NAND keystore (0x1B &amp;quot;Secure4&amp;quot; etc.)&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| ~April 2015, implemented in May 2015&lt;br /&gt;
| 13 January 2016&lt;br /&gt;
| [[User:WulfyStylez|WulfyStylez]], [[User:Dazzozo|Dazzozo]], [[User:Shinyquagsire23|shinyquagsire23]] (complimentary + implemented), [[User:Plutooo|plutoo]], Normmatt (discovered independently)&lt;br /&gt;
|-&lt;br /&gt;
| enhanced-arm9loaderhax&lt;br /&gt;
| See the 32c3 3ds talk.&lt;br /&gt;
Since this is a combination of a trick with the arm9-bootrom + arm9loaderhax, and since you have to manually write FIRM to the firm0/firm1 NAND partitions, this can&#039;t be completely fixed. Any system with existing ARM9 code execution and an OTP/OTP hash dump can exploit this. Additionally, by using the FIRM partition known-plaintext bug and bruteforcing the second entry in the keystore, this can currently be exploited on all New3DS systems without any other prerequisite hacks.&lt;br /&gt;
| arm9loaderhax which automatically occurs at hard-boot.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| See arm9loaderhax / description.&lt;br /&gt;
| Theorized around mid July, 2015. Later implemented+tested by [[User:Plutooo|plutoo]] and derrek.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Missing verification-block for the 9.6 keys (arm9loaderhax)&lt;br /&gt;
| Starting with [[9.6.0-24|9.6.0-X]] a new set of NAND-based keys were introduced. However, no verification block was added to verify that the new key read from NAND is correct. This was technically an issue from [[9.5.0-22|9.5.0-X]] with the original sector+0 keydata, however the below is only possible with [[9.6.0-24|9.6.0-X]] since keyslots 0x15 and 0x16 are generated from different 0x11 keyXs.&lt;br /&gt;
&lt;br /&gt;
Writing an incorrect key to NAND will cause arm9loader to decrypt the ARM9 kernel as garbage and then jump to it.&lt;br /&gt;
&lt;br /&gt;
This allows an hardware-based attack where you can boot into an older exploited firmware, fill all memory with NOP sleds/jump-instructions, and then reboot into executing garbage. By automating this process with various input keydata, eventually you&#039;ll find some garbage that jumps to your code.&lt;br /&gt;
&lt;br /&gt;
This gives very early ARM9 code execution (pre-ARM9 kernel). As such, it is possible to dump RSA keyslots with this and calculate the 6.x [[Savegames#6.0.0-11_Savegame_keyY|save]], and 7.x [[NCCH]] keys. This cannot be used to recover keys initialized by arm9loader itself. This is due to it wiping the area used for its stack during NAND sector decryption and keyslot init. &lt;br /&gt;
&lt;br /&gt;
Due to FIRMs on both Old and New 3DS using the same RSA data, this can be exploited on Old3DS as well, but only if one already has the actual plaintext normalkey from New3DS NAND sector 0x96 offset-0 and has dumped the OTP area of the Old3DS.&lt;br /&gt;
| Recovery of 6.x [[Savegames#6.0.0-11_Savegame_keyY|save key]]/7.x [[NCCH]] key, access to uncleared OTP hash keydata&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Uncleared New3DS keyslot 0x11&lt;br /&gt;
| Originally the New3DS [[FIRM]] arm9bin loader only cleared keyslot 0x11 when it gets executed at firmlaunch. This was fixed with [[9.5.0-22|9.5.0-X]] by completely clearing keyslot 0x11 immediately after the loader finishes using keyslot 0x11.&lt;br /&gt;
This means that any ARM9 code that can execute before the loader clears the keyslot at firmlaunch(including firmlaunch-hax) can get access to the uncleared keyslot 0x11, which then allows one to generate all &amp;lt;=v9.5 New3DS keyXs which are generated by keyslot 0x11.&lt;br /&gt;
&lt;br /&gt;
Therefore, to completely fix this the loader would have to generate more keys using different keyslot 0x11 keydata. This was done with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| New3DS keyXs generation&lt;br /&gt;
| Mostly fixed with [[9.5.0-22|9.5.0-X]], completely fixed with new keys with [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
| &lt;br /&gt;
| February 3, 2015 (one day after [[9.5.0-22|9.5.0-X]] release)&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Process9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Public disclosure timeframe&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-scrambler key&lt;br /&gt;
| New 3DS firmware versions [[8.1.0-0 New3DS|8.1.0]] through [[9.2.0-20|9.2.0]] set the encryption key for [[Amiibo]] data using a hardcoded normal-key in Process9.  In firmware [[9.3.0-21|9.3.0]], Nintendo &amp;quot;fixed&amp;quot; this by using the key scrambler instead, by calculating the keyY value for keyslot 0x39 that results in the same normal-key, then hardcoding that keyY into Process9.&lt;br /&gt;
&lt;br /&gt;
Nintendo&#039;s fix is actually the problem: Nintendo revealed the normal-key matching an unknown keyX and a known keyY.  Combined with the key scrambler using an insecure scrambling algorithm (see &amp;quot;Hardware&amp;quot; above), the key scrambler function could be deduced.&lt;br /&gt;
| Deducing the keyX for keyslot 0x39 and the key scrambler algorithm&lt;br /&gt;
| New 3DS [[9.3.0-21|9.3.0-X]], sort of&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| Sometime in 2015 after the hardware key-generator was broken.&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Leak of normal-key matching a key-generator key&lt;br /&gt;
| During the 3DS&#039; development (June/July 2010) Nintendo added support installing encrypted content ([[CIA]]). Common-key index1 was intended to be a [[AES|hardware generated key]]. However while they added code to generate the key in hardware, they forgot to remove the normal-key for index1 (used elsewhere, likely old debug code). Nintendo later removed the normal key sometime before the first non-prototype firmware release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing the keyY and the normal-key for common-key index1, the devkit key-generator algorithm can be deduced (see &amp;quot;Hardware&amp;quot; above). Additionally the remaining devkit common-keys can be generated once the common-key keyX is recovered.&lt;br /&gt;
&lt;br /&gt;
Note the devkit key-generator was discovered to be the same as the retail key-generator.&lt;br /&gt;
| Deducing the keyX for keyslot 0x3D and hardware key-generator algorithm. Generate remaining devkit common-keys.&lt;br /&gt;
| pre-[[1.0.0-0|1.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| Shortly after the key-generator was revealed to be flawed at the 32c3 3ds talk&lt;br /&gt;
| January 20, 2016&lt;br /&gt;
| [[User:Jakcron|jakcron]]&lt;br /&gt;
|-&lt;br /&gt;
| ntrcardhax&lt;br /&gt;
| &lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| 10.4.0-29&lt;br /&gt;
| &lt;br /&gt;
| March 2015&lt;br /&gt;
| 32c3 3ds talk (December 27, 2015)&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| Title downgrading via [[Application_Manager_Services|AM]]([[Application_Manager_Services_PXI|PXI]])&lt;br /&gt;
| When a title is *already* installed, Process9 will compare the installed title-version with the title-version being installed. When the one being installed is older, Process9 would return an error.&lt;br /&gt;
&lt;br /&gt;
However, this can be bypassed by just deleting the title first via the service command(s) for that: with the title removed from the [[Title_Database]], Process9 can&#039;t compare the input title-version with anything. Hence, titles can be downgraded this way.&lt;br /&gt;
&lt;br /&gt;
[[11.0.0-33|11.0.0-X]] fixed this for key system titles (MSET, Home Menu, spider, ErrDisp, SKATER, NATIVE_FIRM, and every retail system module), by checking the version of the title to install against a hard-coded list of (titleID, minimumVersionRequired) pairs.&lt;br /&gt;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], for key system titles.&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| FAT FS code null-deref&lt;br /&gt;
| When FSFile:Read is used with a file which is corrupted on a FAT filesystem(in particular SD), Process9 can crash. This particular crash is caused by a function returning NULL instead of an actual ptr due to an error. The caller of that function doesn&#039;t check for NULL which then triggers a read based at NULL.&lt;br /&gt;
&lt;br /&gt;
Sample &amp;quot;fsck.vfat -n -v -V &amp;lt;fat image backup&amp;gt;&amp;quot; output for the above crash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;...&lt;br /&gt;
Starting check/repair pass.&lt;br /&gt;
&amp;lt;FilePath0&amp;gt; and&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 share clusters.&lt;br /&gt;
 Truncating second to 3375104 bytes.&lt;br /&gt;
&amp;lt;FilePath1&amp;gt;&lt;br /&gt;
 File size is 2787392 bytes, cluster chain length is 16384 bytes.&lt;br /&gt;
 Truncating file to 16384 bytes.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Reclaimed 1 unused cluster (16384 bytes).&lt;br /&gt;
Checking free cluster summary.&lt;br /&gt;
Free cluster summary wrong (1404490 vs. really 1404491)&lt;br /&gt;
 Auto-correcting.&lt;br /&gt;
Starting verification pass.&lt;br /&gt;
Checking for unused clusters.&lt;br /&gt;
Leaving filesystem unchanged.&amp;lt;/pre&amp;gt;&lt;br /&gt;
| Useless null-based-read&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| July 8-9, 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| RSA signature padding checks&lt;br /&gt;
| The TWL_FIRM RSA sig padding check code used for all TWL RSA sig-checks has issues, see [[FIRM|here]].&lt;br /&gt;
The main 3DS RSA padding check code(non-certificate, including NATIVE_FIRM) uses the function used with the above to extract more padding + the actual hash from the additional padding. This isn&#039;t really a problem here because there&#039;s proper padding check code which is executed prior to this.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22|9.5.0-X]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ValidateDSiWareSectionMAC]] [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| When the input DSiWare section index is higher than &amp;lt;max number of DSiWare sections supported by this FIRM&amp;gt;, Process9 uses keyid 0x40 for calculating the AESMAC, which translates to keyslot 0x40. The result is that the keyslot is left at whatever was already selected before, since the AES selectkeyslot code will immediately  return when keyslot is &amp;gt;=0x40. However, actually exploiting this is difficult: the calculated AESMAC is never returned, this command just compares the calculated AESMAC with the input AESMAC(result-code depends on whether the AESMACs match). It&#039;s unknown whether a timing attack would work with this.&lt;br /&gt;
This is basically a different form of the pxips9 keyslot vuln, except with AESMAC etc.&lt;br /&gt;
| See description.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| March 15, 2015&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| pxips9 [[AES_Registers|AES]] keyslot reuse&lt;br /&gt;
| This requires access to the [[Process_Services|ps:ps]]/pxi:ps9 services. One way to get access to this would be snshax on system-version &amp;lt;=10.1.0-X(see 32c3 3ds talk).&lt;br /&gt;
When an invalid key-type value is passed to any of the PS commands, Process9 will try to select keyslot 0x40. That aesengine_setkeyslot() code will then immediately return due to the invalid keyslot value. Since that function doesn&#039;t return any errors, Process9 will just continue to do crypto with whatever AES keyslot was selected before the PS command was sent.&lt;br /&gt;
| Reusing the previously used keyslot, for crypto with PS.&lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| Roughly the same time(same day?) as firmlaunch-hax.&lt;br /&gt;
| December 29, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| firmlaunch-hax: FIRM header ToCToU&lt;br /&gt;
| This can&#039;t be exploited from ARM11 userland.&lt;br /&gt;
During [[FIRM]] launch, the only FIRM header the ARM9 uses at all is stored in FCRAM, this is 0x200-bytes(the actual used FIRM RSA signature is read to the Process9 stack however). The ARM9 doesn&#039;t expect &amp;quot;anything&amp;quot; besides the ARM9 to access this data.&lt;br /&gt;
With [[9.5.0-22]] the address of this FIRM header was changed from a FCRAM address, to ARM9-only address 0x01fffc00.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| &lt;br /&gt;
| 2012, 3 days after [[User:Yellows8|Yellows8]] started Process9 code RE.&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Uninitialized data output for (PXI) command replies&lt;br /&gt;
| PXI commands for various services(including some [[Filesystem_services_PXI|here]] and many others) can write uninitialized data (like from ARM registers) to the command reply. This happens with stubbed commands, but this can also occur with certain commands when returning an error.&lt;br /&gt;
Certain ARM11 service commands have this same issue as well.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Filesystem_services_PXI|FSPXI]] OpenArchive SD permissions&lt;br /&gt;
| Process9 does not use the exheader ARM9 access-mount permission flag for SD at all.&lt;br /&gt;
This would mean ARM11-kernelmode code / fs-module itself could directly use FSPXI to access SD card without ARM9 checking for SD access, but this is rather useless since a process is usually running with SD access(Home Menu for example) anyway.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[AMPXI:ExportDSiWare]] export path&lt;br /&gt;
| Process9 allocates memory on Process9 heap for the export path then verifies that the actual allocated size matches the input size. Then Process9 copies the input path from FCRAM to this buffer, and uses it with the Process9 FS openfile code, which use paths in the form of &amp;quot;&amp;lt;mountpoint&amp;gt;:/&amp;lt;path&amp;gt;&amp;quot;.&lt;br /&gt;
Process9 does not check the contents of this path at all before passing it to the FS code, besides writing a NUL-terminator to the end of the buffer.&lt;br /&gt;
| Exporting of DSiWare to arbitrary Process9 file-paths, such as &amp;quot;nand:/&amp;lt;path&amp;gt;&amp;quot; etc. This isn&#039;t really useful since the data which gets written can&#039;t be controlled.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DSiWare_Exports]] [[CTCert]] verification&lt;br /&gt;
| Just like DSi originally did, 3DS verifies the APCert for DSiWare on SD with the CTCert also in the DSiWare .bin. On DSi this was fixed with with system-version 1.4.2 by verifying with the actual console-unique cert instead(stored in NAND), while on 3DS it&#039;s still not(?) fixed.&lt;br /&gt;
On 3DS however this is rather useless, due to the entire DSiWare .bin being encrypted with the console-unique movable.sed keyY.&lt;br /&gt;
| When the movable.sed keyY for the target 3DS is known and the target 3DS CTCert private-key is unknown, importing of modified DSiWare SD .bin files.&lt;br /&gt;
| Unknown, probably none.&lt;br /&gt;
| ?&lt;br /&gt;
| April 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Gamecard_Services_PXI]] unchecked REG_CTRCARDCNT transfer-size&lt;br /&gt;
| The u8 REG_CTRCARDCNT transfer-size parameter for the [[Gamecard_Services_PXI]] read/write CTRCARD commands is used as an index for an array of u16 values. Before [[5.0.0-11|5.0.0-X]] this u8 value wasn&#039;t checked, thus out-of-bounds reads could be triggered(which is rather useless in this case).&lt;br /&gt;
| Out-of-bounds read for a value which gets written to a register.&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] cmdbuf buffer overrun&lt;br /&gt;
| The Process9 code responsible [[PXI_Registers|PXI]] communications didn&#039;t verify the size of the incoming command before writing it to a C++ member variable. &lt;br /&gt;
| Probably ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| March 2015, original timeframe if any unknown&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]/[[User:Yellows8|Yellows8]]/maybe others(?)&lt;br /&gt;
|-&lt;br /&gt;
| [[Application_Manager_Services_PXI|PXIAM]] command 0x003D0108(See also [[Application_Manager_Services|this]])&lt;br /&gt;
| When handling this command, Process9 allocates a 0x2800-byte heap buffer, then copies the 4 FCRAM input buffers to this heap buffer without checking the sizes at all(only the buffers with non-zero sizes are copied). Starting with [[5.0.0-11|5.0.0-X]], the total combined size of the input data must be &amp;lt;=0x2800.&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 2013&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Process_Services_PXI|PS RSA]] commands buffer overflows&lt;br /&gt;
| pxips9 cmd1(not accessible via ps:ps) and VerifyRsaSha256: unchecked copy to a buffer in Process9&#039;s .bss, from the input FCRAM buffer. The buffer is located before the pxi cmdhandler threads&#039; stacks. SignRsaSha256 also has a buf overflow, but this isn&#039;t exploitable.&lt;br /&gt;
The buffer for this is the buffer for the signature data. With v5.0, the signature buffer was moved to stack, with a check for the signature data size. When the signature data size is too large, Process9 uses [[SVC|svcBreak]].&lt;br /&gt;
| ARM9 code execution&lt;br /&gt;
| [[5.0.0-11|5.0.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[PXI_Registers|PXI]] pxi_id bad check&lt;br /&gt;
| The Process9 code responsible for [[PXI_Registers|PXI]] communications read pxi_id as a signed char. There were two flaws:&lt;br /&gt;
* They used it as index to a lookup-table without checking the value at all.&lt;br /&gt;
* Another function verified that pxi_id &amp;lt; 7, allowing negative values to pass the check. This would also cause an out-of-range table-lookup.&lt;br /&gt;
| Maybe ARM9 code execution&lt;br /&gt;
| [[3.0.0-5|3.0.0-5]]&lt;br /&gt;
|&lt;br /&gt;
| March 2015, originally 2012 for the first issue at least&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]], maybe others(?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Kernel9 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]] bit1 not set by Kernel9&lt;br /&gt;
| Old versions of Kernel9 never set bit1 of [[CONFIG Registers#CFG_SYSPROT9|CFG_SYSPROT9]]. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!). Since it&#039;s never locked, you can dump it once you get ARM9 code execution.&lt;br /&gt;
&lt;br /&gt;
From [[3.0.0-5|3.0.0-X]] this was fixed by setting the bit in Kernel9 after poking some registers in that region. On New3DS arm9loader sets this bit instead of Kernel9, which is exploitable through a hardware + software vulnerability (see arm9loaderhax / description).&lt;br /&gt;
&lt;br /&gt;
This flaw resurged when it gained a new practical use: retrieving the OTP data for a New3DS console in order to decrypt the key data used in arm9loader (see enhanced-arm9loaderhax / description). This was performed by downgrading to a vulnerable system version. By accounting for differences in CTR-NAND crypto (0x05 -&amp;gt; 0x04, see partition encryption types [[Flash_Filesystem#NAND_structure|here]]), it is possible to boot a New3DS using Old3DS firmware 1.0-2.X and an Old3DS [[NCSD#NCSD_header|NCSD Header]] to retrieve the required OTP data using this flaw.&lt;br /&gt;
| Dumping of the [[OTP Registers|OTP]] area&lt;br /&gt;
| [[3.0.0-5|3.0.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| February 2015&lt;br /&gt;
| [[User:Plutooo|plutoo]], Normmatt independently&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ARM11 software ==&lt;br /&gt;
=== Kernel11 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC]] table too small&lt;br /&gt;
|  The table of function pointers for SVC&#039;s only contains entries up to 0x7D, but the biggest allowed SVC for the table is 0x7F. Thus, executing SVC7E or SVC7F would make the SVC-handler read after the buffer, and interpret some ARM instructions as function pointers.&lt;br /&gt;
&lt;br /&gt;
However, this would require patching the kernel .text or modifying SVC-access-control. Even if you could get these to execute, they would still jump to memory that isn&#039;t mapped as executable.&lt;br /&gt;
| &lt;br /&gt;
|  None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2012&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
|  [[SVC|svcBackdoor (0x7B)]]&lt;br /&gt;
|  This backdoor allows executing SVC-mode code at the user-specified code-address. This is used by Process9, using this on the ARM11 (with NATIVE_FIRM) required patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]] (deleted)&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| Everyone&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]] &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|  slowhax&lt;br /&gt;
|  svcWaitSynchronizationN does not decrement the references to valid handles in an array before returning an error when it encounters an invalid handle. This allows one to (slowly) overflow the reference count for a handle object to zero.&lt;br /&gt;
| ARM11 kernel-mode code execution&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| 2016?&lt;br /&gt;
| nedwill, derrek, others?&lt;br /&gt;
|-&lt;br /&gt;
| [[Memory_layout#ARM11_Detailed_virtual_memory_map|0xEFF00000]] / 0xDFF00000 ARM11 kernel virtual-memory&lt;br /&gt;
| The ARM11 kernel-mode 0xEFF00000/0xDFF00000 virtual-memory(size 0x100000) is mapped to phys-mem 0x1FF00000(entire DSP-mem + entire AXIWRAM), with permissions RW-. This is used during ARM11 kernel startup for loading the FIRM-modules from the FIRM section located in DSP-mem, this never seems to be used after that, however. This is never unmapped either.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[11.2.0-35|11.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2.1&lt;br /&gt;
| Nintendo&#039;s fix for memchunkhax2 in [[10.4.0-29|10.4.0-X]] did not fix the GPU case: one may cause the requisite ToCToU race using gspwn, bypassing the new validation.&lt;br /&gt;
derrek&#039;s original 32c3 presentation for memchunkhax2 commented that a GPU-based attack was possible, but would be difficult.  However, memchunkhax2.1 showed that it was possible to do fairly reliably.&lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| derrek, aliaspider&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax2&lt;br /&gt;
| &lt;br /&gt;
| ARM11 kernel code execution&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]] (partially)&lt;br /&gt;
| [[10.4.0-29|10.4.0-X]]&lt;br /&gt;
|&lt;br /&gt;
| derrek&lt;br /&gt;
|-&lt;br /&gt;
| heaphax&lt;br /&gt;
| Can change the size of free memchunk structures stored in FCRAM using DMA, which leads to the ability to allocate memory chunks over already-allocated memory. This can be used in the SYSTEM region to allocate RW memory over any part of the NS system module, which is enough to take it over.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading) Code execution within any applet.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]], via the new [[Memory_Management#MemoryBlockHeader|memchunkhdr]] MAC which prevents modifying memchunkhdr data with DMA.&lt;br /&gt;
| [[11.0.0-33|11.0.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
| snshax&lt;br /&gt;
| Can force creation of Safe NS process into gspwn-able memory, allowing for takeover.&lt;br /&gt;
| Code execution with access to all of NS&#039;s privileges. (including downgrading)&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| [[10.1.0-27|10.1.0-X]]&lt;br /&gt;
| April 2015 ?&lt;br /&gt;
| smea&lt;br /&gt;
|-&lt;br /&gt;
|  AffinityMask/processorid validation&lt;br /&gt;
|  With [[10.0.0-27|10.0.0-X]] the following functions were updated: svcGetThreadAffinityMask, svcGetProcessAffinityMask, svcSetProcessAffinityMask, and svcCreateThread. The code changes for all but svcCreateThread are identical.&lt;br /&gt;
The original code with the first 3 did the following: &lt;br /&gt;
* if(u32_processorcount &amp;gt; ~0x80000001)return 0xe0e01bfd;&lt;br /&gt;
* if(s32_processorcount &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
The following code replaced the above:&lt;br /&gt;
* if(u32_processorcount &amp;gt;= &amp;lt;total_cores+1&amp;gt;)return 0xd8e007fd;&lt;br /&gt;
In theory the latter should catch everything that the former did, so it&#039;s unknown if this was really a security issue.&lt;br /&gt;
&lt;br /&gt;
The svcCreateThread changes with [[10.0.0-27|10.0.0-X]] definitely did fix a security issue.&lt;br /&gt;
* Original code: &amp;quot;if(s32_processorid &amp;gt; &amp;lt;total_cores&amp;gt;)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
* New code: &amp;quot;if(s32_processorid &amp;gt;= &amp;lt;total_cores&amp;gt; || s32_processorid &amp;lt;= -4)return 0xd8e007fd;&amp;quot;&lt;br /&gt;
This fixed an off-by-one issue: if one would use processorid=total_cores, which isn&#039;t actually a valid value, svcCreateThread would accept that value on &amp;lt;[[10.0.0-27|10.0.0-X]]. This results in data being written out-of-bounds(baseaddr = arrayaddr + entrysize*processorid), which has the following result:&lt;br /&gt;
* Old3DS: Useless kernel-mode crash due to accessing unmapped memory.&lt;br /&gt;
* New3DS: uncontrolled data write into a kernel-mode L1 MMU-table. This isn&#039;t really useful: the data can&#039;t be controlled, and the data which gets overwritten is all-zero anyway(this isn&#039;t anywhere near MMU L1 entries for actually mapped memory).&lt;br /&gt;
The previous version also allowed large negative s32_processorid values(negative processorid values are special values not actual procids), but it appears using values like that won&#039;t actually do anything(meaning no crash) besides the thread not running / thread not running for a while(besides triggering a kernelpanic with certain s32_processorid value(s)).&lt;br /&gt;
| Nothing useful&lt;br /&gt;
|  [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| svcCreateThread issue: May 31, 2015. The rest: September 8, 2015, via v9.6-&amp;gt;v10.0 ARM11-kernel code-diff.&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| memchunkhax&lt;br /&gt;
| The kernel originally did not validate the data stored in the FCRAM kernel heap [[Memchunkhdr|memchunk-headers]] for free-memory at all. Exploiting this requires raw R/W access to these memchunk-headers, like physical-memory access with gspwn.&lt;br /&gt;
&lt;br /&gt;
There are &#039;&#039;multiple&#039;&#039; ways to exploit this, but the end-result for most of these is the same: overwrite code in AXIWRAM via the 0xEFF00000/0xDFF00000 kernel virtual-memory mapping.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[9.3.0-21|9.3.0-X]] by checking that the memchunk(including size, next, and prev ptrs) is located within the currently used heap memory. The kernel may also check that the next/prev ptrs are valid compared to other memchunk-headers basically. When any of these checks fail, kernelpanic() is called.&lt;br /&gt;
| When combined with other flaws: ARM11-kernelmode code execution&lt;br /&gt;
| [[9.3.0-21|9.3.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| February 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Multiple [[KLinkedListNode|KLinkedListNode]] SlabHeap use after free bugs&lt;br /&gt;
| The ARM11-kernel did access the &#039;key&#039; field of [[KLinkedListNode|KLinkedListNode]] objects, which are located on the SlabHeap, after freeing them. Thus, triggering an allocation of a new [[KLinkedListNode|KLinkedListNode]] object at the right time could result in a type-confusion. Pseudo-code:&lt;br /&gt;
SlabHeap_free(KLinkedListNode);&lt;br /&gt;
KObject *obj = KLinkedListNode-&amp;gt;key;  // the object there might have changed!&lt;br /&gt;
This bug appeared all over the place.&lt;br /&gt;
| ARM11-kernelmode code exec maybe&lt;br /&gt;
| [[8.0.0-18|8.0.0-18]]&lt;br /&gt;
| &lt;br /&gt;
| April 2015&lt;br /&gt;
| [[User:Derrek|derrek]]&lt;br /&gt;
|-&lt;br /&gt;
| PXI [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11-kernel didn&#039;t check permissions for PXI input/output buffers for commands. Starting with [[6.0.0-11|6.0.0]] PXI input/output buffers must have RW permissions, otherwise kernelpanic is triggered.&lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11|6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcStartInterProcessDma]]&lt;br /&gt;
| For svcStartInterProcessDma, the kernel code had the following flaws:&lt;br /&gt;
&lt;br /&gt;
* Originally the ARM11-kernel read the input DmaConfig structure directly in kernel-mode(ldr(b/h) instructions), without checking whether the DmaConfig address is readable under userland. This was fixed by copying that structure to the SVC-mode stack, using the ldrbt instruction.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows for srcaddr+size and dstaddr+size are now checked(with [[6.0.0-11]]), which were not checked before.&lt;br /&gt;
&lt;br /&gt;
* The kernel now also checks whether the srcaddr/dstaddr (+size) is within userland memory (0x20000000), the kernel now (with [[6.0.0-11]]) returns an error when the address is beyond userland memory. Using an address &amp;gt;=0x20000000 would result in the kernel reading from the process L1 MMU table, beyond the memory allocated for that MMU table(for vaddr-&amp;gt;physaddr conversion). &lt;br /&gt;
| &lt;br /&gt;
| [[6.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| DmaConfig issue: unknown. The rest: 2014&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] independently&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] Parameter checks&lt;br /&gt;
| For svcControlMemory the parameter check had these two flaws:&lt;br /&gt;
&lt;br /&gt;
* The allowed range for addr0, addr1, size parameters depends on which MemoryOperation is being specified. The limitation for GSP heap was only checked if op=(u32)0x10003. By setting a random bit in op that has no meaning (like bit17?), op would instead be (u32)0x30003, and the range-check would be less strict and not accurate. However, the kernel doesn&#039;t actually use the input address for LINEAR memory-mapping at all besides the range-checks, so this isn&#039;t actually useful. This was fixed in the kernel by just checking for the LINEAR bit, instead of comparing the entire MemoryOperation value with 0x10003.&lt;br /&gt;
&lt;br /&gt;
* Integer overflows on (addr0+size) are now checked that previously weren&#039;t (this also applies to most other address checks elsewhere in the kernel).&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] request/response buffer overflow&lt;br /&gt;
| Originally the kernel did not check the word-values from the command-header. Starting with [[5.0.0-11]], the kernel will trigger a kernelpanic() when the total word-size of the entire command(including the cmd-header) is larger than 0x40-words (0x100-bytes). This allows overwriting threadlocalstorage+0x180 in the destination thread. However, since the data written there would be translate parameters (such as header-words + buffer addresses), exploiting this would likely be very difficult, if possible at all.&lt;br /&gt;
&lt;br /&gt;
If the two words at threadlocalstorage+0x180 could be overwritten with controlled data this way, one could then use a command with a buffer-header of &amp;lt;nowiki&amp;gt;((size&amp;lt;&amp;lt;14) | 2)&amp;lt;/nowiki&amp;gt; to write arbitrary memory to any RW userland memory in the destination process.&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|SVC stack allocation overflows]]&lt;br /&gt;
| &lt;br /&gt;
* Syscalls that allocate a variable-length array on stack, only checked bit31 before multiplying by 4/16 (when calculating how much memory to allocate). If a large integer was passed as input to one of these syscalls, an integer overflow would occur, and too little memory would have been allocated on stack resulting in a buffer overrun. &lt;br /&gt;
* The alignment (size+7)&amp;amp;~7 calculation before allocation was not checked for integer overflow.&lt;br /&gt;
&lt;br /&gt;
This might allow for ARM11 kernel code-execution.&lt;br /&gt;
&lt;br /&gt;
(Applies to svcSetResourceLimitValues, svcGetThreadList, svcGetProcessList, svcReplyAndReceive, svcWaitSynchronizationN.)&lt;br /&gt;
| &lt;br /&gt;
| [[5.0.0-11]]&lt;br /&gt;
| &lt;br /&gt;
| v4.1 FIRM -&amp;gt; v5.0 code diff&lt;br /&gt;
| [[User:Plutooo|plutoo]], [[User:Yellows8|Yellows8]] complementary&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcControlMemory]] MemoryOperation MAP memory-permissions&lt;br /&gt;
| svcControlMemory with MemoryOperation=MAP allows mapping the already-mapped process virtual-mem at addr1, to addr0. The lowest address permitted for addr1 is 0x00100000. Originally the ARM11 kernel didn&#039;t check memory permissions for addr1. Therefore .text as addr1 could be mapped elsewhere as RW- memory, which allowed ARM11 userland code-execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.1.0-8]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RPC_Command_Structure|Command]] input/output buffer permissions&lt;br /&gt;
| Originally the ARM11 kernel didn&#039;t check memory permissions for the input/output buffers for commands. Starting with [[4.0.0-7]] the ARM11 kernel will trigger a kernelpanic() if the input/output buffers don&#039;t have the required memory permissions. For example, this allowed a FSUSER file-read to .text, which therefore allowed ARM11-userland code execution.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SVC|svcReadProcessMemory/svcWriteProcessMemory memory]] permissions&lt;br /&gt;
| Originally the kernel only checked the first page(0x1000-bytes) of the src/dst buffers, for svcReadProcessMemory and svcWriteProcessMemory. There is no known retail processes which have access to these SVCs.&lt;br /&gt;
| &lt;br /&gt;
| [[4.0.0-7]]&lt;br /&gt;
| &lt;br /&gt;
| 2012?&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== [[FIRM]] Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in [[FIRM]] system version&lt;br /&gt;
!  Last [[FIRM]] system version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Services|&amp;quot;srv:pm&amp;quot;]] process registration&lt;br /&gt;
| Originally any process had access to the port &amp;quot;srv:pm&amp;quot;. The PID&#039;s used for the (un)registration commands are not checked either. This allowed any process to re-register itself with &amp;quot;srv:pm&amp;quot;, and therefore allowed the process to give itself access to any service, bypassing the exheader service-access-control list.&lt;br /&gt;
&lt;br /&gt;
This was fixed in [[7.0.0-13]]: starting with [[7.0.0-13]] &amp;quot;srv:pm&amp;quot; is now a service instead of a globally accessible port. Only processes with PID&#039;s less than 6 (in other words: fs, ldr, sm, pm, pxi modules) have access to it. With [[7.0.0-13]] there can only be one session for &amp;quot;srv:pm&amp;quot; open at a time(this is used by pm module), svcBreak will be executed if more sessions are opened by the processes which can access this.&lt;br /&gt;
&lt;br /&gt;
This flaw was needed for exploiting the &amp;lt;=v4.x Process9 PXI vulnerabilities from ARM11 userland ROP, since most applications don&#039;t have access to those service(s).&lt;br /&gt;
| Access to arbitrary services&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| &lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| FSDIR null-deref&lt;br /&gt;
| [[Filesystem_services|FS]]-module may crash in some cases when handling directory reading. The trigger seems to be due to using [[FSDir:Close]] without closing the dir-handle afterwards?(Perhaps this is caused by out-of-memory?) This seems to be useless since it&#039;s just a null-deref.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| May 19(?)-20, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone Sysmodules ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in system-module system-version&lt;br /&gt;
!  Last system-module system-version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Timeframe this was added to wiki&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| AM stack/.bss infoleak via [[AM:ReadTwlBackupInfo]]([[AM:ReadTwlBackupInfoEx|Ex]])&lt;br /&gt;
| After writing the output-info structure to stack, it then copies that structure to the output buffer ptr using the size from the command. The size is not checked. This could be used to read data from the AM-service-thread stack handling the command + .bss.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This was not tested on hardware.&#039;&#039;&#039;&lt;br /&gt;
| Stack/.bss reading&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27]](AM v9217)&lt;br /&gt;
| Roughly October 17, 2016&lt;br /&gt;
| October 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[MVD_Services|MVD]]: Stack buffer overflow with [[MVDSTD:SetupOutputBuffers]].&lt;br /&gt;
| The input total_entries is not validated when initially processing the input entry-list. This fixed-size input entry-list is copied to stack from the command request. The loop for processing this initializes a global table, the converted linearmem-&amp;gt;physaddrs used there are also copied to stack(0x8-bytes of physaddrs per entry).&lt;br /&gt;
&lt;br /&gt;
If total_entries is too large, MVD-sysmodule will crash due to reading unmapped memory following the stack(0x10000000). Afterwards if the out-of-bounds total_entries is smaller than that, it will crash due accessing address 0x0, hence this useless.&lt;br /&gt;
| MVD-sysmodule crash.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| April 22, 2016 (Tested on the 25th)&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]]: Using CTRSDK heap with UDS sharedmem from the user-process.&lt;br /&gt;
| See the HTTP-sysmodule section below.&lt;br /&gt;
&lt;br /&gt;
CTRSDK heap is used with the sharedmem from [[NWMUDS:InitializeWithVersion]]. Buffers are allocated/freed under this heap using [[NWMUDS:Bind]] and [[NWMUDS:Unbind]].&lt;br /&gt;
&lt;br /&gt;
Hence, overwriting sharedmem with gspwn then using [[NWMUDS:Unbind]] results in the usual controlled CTRSDK memchunk-header write, similar to HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This could be done by creating an UDS network, without any other nodes on the network.&lt;br /&gt;
&lt;br /&gt;
Besides CTRSDK memchunk-headers, there are no addresses stored under this sharedmem.&lt;br /&gt;
| ROP under NWM-module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20|9.0.0-X]]&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| April 16, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds memory access during spectator [[Download_Play|data-frame]] checksum calculation&lt;br /&gt;
| DLP doesn&#039;t validate the frame_size when receiving spectator data-frames at all, unlike non-spectator data-frames. The actual spectator data-frame parsing code doesn&#039;t use that field either. However, the data-frame checksum calculation code called during checksum verification does use the frame_size for loading the size of the framebuf.&lt;br /&gt;
&lt;br /&gt;
Hence, using a large frame_size like 0xFFFF will result in the checksum calculation code reading data out-of-bounds. This isn&#039;t really useful, you could trigger a remote local-WLAN DLP-sysmodule crash while a 3DS system is scanning for DLP networks(due to accessing unmapped memory), but that&#039;s about all(trying to infoleak with this likely isn&#039;t useful either).&lt;br /&gt;
| DLP-sysmodule crash, handled by dlplay system-application by a &amp;quot;connection interrupted&amp;quot; error eventually then a fatal-error via ErrDisp.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8, 2016 (Tested on the 10th)&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[DLP_Services|DLP]]: Out-of-bounds output data writing during spectator sysupdate titlelist [[Download_Play|data-frame]] handling&lt;br /&gt;
| The total_entries and out_entryindex fields for the titlelist DLP spectator data-frames are not validated. This is parsed during DLP network scanning. Hence, the specified titlelist data can be written out-of-bounds using the specified out_entryindex and total_entries. A crash will occur while reading the input data-frame titlelist if total_entries is larger than 0x27A, due to accessing unmapped memory.&lt;br /&gt;
&lt;br /&gt;
There&#039;s not much non-zero data to overwrite following the output buffer(located in sharedmem), any ptrs are located in sharedmem. Overwriting certain ptr(s) are only known to cause a crash when attempting to use the DLP-client shutdown service-command.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to exploit the above crash, since the linked-list code involves writes zeros(with a controlled start ptr).&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| April 8-9, 2016&lt;br /&gt;
| April 10, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[IR_Services|IR]]: Stack buffer overflow with custom hardware&lt;br /&gt;
| Originally IR sysmodule used the read value from the I2C-IR registers TXLVL and RXLVL without validating them at all. See [[10.6.0-31|here]] for the fix. This is the size used for reading the data-recv FIFO, etc. The output buffer for reading is located on the stack.&lt;br /&gt;
&lt;br /&gt;
This should be exploitable if one could successfully setup the custom hardware for this and if the entire intended sizes actually get read from I2C.&lt;br /&gt;
| ROP under IR sysmodule.&lt;br /&gt;
| [[10.6.0-31|10.6.0-31]]&lt;br /&gt;
| &lt;br /&gt;
| February 23, 2016 (Unknown if it was noticed before then)&lt;br /&gt;
| February 23, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HTTP_Services|HTTP]]: Using CTRSDK heap with sharedmem from the user-process.&lt;br /&gt;
| The data from httpcAddPostDataAscii and other commands is stored under a CTRSDK heap. That heap is the sharedmem specified by the user-process via the HTTPC Initialize command.&lt;br /&gt;
Normally this sharedmem isn&#039;t accessible to the user-process once the sysmodule maps it, hence using it is supposed to be &amp;quot;safe&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This isn&#039;t the case due to gspwn however. Since CTRSDK heap code is so insecure in general, one can use gspwn to locate the HTTPC sharedmem + read/write it, then trigger a mem-write under the sysmodule. This can then be used to get ROP going under HTTP-sysmodule.&lt;br /&gt;
&lt;br /&gt;
This is exploited by [https://github.com/yellows8/ctr-httpwn/ctr-httpwn ctr-httpwn].&lt;br /&gt;
| ROP under HTTP sysmdule.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]] (Latest sysmodule version as of [[10.7.0-32|10.7.0-32]])&lt;br /&gt;
| Late 2015&lt;br /&gt;
| March 22, 2016&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NIM_Services|NIM]]: Downloading old title-versions from eShop&lt;br /&gt;
| Multiple NIM service commands(such as [[NIMS:StartDownload]]) use a title-version value specified by the user-process, NIM does not validate that this input version matches the latest version available via SOAP. Therefore, when combined with AM(PXI) [[#Process9|title-downgrading]] via deleting the target eShop title with System Settings Data Management(if the title was already installed), this allows downloading+installing any title-version from eShop &#039;&#039;if&#039;&#039; it&#039;s still available from CDN.&lt;br /&gt;
The easiest way to exploit this is to just patch the eShop system-application code using these NIM commands(ideally the code which loads the title-version).&lt;br /&gt;
&lt;br /&gt;
Originally this was tested with a debugging-system via modded-FIRM, eventually smea implemented it in HANS for the 32c3 release.&lt;br /&gt;
| Downloading old title-versions from eShop&lt;br /&gt;
| None&lt;br /&gt;
| [[10.0.0-27|10.0.0-X]]&lt;br /&gt;
| October 24, 2015 (Unknown when exactly the first eShop title downgrade was actually tested, maybe November)&lt;br /&gt;
| January 7, 2016 (Same day Ironfall v1.0 was removed from CDN via the main-CXI files)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[SPI_Services|SPI]] service out-of-bounds write&lt;br /&gt;
| cmd1 has out-of-bounds write allowing overwrite of some static variables in .data.&lt;br /&gt;
| &lt;br /&gt;
| None&lt;br /&gt;
| [[9.5.0-22]]&lt;br /&gt;
| March 2015&lt;br /&gt;
| &lt;br /&gt;
| [[User:Plutooo|plutoo]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NFC_Services|NFC]] module service command buf-overflows&lt;br /&gt;
| NFC module copies data with certain commands, from command input buffers to stack without checking the size. These commands include the following, it&#039;s unknown if there&#039;s more commands with similar issues: &amp;quot;nfc:dev&amp;quot; &amp;lt;0x000C....&amp;gt; and &amp;quot;nfc:s&amp;quot; &amp;lt;0x0037....&amp;gt;.&lt;br /&gt;
Since both of these commands are stubbed in the Old3DS NFC module from the very first version(those just return an error), these issues only affect the New3DS NFC module.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known retail titles which have access to either of these services.&lt;br /&gt;
| ROP under NFC module.&lt;br /&gt;
| New3DS: None&lt;br /&gt;
| New3DS: [[9.5.0-22]]&lt;br /&gt;
| December 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[News_Services|NEWSS]] service command notificationID validation failure&lt;br /&gt;
| This module does not validate the input notificationID for &amp;lt;nowiki&amp;gt;&amp;quot;news:s&amp;quot;&amp;lt;/nowiki&amp;gt; service commands. This is an out-of-bounds array index bug. For example, [[NEWSS:SetNotificationHeader]] could be used to exploit news module: this copies the input data(size is properly checked) to: out = newsdb_savedata+0x10 + (someu32array[notificationID]*0x70).&lt;br /&gt;
| ROP under news module.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.7.0-25|9.7.0-X]]&lt;br /&gt;
| December 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData]] heap buffer overflow&lt;br /&gt;
| input_size = 0x1E * &amp;lt;value the u8 from input_[[NWM_Services|networkstruct]]+0x1D&amp;gt;. Then input_tag0 is copied to a heap buffer. When input_size is larger than 0xFA-bytes, it will then copy input_tag1 to &amp;lt;end_address_of_previous_outbuf&amp;gt;, with size=input_size-0xFA.&lt;br /&gt;
&lt;br /&gt;
This can be triggered by either using this command directly, or by boadcasting a wifi beacon which triggers it while a 3DS system running the target process is in range, when the process is scanning for hosts to connect to. Processes will only pass tag data to this command when the wlancommID and other thing(s) match the values for the process.&lt;br /&gt;
&lt;br /&gt;
There&#039;s no known way to actually exploit this for getting ROP under NWM-module, at the time of originally adding this to the wiki. This is because the data which gets copied out-of-bounds *and* actually causes crash(es), can&#039;t be controlled it seems(with just broadcasting a beacon at least). It&#039;s unknown whether this could be exploited from just using NWMUDS service-cmd(s) directly.&lt;br /&gt;
| Without any actual way to exploit this: NWM-module DoS, resulting in process termination(process crash). This breaks *everything* involving wifi comms, a reboot is required to recover from this.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| ~September 23, 2014(see the [[NWMUDS:DecryptBeaconData]] page history)&lt;br /&gt;
| August 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[HID_Services|HID]] module shared-mem&lt;br /&gt;
| HID module does not validate the index values in [[HID_Shared_Memory|sharedmem]](just changes index to 0 when index == maxval when updating), therefore large values will result in HID module writing HID data to arbitrary addresses.&lt;br /&gt;
| ROP under HID module, but this is *very* unlikely to be exploitable since the data written is HID data.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| 2014?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| gspwn&lt;br /&gt;
| GSP module does not validate addresses given to the GPU. This allows a user-mode application/applet to read/write to a large part of physical FCRAM using GPU DMA. From this, you can overwrite the .text segment of the application you&#039;re running under, and gain real code-execution from a ROP-chain. Normally applets&#039; .text([[Home Menu]], [[Internet Browser]], etc) is located beyond the area accessible by the GPU, except for [[RO_Services|CROs]] used by applets([[Internet Browser]] for example).&lt;br /&gt;
&lt;br /&gt;
FCRAM is gpu-accessible up to physaddr 0x26800000 on Old3DS, and 0x2DC00000 on New3DS. This is BASE_memregion_start(aka SYSTEM_memregion_end)-0x400000 with the default memory-layout on Old3DS/New3DS.&lt;br /&gt;
| User-mode code execution.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
| Early 2014&lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Yellows8|Yellows8]]/others before then&lt;br /&gt;
|-&lt;br /&gt;
| rohax&lt;br /&gt;
| Using gspwn, it is possible to overwrite a loaded [[CRO0]]/[[CRR0]] after its RSA-signature has been validated. Badly validated [[CRO0]] header leads to arbitrary read/write of memory in the ro-process. This gives code-execution in the ro module, who has access to [[SVC|syscalls]] 0x70-0x72, 0x7D.&lt;br /&gt;
&lt;br /&gt;
This was fixed after [[ninjhax]] release by adding checks on [[CRO0]]-based pointers before writing to them.&lt;br /&gt;
| Memory-mapping syscalls.&lt;br /&gt;
| [[9.3.0-21]]&lt;br /&gt;
| [[9.4.0-21]]&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| smea, [[User:Plutooo|plutoo]] joint effort&lt;br /&gt;
|-&lt;br /&gt;
| Region free&lt;br /&gt;
| Only [[Home Menu]] itself checks gamecards&#039; region when launching them. Therefore, any application launch that is done directly with [[NS]] without signaling Home Menu to launch the app, will result in region checks being bypassed.&lt;br /&gt;
This essentially means launching the gamecard with the [[NS_and_APT_Services|&amp;quot;ns:s&amp;quot;]] service. The main way to exploit this is to trigger a FIRM launch with an application specified, either with a normal FIRM launch or a hardware [[NSS:RebootSystem|reboot]].&lt;br /&gt;
| Launching gamecards from any region + bypassing Home Menu gamecard-sysupdate installation&lt;br /&gt;
| None&lt;br /&gt;
| Last tested with [[10.1.0-27|10.1.0-X]].&lt;br /&gt;
| June(?) 2014&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|NWM]] service-cmd state null-ptr deref&lt;br /&gt;
| The NWMUDS service command code loads a ptr from .data, adds an offset to that, then passes that as the state address for the actual command-handler function. The value of the ptr loaded from .data is not checked, therefore this will cause crashes due to that being 0x0 when NWMUDS was not properly initialized.&lt;br /&gt;
It&#039;s unknown whether any NWM services besides NWMUDS have this issue.&lt;br /&gt;
| This is rather useless since it&#039;s only a crash caused by a state ptr based at 0x0.&lt;br /&gt;
| None&lt;br /&gt;
| [[9.0.0-20]]&lt;br /&gt;
| 2013?&lt;br /&gt;
| &lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== General/CTRSDK ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Successful exploitation result&lt;br /&gt;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[NWM_Services|UDS]] beacon additional-data buffer overflow&lt;br /&gt;
| Originally CTRSDK did not validate the UDS additional-data size before using that size to copy the additional-data to a [[NWM_Services|networkstruct]]. This was eventually fixed.&lt;br /&gt;
This was discovered while doing code RE with an old dlp-module version. It&#039;s unknown in what specific CTRSDK version this was fixed, or even what system-version updated titles with a fixed version.&lt;br /&gt;
&lt;br /&gt;
It&#039;s unknown if there&#039;s any titles using a vulnerable CTRSDK version which are also exploitable with this(dlp module can&#039;t be exploited with this).&lt;br /&gt;
&lt;br /&gt;
The maximum number of bytes that can be written beyond the end of the outbuf is 0x37-bytes, with additionaldata_size=0xFF.&lt;br /&gt;
| Perhaps ROP, very difficult if possible with anything at all&lt;br /&gt;
| ?&lt;br /&gt;
| &lt;br /&gt;
| September(?) 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=KSession&amp;diff=18442</id>
		<title>KSession</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=KSession&amp;diff=18442"/>
		<updated>2016-10-20T20:23:44Z</updated>

		<summary type="html">&lt;p&gt;SciresM: maybe resolve some drama&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Kernel objects]]&lt;br /&gt;
class [[KSession]] extends [[KAutoObject]];&lt;br /&gt;
&lt;br /&gt;
Size : 0x4C bytes&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
! Type&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| Pointer to vtable&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| Reference count&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| [[KThread]]*&lt;br /&gt;
| X ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| [[KThread]]*&lt;br /&gt;
| Y ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| [[KThread]]*&lt;br /&gt;
| Z ?&lt;br /&gt;
|}&lt;br /&gt;
It seems X=Y=Z. X, Y and Z can be NULL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Structure for [[7.0.0-13]] NATIVE_FIRM upward:&lt;br /&gt;
&lt;br /&gt;
Size : 0x4C bytes ([[KAutoObject]], [[KServerSession]], [[KClientSession]], sequentially):&lt;br /&gt;
&lt;br /&gt;
[[KAutoObject]]:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
! Type&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| Pointer to vtable&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| Reference count&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[KServerSession]]:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
! Type&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| Pointer to vtable&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| Reference count&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| Node count for threads&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| [[KLinkedListNode]]*&lt;br /&gt;
| Pointer to first KLinkedListNode in the list of threads that sync with this object&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| [[KLinkedListNode]]*&lt;br /&gt;
| Pointer to last KLinkedListNode in the list of threads that sync with this object&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| KSession* &lt;br /&gt;
| Pointer to parent session&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| [[KThread]]* &lt;br /&gt;
| Last stolen KThread during sync request- current thread when KServerSession code is running during svc - noted in KThread+0xA8 as well&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| [[KThread]]*&lt;br /&gt;
| First stolen KThread during sync request&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| [[KThread]]*&lt;br /&gt;
| KThread that originated the session&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
[[KClientSession]]:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
! Type&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| Pointer to vtable&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| Reference count&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32 &lt;br /&gt;
| KLinkedListNode count for object&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| KLinkedListNode*&lt;br /&gt;
| Pointer to first KLinkedListNode in list of KThreads using this client session&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| KLinkedListNode*&lt;br /&gt;
| Pointer to last KLinkedListNode in list of KThreads using this client session&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| KSession* &lt;br /&gt;
| Pointer to parent session&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| u32 &lt;br /&gt;
| Session status&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| KClientPort* &lt;br /&gt;
| Pointer to associated client port inside parent KPort&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=11.1.0-34&amp;diff=18146</id>
		<title>11.1.0-34</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=11.1.0-34&amp;diff=18146"/>
		<updated>2016-09-13T04:51:49Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Process9 changes: nothing but minversions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Old3DS+New3DS 11.1.0-34 system update was released on September 13, 2016. This Old3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN. This New3DS update was released for the following regions: USA, EUR, JPN, CHN, KOR, and TWN.&lt;br /&gt;
&lt;br /&gt;
Security flaws fixed: &amp;lt;fill this in manually later, see the updatedetails page from the ninupdates-report page(s) once available for now&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Change-log==&lt;br /&gt;
[http://en-americas-support.nintendo.com/app/answers/detail/a_id/667/p/430/c/267 Official] USA change-log:&lt;br /&gt;
* Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience&lt;br /&gt;
&lt;br /&gt;
==System Titles==&lt;br /&gt;
The updated titles were Home Menu, Internet Browser, NGWord bad word list CFA, Nintendo Zone hotspot list CFA, NVer, CVer, DSP, friends, NS and NATIVE_FIRM.&lt;br /&gt;
&amp;lt;fill this in (manually) later&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===NATIVE_FIRM===&lt;br /&gt;
&amp;lt;fill this in (manually) later&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Process9====&lt;br /&gt;
No changes to code at all.&lt;br /&gt;
&lt;br /&gt;
Only differences are in the minversion list, which updated the minimum versions for Home Menu, Internet Browser, DSP, friends, NS, and NATIVE_FIRM to latest.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
System update report(s):&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=09-13-16_12-05-19&amp;amp;sys=ctr]&lt;br /&gt;
* [https://yls8.mtheall.com/ninupdates/reports.php?date=09-13-16_12-05-28&amp;amp;sys=ktr]&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Hardware&amp;diff=18015</id>
		<title>Hardware</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Hardware&amp;diff=18015"/>
		<updated>2016-09-02T00:58:04Z</updated>

		<summary type="html">&lt;p&gt;SciresM: /* Auxiliary Microcontroller (MCU) */ Add ISA/Hardware register documentation resources&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists and describes the hardware found inside the Nintendo 3DS. Many of these parts are custom made and are expanded upon here or in other pages.&lt;br /&gt;
&lt;br /&gt;
== Common hardware ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ARM11 Processor Core || Old3DS: [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/index.html ARM11 2x MPCore &amp;amp; 2x VFPv2 Co-Processor] 268MHz(~268123480 Hz).&lt;br /&gt;
&lt;br /&gt;
New3DS: 4x MPCore, 4x VFPv2, able to run up to 804MHz (see below). It also has an optional 2MB L2 cache.&lt;br /&gt;
|-&lt;br /&gt;
| ARM9 Processor Core || [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0201d/index.html ARM946] 134MHz(~134058675 Hz),&lt;br /&gt;
|-&lt;br /&gt;
| GPU || [http://en.wikipedia.org/wiki/PICA200 DMP PICA] 268MHz,&lt;br /&gt;
|-&lt;br /&gt;
| VRAM || 6 MB within SoC.&lt;br /&gt;
|-&lt;br /&gt;
| Top screen || 800x240, with only 400 usable pixels per eye per line.&lt;br /&gt;
|-&lt;br /&gt;
| Bottom screen || 320x240, with resistive touch overlay.&lt;br /&gt;
|-&lt;br /&gt;
| DSP || [https://twitter.com/CEVADSP/status/177172880918986752 CEVA TeakLite]. 134Mhz. 24ch 32728Hz sampling rates.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The above clock-rates were calculated by calling svcGetSystemTick in sets of 5(call it, execute svcSleepThread for 1s, then call it again), then the average of those were calculated. The clock-rate listed above applies for *all* 4 New3DS MPCores. This is referring to the &amp;quot;~268123480 Hz&amp;quot; clock-rate.&lt;br /&gt;
&lt;br /&gt;
New3DS exclusives are able to clock the CPU at 804MHz, but this appears to be limited to the currently running application/app cores. Timed by running svcGetSystemTick on either side of a long idle loop to stay in the current process context. svcSleepThread + svcGetSystemTick implies a tick counter running at 268MHz in this mode.&lt;br /&gt;
&lt;br /&gt;
On New3DS: when Home Menu is active, the system runs at 804MHz. For everything else, it&#039;s 268MHz, except when the app(let) has the required flag set. See [[NCCH/Extended_Header|here]] and [[PDN_Registers|here]] for details, regarding clock-rate and cache.&lt;br /&gt;
&lt;br /&gt;
For New3DS-only there are multiple clock-rate multiplier values available in [[PDN_Registers|hardware]], but since the relevant code is only implemented in the New3DS ARM11-kernel, the only non-normal clock-rate available with official kernel code is 3x.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! 3DS !! 3DSXL !! 2DS !! N3DS !! N3DSXL&lt;br /&gt;
|-&lt;br /&gt;
| SoC || CPU CTR (1048 0H)&lt;br /&gt;
CPU CTR (1214 32)&lt;br /&gt;
|| CPU CTR A (1226 60)&lt;br /&gt;
CPU CTR (1037 21)&lt;br /&gt;
|| CPU CTR B (??) || CPU LGR A (1444 86) || CPU LGR A (1446 17)&lt;br /&gt;
|-&lt;br /&gt;
| FCRAM || [http://www.fujitsu.com/downloads/MICRO/fma/pdf/MB81EDS516545_e511463.pdf 2x64MB Fujitsu MB82M8080-07L] || Fujitsu MB82DBS16641 || Fujitsu MB82DBS1664 || ?? || Fujitsu MB82MK9A9A&lt;br /&gt;
|-&lt;br /&gt;
| Top Screen ||  3.53 in, 3D || 4.88 in, 3D || 3.53 in(?) cropped from a single panel ||  3.88 in, 3D || 4.88 in, 3D&lt;br /&gt;
|-&lt;br /&gt;
| Bottom Screen ||  3.00 in || 4.18 in || 3.00 in(?) cropped from a single panel || 3.33 in || 4.18 in&lt;br /&gt;
|-&lt;br /&gt;
| Storage ||colspan=&amp;quot;3&amp;quot;| Toshiba THGBM2G3P1FBAI8 1GB ||colspan=&amp;quot;2&amp;quot;| Samsung KLM4G1YEQC 4GB (in 1.3GiB SLC mode)&lt;br /&gt;
Toshiba THGBMBG4P1KBAIT 2GB (MLC, approx. 1.8GiB usable)&lt;br /&gt;
|-&lt;br /&gt;
| Audio Codec || TI PAIC3010B 0AA37DW || ?? || ?? || TI AIC3010B 39C4ETW  || TI AIC3010D 48C01JW&lt;br /&gt;
|-&lt;br /&gt;
| Gyroscope || [http://dl-web.dropbox.com/u/20520664/references/PS-ITG-3200-00-01.4.pdf Invensense ITG-3270 MEMS Gyroscope] || ?? || ?? || ?? || ??&lt;br /&gt;
|-&lt;br /&gt;
| Accelerometer || ST Micro 2048 33DH X1MAQ Accelerometer Model LIS331DH || ?? || ?? || ?? || ??&lt;br /&gt;
|-&lt;br /&gt;
| Wifi || Atheros AR6014 || ?? || ?? || ?? || Atheros AR6014G-AL1C&lt;br /&gt;
|-&lt;br /&gt;
| Infrared IC || NXP S750 0803 TSD031C || ?? || ?? || ?? || NXP S750 1603 TSD438C&lt;br /&gt;
|-&lt;br /&gt;
| Custom Microcontroller || Renesas UC CTR || ?? || Renesas UC CTR 324KM47 KG10  || Renesas UC KTR || Renesas UC KTR 442KM13 TK14&lt;br /&gt;
|-&lt;br /&gt;
| PMIC? || TI 93045A4 OAAH86W || ?? || ?? || TI 93045A4 38A6TYW G2 || TI 93045A4 49AF3NW G2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* [11] Official Documentation&lt;br /&gt;
&lt;br /&gt;
* [5],[10] According to iFixit.com ([http://www.ifixit.com/Teardown/Nintendo-3DS-Teardown/5029/1#s22696 source]):&lt;br /&gt;
&lt;br /&gt;
* Datasheet for memory is for a chip in the same series, it has less memory than the one inside the 3DS (128mbits vs 512mbits).&lt;br /&gt;
&lt;br /&gt;
* There is a trove of data on the FCC website at [https://fjallfoss.fcc.gov/oetcf/eas/reports/ViewExhibitReport.cfm?mode=Exhibits&amp;amp;RequestTimeout=500&amp;amp;calledFromFrame=N&amp;amp;application_id=462292&amp;amp;fcc_id=%27EW4DWMW028%27].&lt;br /&gt;
&lt;br /&gt;
* [12] This IC is somewhat similar to [http://www.alldatasheet.net/datasheet-pdf/pdf/347838/NXP/SC16IS750IBS.html this].&lt;br /&gt;
&lt;br /&gt;
== FCRAM ==&lt;br /&gt;
&lt;br /&gt;
There is one FCRAM (Fast Cycle RAM) IC in the 3DS, produced by Fujitsu and branded as MB82M8080-07L. The Fujitsu MB82M8080-07L chip internally contains 2 dies, where each die is branded MB81EDS516545 and MB82DBS08645.&lt;br /&gt;
&lt;br /&gt;
The MB81EDS516545 die is a CMOS Fast Cycle Random Access Memory (FCRAM) with Low Power Double Data Rate (LPDDR) SDRAM Interface containing 512MBit storage accessible in a 64-bit format. The MB81EDS516545 is suited for consumer applications requiring high data bandwidth with low power consumption.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SoC ==&lt;br /&gt;
&lt;br /&gt;
The 3DS has much of it&#039;s internals housed in a SoC (System on Chip) just like it&#039;s predecessors. This is done to reduce build costs, cut down on power consumption, as well as make the PCB layout less complex and make the system harder to tamper with. The SoC, branded as the Nintendo 1048 0H, contains the CPU, GPU, DSP and VRAM.&lt;br /&gt;
&lt;br /&gt;
According to official documents, the CPU used is a dual-core ARM11 CPU, clocked at 268MHz. One core is dedicated to system software, while the other is used for application programming, each known as the syscore and appcore, respectively.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GPU ==&lt;br /&gt;
&lt;br /&gt;
Designed by Digital Media Professionals Inc. (DMP) and codenamed PICA200, 268Mhz.&lt;br /&gt;
&lt;br /&gt;
Block diagram of an ULTRAY2000 based architecture PICA200:&lt;br /&gt;
&lt;br /&gt;
[[File:Pica200BlockDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
PICA200 is compatible with OpenGL ES 1.1. It furthermore provides unique functionality for:&lt;br /&gt;
* Per-fragment lighting (&amp;quot;Lighting Maestro&amp;quot;)&lt;br /&gt;
* Hard- and soft-shadowing (&amp;quot;Shadow Maestro&amp;quot;)&lt;br /&gt;
* Polygon subdivision (&amp;quot;Figure Maestro&amp;quot;)&lt;br /&gt;
* Bump mapping and procedural textures (&amp;quot;Mapping Maestro&amp;quot;)&lt;br /&gt;
* Rendering of gaseous objects (&amp;quot;Particle Maestro&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Some parts of the extended functionality are provided in hardware by an extended geometry pipeline. Most importantly, PICA200 has three programmable vertex processors. There is furthermore a unit called [[GPU/Primitive_Engine|Primitive Engine]], which is a geometry shader unit (using the same instruction set as vertex shaders) with support for variable-size primitives. The Primitive Engine functionality may be disabled, and the geometry shader unit then acts as a fourth vertex processor. See [[Shader_Instruction_Set]] for more information on the shader instruction set.&lt;br /&gt;
&lt;br /&gt;
[[GPU/Fragment Lighting|Fragment lighting]] is implemented as an optional pipeline step during pixel processing. It&#039;s implemented by having the vertex shader output an additional attribute describing the transformation (represented by a quaternion) to surface-local space. This per-vertex quaternion can then be interpolated across screen space to calculate dot products relevant for lighting (e.g. light vector dot normal vector). To provide support for advanced lighting models, these dot products are used as indices into programmable lookup tables. With this setup, PICA200 in particular supports the shading models Blinn-Phong, Cook-Terrance, Ward, and microfacet-based BRDF-models.&lt;br /&gt;
&lt;br /&gt;
PICA200 supports four texture units, the fourth of which is used exclusively for [[GPU/Procedural Texture Generation|procedural texture generation]].&lt;br /&gt;
&lt;br /&gt;
== SDIO controller ==&lt;br /&gt;
&lt;br /&gt;
Nintendo recommends SD cards up to 32 GB however the internal SDIO controller seems to support SD cards up to 2.19 Terabyte (32-bit sector number). It&#039;s unknown if it really can handle that much. 128 GB was tested and works fine however it causes a major slowdown of the system especially at boot.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
=== Front ===&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Front.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
[http://guide-images.ifixit.net/igi/ishJaSCOwLkvbLYK High Resolution]&lt;br /&gt;
&lt;br /&gt;
=== Back ===&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_Back.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://guide-images.ifixit.net/igi/n1CKAdbPrHyNPNuW High Resolution]&lt;br /&gt;
&lt;br /&gt;
=== NAND pinout ===&lt;br /&gt;
&lt;br /&gt;
NAND dumping has been successful, but the image is encrypted.&lt;br /&gt;
&lt;br /&gt;
==== Normal model ====&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_NAND_pinout.png]]&lt;br /&gt;
&lt;br /&gt;
==== XL model ====&lt;br /&gt;
&lt;br /&gt;
[[Image:CTR_NAND_pinout_XL.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
==== 2DS ====&lt;br /&gt;
&lt;br /&gt;
[[Image:2DSeMMC.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
==== New 3DS ====&lt;br /&gt;
&lt;br /&gt;
[[Image:N3DSeMMC.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== New 3DS XL ====&lt;br /&gt;
&lt;br /&gt;
[[Image:N3DSXLeMMC.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== WiFi dongle pinout ===&lt;br /&gt;
[[Image:CTR_WiFiDongle_pinout.png|600px]]&lt;br /&gt;
&lt;br /&gt;
SDIO interface is colored red: &lt;br /&gt;
* CLK&lt;br /&gt;
* CMD&lt;br /&gt;
* D0, D1, D2, D3&lt;br /&gt;
&lt;br /&gt;
This is the interface for the &#039;NEW&#039; WiFi module (based on Atheros AR6002) first included in DSi.&lt;br /&gt;
&lt;br /&gt;
The proprietary and by now ancient DS-mode WiFi is colored yellow, pins are unknown.&lt;br /&gt;
&lt;br /&gt;
I2C eeprom is colored blue:&lt;br /&gt;
* SCL&lt;br /&gt;
* SDA&lt;br /&gt;
&lt;br /&gt;
SPI Flash is colored purple:&lt;br /&gt;
* CLK&lt;br /&gt;
* CS#&lt;br /&gt;
* SI&lt;br /&gt;
* SO&lt;br /&gt;
* WP#&lt;br /&gt;
* NC&lt;br /&gt;
&lt;br /&gt;
=== Auxiliary Microcontroller (MCU) ===&lt;br /&gt;
[[Image:CTR_UC.png|600px]]&lt;br /&gt;
&lt;br /&gt;
Monitors HOME button, WiFi switch, 3D slider, volume control slider.&lt;br /&gt;
Controls LEDs, various power supplies.&lt;br /&gt;
&lt;br /&gt;
Devices attached to I2C bus:&lt;br /&gt;
* UC (master?)&lt;br /&gt;
* Accelerometer (slave address 0x18)&lt;br /&gt;
* SoC (master? slave?)&lt;br /&gt;
&lt;br /&gt;
The MCU uses the [http://mcs.uwsuper.edu/sb/327/Resources/RL78.pdf RL78 ISA].&lt;br /&gt;
&lt;br /&gt;
The MCU uses some custom Special Function Registers, but documentation for much of the hardware protocol/general SFRs can be found [http://courses.ee.sun.ac.za/Computer_Systems_245/Dokumentasie/RL78%20hardware%20manual%20(registers).pdf here].&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Config_Savegame&amp;diff=17985</id>
		<title>Config Savegame</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Config_Savegame&amp;diff=17985"/>
		<updated>2016-08-27T04:18:32Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Parental Restrictions PIN/Answer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the format of the [[Config_Services|Cfg]] [[System_SaveData|NAND]] savegame. These blocks can be accessed with the Cfg service commands.&lt;br /&gt;
&lt;br /&gt;
==Structure of save-file &amp;quot;/config&amp;quot;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x2&lt;br /&gt;
| Total entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x2&lt;br /&gt;
| Data entries offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4558&lt;br /&gt;
| Block entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x455C&lt;br /&gt;
| &lt;br /&gt;
| Data for the entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The filesize for this /config file is 0x8000-bytes.&lt;br /&gt;
&lt;br /&gt;
==Configuration block entry ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| BlkID&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to the data for this block when size is &amp;gt;4, otherwise this word is the data for this block&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x2&lt;br /&gt;
| Size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| Flags&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Configuration blocks==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  BlkID&lt;br /&gt;
!  Size&lt;br /&gt;
!  Flags&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000000&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
| Config savegame version?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00030001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xE&lt;br /&gt;
| User time offset (read by CECD)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040000&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040001&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040002&lt;br /&gt;
| 0x12&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040003&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050001&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050002&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050003&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050005&lt;br /&gt;
| 0x20&lt;br /&gt;
|?&lt;br /&gt;
| Stereo display settings&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050006&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00070001&lt;br /&gt;
| 0x1&lt;br /&gt;
|?&lt;br /&gt;
| Sound output mode (mono/stereo/surround)?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080000&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080001&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080002&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x00090000&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x2?&lt;br /&gt;
| This contains a u64 ID, used by processes using [[NWMUDS:InitializeWithVersion]]. The first word is the same as [[CfgS:GetLocalFriendCodeSeed|LocalFriendCodeSeed]], while the latter is a separate word.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00090001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xE&lt;br /&gt;
| This console-unique u64 used by [[Cfg:GenHashConsoleUnique|GenHashConsoleUnique]] is generated with the LocalFriendCodeSeed and with random data&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0000&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0xE&lt;br /&gt;
| Username&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0001&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0xE&lt;br /&gt;
| Birthday (u8 month, u8 day)&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0002&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0xA&lt;br /&gt;
| Language&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8&lt;br /&gt;
| CountryInfo&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0001&lt;br /&gt;
| 0x800&lt;br /&gt;
| 0x2?&lt;br /&gt;
| Country name in UTF-16, every 0x80-bytes is an entry for each language, in the order of the Language table below (not all entries are set)&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0002&lt;br /&gt;
| 0x800&lt;br /&gt;
| 0x2?&lt;br /&gt;
| State name in UTF-16, every 0x80-bytes is an entry for each language&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0003&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xE&lt;br /&gt;
| Pair of 16-bit values, meaning unknown but related to address (ZIP code?)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0x000C0000&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x8&lt;br /&gt;
| Restricted photo exchange data, and other info (includes a mirror of Parental Restrictions PIN/Secret Answer)&lt;br /&gt;
|-&lt;br /&gt;
| 0x000C0001&lt;br /&gt;
| 0x14&lt;br /&gt;
|?&lt;br /&gt;
| Same as above?&lt;br /&gt;
|-&lt;br /&gt;
| 0x000D0000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| u16 at offset 0x0: [[SMDH#EULA_Version|EULA Version]] which was agreed to.&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0000&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown, used by [[NS]] on dev-units for [[SVC|svcKernelSetState]], where Type is 6. During NS startup on debug-units, NS compares the u32 from +8 in this config-block with the [[Configuration_Memory#APPMEMTYPE|APPMEMTYPE]]. When those don&#039;t match NS starts a FIRM-launch (with the same FIRM titleID as the currently running one) to boot into a FIRM with the APPMEMTYPE value from this config-block&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0004&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8?&lt;br /&gt;
| The first u8 is the System-Model [[Cfg:GetSystemModel|value]], the last 3-bytes are unknown&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0005&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| The first u8 indicates whether network updates are enabled. (However, NIM only checks this flag with developer UNITINFO).&lt;br /&gt;
|-&lt;br /&gt;
| 0x00100001&lt;br /&gt;
| 0x94&lt;br /&gt;
| 0xC&lt;br /&gt;
| Stores Parental Restrictions PIN/Secret Answer and other info&lt;br /&gt;
|-&lt;br /&gt;
| 0x00110000&lt;br /&gt;
| 0x4&lt;br /&gt;
|?&lt;br /&gt;
| The low u16 indicates whether the system setup is required, such as when the system is booted for the first time or after doing a [[System Settings|System Format]]: 0 = setup required, non-zero = no setup required&lt;br /&gt;
|-&lt;br /&gt;
| 0x00110001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xA?&lt;br /&gt;
| TitleID of the menu to launch, used by [[NS]] on dev units (this block can be edited on dev units with [[3DS Development Unit Software#Config|Config]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x00120000&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00130000&lt;br /&gt;
| 0x4&lt;br /&gt;
|?&lt;br /&gt;
| If response is 0x100 then debug mode is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00160000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown, first byte is used by config service-cmd [[Config_Services|0x00070040]]. (Unknown whether the last 3-bytes are used)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00190000&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown. NFC-module checks for value1/non-value1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The developer unit TID block only exists on developer units.&lt;br /&gt;
&lt;br /&gt;
===Stereo Display Settings===&lt;br /&gt;
All values are hard-coded in cfg module.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| 62.0f&lt;br /&gt;
|assumed pupillary distance in mm?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| 289.0f&lt;br /&gt;
|assumed distance in mm between player&#039;s eyes and upper screen?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| 76.80f&lt;br /&gt;
|width in mm of (old) 3DS upper screen (doesn&#039;t vary for different models?)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| 46.08f&lt;br /&gt;
|height in mm of (old) 3DS upper screen (doesn&#039;t vary for different models?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| 10.0f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| 5.0f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 4&lt;br /&gt;
| 55.58f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 4&lt;br /&gt;
| 21.57f&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Languages===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  ID&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| JP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| EN&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| FR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| DE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| IT&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| ES&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| ZH&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| KO&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| NL&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| PT&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| RU&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| TW&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===CountryInfo===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Country code, same as DSi/Wii country codes. Value 0xFF is invalid.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===0x000A0000 Block===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0-0x13&lt;br /&gt;
| UTF-16 username, with no NULL-terminator.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14-17&lt;br /&gt;
| Usually zero?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18-0x1B&lt;br /&gt;
| u32 NGWord version the username was last checked with. If this value is less than the u32 stored in the NGWord CFA &amp;quot;romfs:/version.dat&amp;quot;, the system then checks the username string with the bad-word list CFA again, then updates this field with the value from the CFA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===LCD display config===&lt;br /&gt;
There seems to be some sort of LCD display configuration stored in this cfg. When using the cfg-save from an Old3DS on a New3DS without formatting the cfg first, the bottom-screen display is somewhat off(which is fixed by formatting the cfg-save).&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Config_Savegame&amp;diff=17984</id>
		<title>Config Savegame</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Config_Savegame&amp;diff=17984"/>
		<updated>2016-08-27T03:38:34Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Add block 0xF0005&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the format of the [[Config_Services|Cfg]] [[System_SaveData|NAND]] savegame. These blocks can be accessed with the Cfg service commands.&lt;br /&gt;
&lt;br /&gt;
==Structure of save-file &amp;quot;/config&amp;quot;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x2&lt;br /&gt;
| Total entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x2&lt;br /&gt;
| Data entries offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4558&lt;br /&gt;
| Block entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x455C&lt;br /&gt;
| &lt;br /&gt;
| Data for the entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The filesize for this /config file is 0x8000-bytes.&lt;br /&gt;
&lt;br /&gt;
==Configuration block entry ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| BlkID&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to the data for this block when size is &amp;gt;4, otherwise this word is the data for this block&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x2&lt;br /&gt;
| Size&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x2&lt;br /&gt;
| Flags&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Configuration blocks==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  BlkID&lt;br /&gt;
!  Size&lt;br /&gt;
!  Flags&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00000000&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
| Config savegame version?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00030001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xE&lt;br /&gt;
| User time offset (read by CECD)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040000&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040001&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040002&lt;br /&gt;
| 0x12&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040003&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050001&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050002&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050003&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by GSP)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050005&lt;br /&gt;
| 0x20&lt;br /&gt;
|?&lt;br /&gt;
| Stereo display settings&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050006&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00070001&lt;br /&gt;
| 0x1&lt;br /&gt;
|?&lt;br /&gt;
| Sound output mode (mono/stereo/surround)?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080000&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080001&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080002&lt;br /&gt;
| 0xC00&lt;br /&gt;
| 0x2?&lt;br /&gt;
| WiFi configuration slot 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x00090000&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x2?&lt;br /&gt;
| This contains a u64 ID, used by processes using [[NWMUDS:InitializeWithVersion]]. The first word is the same as [[CfgS:GetLocalFriendCodeSeed|LocalFriendCodeSeed]], while the latter is a separate word.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00090001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xE&lt;br /&gt;
| This console-unique u64 used by [[Cfg:GenHashConsoleUnique|GenHashConsoleUnique]] is generated with the LocalFriendCodeSeed and with random data&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0000&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0xE&lt;br /&gt;
| Username&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0001&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0xE&lt;br /&gt;
| Birthday (u8 month, u8 day)&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0002&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0xA&lt;br /&gt;
| Language&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8&lt;br /&gt;
| CountryInfo&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0001&lt;br /&gt;
| 0x800&lt;br /&gt;
| 0x2?&lt;br /&gt;
| Country name in UTF-16, every 0x80-bytes is an entry for each language, in the order of the Language table below (not all entries are set)&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0002&lt;br /&gt;
| 0x800&lt;br /&gt;
| 0x2?&lt;br /&gt;
| State name in UTF-16, every 0x80-bytes is an entry for each language&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0003&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xE&lt;br /&gt;
| Pair of 16-bit values, meaning unknown but related to address (ZIP code?)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0x000C0000&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 0x8&lt;br /&gt;
| Restricted photo exchange data, and other info&lt;br /&gt;
|-&lt;br /&gt;
| 0x000C0001&lt;br /&gt;
| 0x14&lt;br /&gt;
|?&lt;br /&gt;
| Same as above?&lt;br /&gt;
|-&lt;br /&gt;
| 0x000D0000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x2&lt;br /&gt;
| u16 at offset 0x0: [[SMDH#EULA_Version|EULA Version]] which was agreed to.&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0000&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown, used by [[NS]] on dev-units for [[SVC|svcKernelSetState]], where Type is 6. During NS startup on debug-units, NS compares the u32 from +8 in this config-block with the [[Configuration_Memory#APPMEMTYPE|APPMEMTYPE]]. When those don&#039;t match NS starts a FIRM-launch (with the same FIRM titleID as the currently running one) to boot into a FIRM with the APPMEMTYPE value from this config-block&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0004&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8?&lt;br /&gt;
| The first u8 is the System-Model [[Cfg:GetSystemModel|value]], the last 3-bytes are unknown&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0005&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| The first u8 indicates whether network updates are enabled. (However, NIM only checks this flag with developer UNITINFO).&lt;br /&gt;
|-&lt;br /&gt;
| 0x00110000&lt;br /&gt;
| 0x4&lt;br /&gt;
|?&lt;br /&gt;
| The low u16 indicates whether the system setup is required, such as when the system is booted for the first time or after doing a [[System Settings|System Format]]: 0 = setup required, non-zero = no setup required&lt;br /&gt;
|-&lt;br /&gt;
| 0x00110001&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xA?&lt;br /&gt;
| TitleID of the menu to launch, used by [[NS]] on dev units (this block can be edited on dev units with [[3DS Development Unit Software#Config|Config]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x00120000&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| ? (read by HID)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00130000&lt;br /&gt;
| 0x4&lt;br /&gt;
|?&lt;br /&gt;
| If response is 0x100 then debug mode is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x00160000&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown, first byte is used by config service-cmd [[Config_Services|0x00070040]]. (Unknown whether the last 3-bytes are used)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00190000&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Unknown. NFC-module checks for value1/non-value1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The developer unit TID block only exists on developer units.&lt;br /&gt;
&lt;br /&gt;
===Stereo Display Settings===&lt;br /&gt;
All values are hard-coded in cfg module.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Value&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| 62.0f&lt;br /&gt;
|assumed pupillary distance in mm?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| 289.0f&lt;br /&gt;
|assumed distance in mm between player&#039;s eyes and upper screen?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| 76.80f&lt;br /&gt;
|width in mm of (old) 3DS upper screen (doesn&#039;t vary for different models?)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| 46.08f&lt;br /&gt;
|height in mm of (old) 3DS upper screen (doesn&#039;t vary for different models?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| 10.0f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| 5.0f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 4&lt;br /&gt;
| 55.58f&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 4&lt;br /&gt;
| 21.57f&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Languages===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  ID&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| JP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| EN&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| FR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| DE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| IT&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| ES&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| ZH&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| KO&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| NL&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| PT&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| RU&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| TW&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===CountryInfo===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Country code, same as DSi/Wii country codes. Value 0xFF is invalid.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===0x000A0000 Block===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Byte&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0-0x13&lt;br /&gt;
| UTF-16 username, with no NULL-terminator.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14-17&lt;br /&gt;
| Usually zero?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18-0x1B&lt;br /&gt;
| u32 NGWord version the username was last checked with. If this value is less than the u32 stored in the NGWord CFA &amp;quot;romfs:/version.dat&amp;quot;, the system then checks the username string with the bad-word list CFA again, then updates this field with the value from the CFA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===LCD display config===&lt;br /&gt;
There seems to be some sort of LCD display configuration stored in this cfg. When using the cfg-save from an Old3DS on a New3DS without formatting the cfg first, the bottom-screen display is somewhat off(which is fixed by formatting the cfg-save).&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Titles_With_Code_Symbols&amp;diff=17882</id>
		<title>Titles With Code Symbols</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Titles_With_Code_Symbols&amp;diff=17882"/>
		<updated>2016-08-04T17:47:35Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Might as well share this&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists titles containing symbols in the RomFS for the ExeFS codebin.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Title name&lt;br /&gt;
!  Notes&lt;br /&gt;
|-&lt;br /&gt;
| Brunswick Pro Bowling&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Fire Emblem: If/Fates&lt;br /&gt;
| All released versions of the game contain &amp;quot;name.StackTrace&amp;quot; and &amp;quot;addr.StackTrace&amp;quot; files in the &amp;quot;debug&amp;quot; folder in the RomFS, which provide full function names/signatures for the game&#039;s code.bin.&lt;br /&gt;
|-&lt;br /&gt;
| Inazuma Eleven 3 Lightning Bolt / Team Ogre Attacks / Bomb Blast&lt;br /&gt;
| CRO/CRS contains symbols.&lt;br /&gt;
|-&lt;br /&gt;
| Mario Kart 7&lt;br /&gt;
| Only the DLP-child has symbols, not the main app/update-title.&lt;br /&gt;
|-&lt;br /&gt;
| Megaman Legacy Collection&lt;br /&gt;
| CRO/CRS contains symbols.&lt;br /&gt;
|-&lt;br /&gt;
| Puzzle &amp;amp; Dragons Z + Puzzle &amp;amp; Dragons Super Mario Bros. Edition&lt;br /&gt;
| CRO/CRS contains symbols.&lt;br /&gt;
|-&lt;br /&gt;
| Steel Diver: Sub Wars&lt;br /&gt;
| Newer versions of the update-title don&#039;t have the &amp;quot;map&amp;quot; file any more.&lt;br /&gt;
|-&lt;br /&gt;
| Super Smash Bros.&lt;br /&gt;
| CRO/CRS contains symbols.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=RomFS&amp;diff=12921</id>
		<title>RomFS</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=RomFS&amp;diff=12921"/>
		<updated>2015-07-12T22:07:13Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Add format descriptions for everything else in a RomFS, remove stub tag.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Overview ===&lt;br /&gt;
RomFS (or Read-Only Filesystem) is part of the [[NCCH]] format, and is used as external file storage.&lt;br /&gt;
&lt;br /&gt;
RomFS can be used:&lt;br /&gt;
&lt;br /&gt;
*in conjunction with the [[ExeFS]] of a NCCH&lt;br /&gt;
&lt;br /&gt;
*to contain the game manual accessible from the [[Home Menu]]&lt;br /&gt;
&lt;br /&gt;
*to contain the [[Download Play#Broadcasted application data|DLP Child CIA]])&lt;br /&gt;
&lt;br /&gt;
*or to contain game cartridge update data&lt;br /&gt;
&lt;br /&gt;
(There may be more implementations in the future)&lt;br /&gt;
&lt;br /&gt;
=== Format ===&lt;br /&gt;
&lt;br /&gt;
The RomFS is wrapped inside a IVFC hash-tree container, and the actual data is structured like a node-based tree, starting at the root level directory node, moving down to other directory and file nodes. Each directory node  has pointers to child directory nodes and siblings, together with a pointer to the first file node for that directory. Each file node has pointers to their next file node, together with information about the actual file data.&lt;br /&gt;
&lt;br /&gt;
The RomFS IVFC hash-tree header is 0x5C bytes long and is structured as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x00&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic &amp;quot;IVFC&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic number 0x10000&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Master hash size&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 1 logical offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 1 hashdata size&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Level 1 block size, in log2&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 2 logical offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 2 hashdata size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Level 2 block size, in log2.&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 3 logical offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x8&lt;br /&gt;
| Level 3 hashdata size&lt;br /&gt;
|-&lt;br /&gt;
| 0x4C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Level 3 block size, in log2.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x4&lt;br /&gt;
| Optional info size.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Level 3 Format ===&lt;br /&gt;
&lt;br /&gt;
The Level 3 partition of a RomFS consists of a header specifying offsets to four tables, followed by filedata (aligned to 16-bytes). Though their size varies by RomFS contents, the tables are always sequential and in the same order, as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x28&lt;br /&gt;
|  Header&lt;br /&gt;
|-&lt;br /&gt;
|  0x28&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Directory HashKey Table&lt;br /&gt;
|-&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Directory Metadata Table&lt;br /&gt;
|-&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Varies&lt;br /&gt;
|  File HashKey Table&lt;br /&gt;
|-&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Varies&lt;br /&gt;
|  File Metadata Table&lt;br /&gt;
|-&lt;br /&gt;
|  Varies&lt;br /&gt;
|  Varies&lt;br /&gt;
|  File Data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Level 3 Header Format ===&lt;br /&gt;
&lt;br /&gt;
RomFS Header data is always 0x28 bytes long, and follows this layout (offsets are from the start of the header):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Header Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x4&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Directory HashKey Table Offset&lt;br /&gt;
|-&lt;br /&gt;
|  0x8&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Directory HashKey Table Length&lt;br /&gt;
|-&lt;br /&gt;
|  0xC&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Directory Metadata Table Offset&lt;br /&gt;
|-&lt;br /&gt;
|  0x10&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Directory Metadata Table Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x14&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File HashKey Table Offset&lt;br /&gt;
|-&lt;br /&gt;
|  0x18&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File HashKey Table Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x1C&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File Metadata Table Offset&lt;br /&gt;
|-&lt;br /&gt;
|  0x20&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File Metadata Table Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x24&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File Data Offset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Directory Metadata Structure ===&lt;br /&gt;
&lt;br /&gt;
When a RomFS is built, directories are added recursively starting with the root. When a directory is added, all of its files are added to the File Metadata Table, then all of its subdirectories (if any), are added to the table. If any of the directory&#039;s subdirectories have their own subdirectories, the current directory&#039;s subdirectories are all added before the subdirectories&#039; subdirectories are added.&lt;br /&gt;
&lt;br /&gt;
A Metadata entry for a directory has the following structure (all values are initialized to 0xFFFFFFFF, and remain that way when unused):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of Parent Directory (self if Root)&lt;br /&gt;
|-&lt;br /&gt;
|  0x4&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of next Sibling Directory&lt;br /&gt;
|-&lt;br /&gt;
|  0x8&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of first Child Directory (Subdirectory)&lt;br /&gt;
|-&lt;br /&gt;
|  0xC&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of first File (in File Metadata Table)&lt;br /&gt;
|-&lt;br /&gt;
|  0x10&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Directory HashKey Table Pointer&lt;br /&gt;
|-&lt;br /&gt;
|  0x14&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Name Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x18&lt;br /&gt;
|  Name Length (rounded up to multiple of 4)&lt;br /&gt;
|  Directory Name (Unicode)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File Metadata Structure ===&lt;br /&gt;
&lt;br /&gt;
A Metadata entry for a file has the following structure (all values are initialized to 0xFFFFFFFF, and remain that way when unused):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of Containing Directory (within Directory Metadata Table)&lt;br /&gt;
|-&lt;br /&gt;
|  0x4&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Offset of next Sibling File&lt;br /&gt;
|-&lt;br /&gt;
|  0x8&lt;br /&gt;
|  0x8&lt;br /&gt;
|  Offset of File&#039;s Data&lt;br /&gt;
|-&lt;br /&gt;
|  0x10&lt;br /&gt;
|  0x8&lt;br /&gt;
|  Length of File&#039;s Data&lt;br /&gt;
|-&lt;br /&gt;
|  0x10&lt;br /&gt;
|  0x4&lt;br /&gt;
|  File HashKey Table Pointer&lt;br /&gt;
|-&lt;br /&gt;
|  0x14&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Name Length&lt;br /&gt;
|-&lt;br /&gt;
|  0x18&lt;br /&gt;
|  Name Length (rounded up to multiple of 4)&lt;br /&gt;
|  File Name (Unicode)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== HashKey Table Structure ===&lt;br /&gt;
&lt;br /&gt;
For both files and directories, a HashKey table is created for MetaData verification.&lt;br /&gt;
&lt;br /&gt;
A HashKey table consists of a number of uints, all initialized to 0xFFFFFFFF. The size of the table is dependent on the number of entries in the relevant MetaData table (it&#039;s probably intended to always be the smallest prime number greater than or equal to the number of entries, but the implementation was lazy), illustrated by the following code (C#):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
		public static byte[] GetHashKeyTableLength(uint numEntries)&lt;br /&gt;
		{&lt;br /&gt;
			uint count = numEntries;&lt;br /&gt;
			if (numEntries &amp;lt; 3)&lt;br /&gt;
				count = 3;&lt;br /&gt;
			else if (numEntries &amp;lt; 19)&lt;br /&gt;
				count |= 1;&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				while (count % 2 == 0 &lt;br /&gt;
					|| count % 3 == 0 &lt;br /&gt;
					|| count % 5 == 0 &lt;br /&gt;
					|| count % 7 == 0 &lt;br /&gt;
					|| count % 11 == 0 &lt;br /&gt;
					|| count % 13 == 0 &lt;br /&gt;
					|| count % 17 == 0)&lt;br /&gt;
				{&lt;br /&gt;
					count++;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			return count;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the table is initialized, each File/Directory has a hash taken based off its name (byte array taken from Metadata entry) and Parent Directory&#039;s offset (C#):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
		public static uint CalcPathHash(byte[] Name, uint ParentOffset)&lt;br /&gt;
		{&lt;br /&gt;
			uint hash = ParentOffset ^ 123456789;&lt;br /&gt;
			for (int i = 0; i &amp;lt; Name.Length; i += 2)&lt;br /&gt;
			{&lt;br /&gt;
				hash = (hash &amp;gt;&amp;gt; 5) | (hash &amp;lt;&amp;lt; 27);&lt;br /&gt;
				hash ^= (ushort)((Name[i]) | (Name[i + 1] &amp;lt;&amp;lt; 8));&lt;br /&gt;
			}&lt;br /&gt;
			return hash;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each hash is then taken modulus the number of uints in the HashKey Table. If the HashKeyTable&#039;s value at that index is 0xFFFFFFFF (unused), the offset for the relevant directory/file is inserted into the table at that offset. Otherwise, after inserting the relevant directory/file&#039;s offset, the directory/file has its HashKey Pointer set to the offset of the directory/file that previously occupied the HashKey Table at that index.&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=EShop&amp;diff=12589</id>
		<title>EShop</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=EShop&amp;diff=12589"/>
		<updated>2015-05-11T03:24:15Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Other domains the eshop hits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Nintendo 3DS eShop was added in the June 2011 update for JP/EUR/USA.&lt;br /&gt;
&lt;br /&gt;
From here, you can download Virtual Console games, 3D Classics, DSiware software, view screenshots, and 3D trailers for upcoming 3DS titles.&lt;br /&gt;
&lt;br /&gt;
eShop uses the following domains over HTTPS:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* cp3s-auth.c.shop.nintendowifi.net&lt;br /&gt;
* a248.e.akamai.net&lt;br /&gt;
* ninja.ctr.shop.nintendo.net&lt;br /&gt;
* samurai.ctr.shop.nintendo.net&lt;br /&gt;
* ccif.ctr.shop.nintendo.net&lt;br /&gt;
* eou.c.shop.nintendowifi.net&lt;br /&gt;
&lt;br /&gt;
These domains are used by [[NIM_Services|NIM]]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* nus.c.shop.nintendowifi.net&lt;br /&gt;
* ecs.c.shop.nintendowifi.net&lt;br /&gt;
* cas.c.shop.nintendowifi.net&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While eShop is loading, eShop will use command [[NIMS:CheckSysupdateAvailableSOAP]]. If a system update is available where title installation for system titles still needs finalized (or when the updated titles were not downloaded at all), eShop will then display the &amp;quot;system update is available&amp;quot; message.&lt;br /&gt;
&lt;br /&gt;
The eShop application uses command [[AMNet:FinishInstallToMedia]] to finalize the SD title install (if the whole title is downloaded while eShop is still running), however, before using that command the eShop application also uses [[AMNet:FinishInstallToMedia]] to finalize installing all system titles (from system updates).&lt;br /&gt;
&lt;br /&gt;
== eShop QR Codes ==&lt;br /&gt;
eShop QR Codes can be scanned with the camera, allowing one to quickly navigate to the desired eShop title with just two clicks. The QR Codes themselves is a simple text/url QR, started with &amp;quot;ESHOP://&amp;quot; string followed by an eShop title link id and then some special data, delimited by a dot symbol, which can be ommited.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! QR Code source&lt;br /&gt;
! Region&lt;br /&gt;
! Title&lt;br /&gt;
! Serial&lt;br /&gt;
! Title ID&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000000201.PEAALL000000 || EUR || Nintendogs &amp;amp; Cats Demo || ADA/B/C || 0004000200030c01&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000007870.PEAALL000000 || EUR || Crush 3D || A??P || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008009.PEAALL000000 || EUR || Resident Evil Revelations Demo || ABRE || 000400020005ee01&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008123.J00101Z00095 || JPN || Rhythm Thief And The Emperor&#039;s Treasure Demo || ARTJ || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008404.PEAALL000000 || EUR || Mario And Sonic At The London 2012 Olympic Games Demo || ACMP [http://mediacontent.nintendo-europe.com/NOE/images/game_content/ACMP-MarioAndSonicAtTheLondon2012OlympicGames-QRCode-EA_ALL_000_001.bmp] || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008447.J00101Z00094 || JPN || Resident Evil Revelations Demo || ABRJ || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008449.J00101Z00082 || JPN || Swapnote || JFRJ ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008561 || USA || Swapnote || JFRE || 0004000000051700&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008647.J00101Z00096 || JPN || Metal Gear Solid Snake Eater 3D Demo || AMGJ || 0004000200048101&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008648.J00101Z00097 || JPN || Theatrythm Final Fantasy || ATHJ ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008782.PEAALL000000 || EUR || Metal Gear Solid Snake Eater 3D Demo || AMGE || 0004000200082401&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008842.PEAALL000000 || EUR || Rhythm Thief And The Emperor&#039;s Treasure Demo || ARTP [http://mediacontent.nintendo-europe.com/NOE/images/game_content/ARTP-RhythmThief_TheEmperorsTreasure-QRCode-EA_ALL_000_001.bmp] || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009084.J00101Z00121 || JPN || Hatsune Miku And Future Stars: Project Mirai Demo || AM9J || 00040002&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009102.J00101Z00106 || JPN || Denpa Ningen RPG || JD8J ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009161.J00101Z00118 || JPN || Dillon&#039;s Rolling Western || JAMJ || 00040000&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009261 || USA || Dillon&#039;s Rolling Western || JAME? || 00040000&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009401.J00101Z00120 || JPN || Kingdom Hearts 3D Video Download || JZ8J ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009403.J00101Z00119 || JPN || DQM 3D Video Download || JZ7J ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009575.PEAALL000000 || EUR || Kid Icarus: Of Myths And Monsters (Virtual Console) ||? ||?&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009846 || USA || Ketzal&#039;s Corridors ||? ||?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* New QR Code for Japanese &amp;quot;Photos with Super Mario&amp;quot; has a different code string: ESHOP://50010000013120.J00108Z00001.CD588EAE95A3A68D15C647DA2AC0945FD88F70AB8A31149E51C4B05FB927B0B8&lt;br /&gt;
&lt;br /&gt;
* There is a link in the Japanese eShop &amp;lt;nowiki&amp;gt;[http://www.nintendo.co.jp/3ds/eshop/qrCode.html?####]&amp;lt;/nowiki&amp;gt; where you can replace the #### with the Japanese eShop title&#039;s serial and you will get it&#039;s QR code. (i.e. http://www.nintendo.co.jp/3ds/eshop/qrCode.html?jcaj will get you the pushmo QR code)&lt;br /&gt;
&lt;br /&gt;
* You could use Google&#039;s Chart API to create a QR code from the codes above: https://chart.googleapis.com/chart?chs=150x150&amp;amp;cht=qr&amp;amp;chl=ESHOP (replace the ESHOP text with the ESHOP:// link from one of the above)&lt;br /&gt;
&lt;br /&gt;
== ExtData ==&lt;br /&gt;
The ExtData [[Extdata#Filesystem|File System]] for eShop is as follows:&lt;br /&gt;
&lt;br /&gt;
 root&lt;br /&gt;
 ├── icon&lt;br /&gt;
 ├── boss&lt;br /&gt;
 │   └── TIGER100.tmp&lt;br /&gt;
 └── user&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  File&lt;br /&gt;
!  Details&lt;br /&gt;
!  Size&lt;br /&gt;
!  Firmware Introduced&lt;br /&gt;
!  Plain text&lt;br /&gt;
|-&lt;br /&gt;
|  icon&lt;br /&gt;
|  Duplicate from application ExeFS. Always image 00000002&lt;br /&gt;
|  0x36C0 Bytes&lt;br /&gt;
|  [[2.0.0-2]]&lt;br /&gt;
|  [https://dl.dropboxusercontent.com/u/60710927/CTR/Sample/eShopExtdata/icon Download_EUR]&lt;br /&gt;
|-&lt;br /&gt;
|  TIGER100.tmp&lt;br /&gt;
|  Always image 00000003.&lt;br /&gt;
|  0xCE47 bytes (varies?)&lt;br /&gt;
|  [[2.0.0-2]]&lt;br /&gt;
|  &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=NCCH&amp;diff=12583</id>
		<title>NCCH</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=NCCH&amp;diff=12583"/>
		<updated>2015-05-10T04:30:35Z</updated>

		<summary type="html">&lt;p&gt;SciresM: Details on the unknown 0x10-long seed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:File formats]]&lt;br /&gt;
The following text tries to document the structure of the NCCH container format.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
There are two known NCCH container specialisations used on the 3DS, &amp;quot;executable&amp;quot; and &amp;quot;non-executable&amp;quot;, officially known as CXI and CFA respectively.&lt;br /&gt;
&lt;br /&gt;
== CXI == &lt;br /&gt;
&lt;br /&gt;
The CXI (CTR Executable Image) specialisation of the NCCH container, contains executable code, which runs on a single ARM11 core. It can communicate through SVC calls with the other ARM11 core running the &#039;system&#039; program code. For reasons of clarity, the ARM11 cores will sometimes be called the &#039;appcore&#039; and &#039;syscore&#039; respectively.&lt;br /&gt;
&lt;br /&gt;
The CXI format is structured in the following order:&lt;br /&gt;
* first a NCCH header,&lt;br /&gt;
* followed by an extended header,&lt;br /&gt;
* followed by an access descriptor,&lt;br /&gt;
* followed by an &#039;&#039;&#039;optional&#039;&#039;&#039; plain binary region,&lt;br /&gt;
* followed by an &#039;&#039;&#039;optional&#039;&#039;&#039; executable filesystem ([[ExeFS]]) - (contains ARM11 code, Home menu [[SMDH|icn]]/bnr and [[Logo|logo]]),&lt;br /&gt;
* and finally followed by an &#039;&#039;&#039;optional&#039;&#039;&#039; read-only filesystem ([[RomFS]]) - (Used for external file storage).&lt;br /&gt;
&lt;br /&gt;
The extended header contains additional information regarding access control. &lt;br /&gt;
The plain binary region is an area specifically stored in plaintext, mostly containing SDK library strings for identification.&lt;br /&gt;
&lt;br /&gt;
== CFA ==&lt;br /&gt;
&lt;br /&gt;
The CFA (CTR File Archive) specialisation of the NCCH container, is not executable, but are used in conjunction with CXI files. For instance the DLP Child Container and the Electronic Manual. (There is a system update NCCH which follows this format, but is used by the 3DS rather than the Application NCCH, and only works when embedded in the [[CCI]] format because the nVer is kept in the header of retail [[CCI]] files instead of the application NCCH). There are CFA files which exist alone in a title, but these are just [[Title list|System Data Archive]] titles and are found only in the [[Flash Filesystem#CTR partition|NAND]].&lt;br /&gt;
&lt;br /&gt;
CFA files are structured in the following order:&lt;br /&gt;
* first a NCCH header,&lt;br /&gt;
* followed by an &#039;&#039;&#039;optional&#039;&#039;&#039; executable filesystem ([[ExeFS]]) (same as in CXI, except no ARM11 code)&lt;br /&gt;
* followed by an &#039;&#039;&#039;optional&#039;&#039;&#039; read-only filesystem ([[RomFS]])&lt;br /&gt;
&lt;br /&gt;
Non-Executable NCCH file examples(Includes Decrypted [[RomFS]]):&lt;br /&gt;
&lt;br /&gt;
[https://dl.dropbox.com/u/60710927/CTR/Sample/DLP%20Child.7z DLPChild Container]&lt;br /&gt;
[https://dl.dropbox.com/u/60710927/CTR/Sample/Manual.7z Electronic Manual]&lt;br /&gt;
&lt;br /&gt;
== NCCH Specs ==&lt;br /&gt;
&lt;br /&gt;
=== Encryption ===&lt;br /&gt;
The extended header, the [[ExeFS]] and the [[RomFS]] are encrypted using 128-bit AES CTR. See here regarding the [https://github.com/3dshax/ctr/blob/master/ctrtool/ncch.c CTR].&lt;br /&gt;
&lt;br /&gt;
The key is generated using the [[AES|AES Engine]] key generator, where the keyX is set by the bootrom (see below for the keyslots) and the keyY is the first 0x10 bytes of the NCCH signature. This method of key generation is referred to as &amp;quot;secure-crypto&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
Starting with [[9.6.0-24|9.6.0-X]] Process9 can now generate the NCCH keyY with the first 0x10-bytes from a SHA256 hash (when ncchflag[7] has bitmask 0x20 set). This hash is generated with the data &amp;lt;0x10-long old-method keyY&amp;gt;&amp;lt;0x10-long title-unique seed&amp;gt;, where seeds for downloaded titles that use the new crypto are stored in SEEDDB (nand:/data/&amp;lt;console-unique&amp;gt;/sysdata/0001000f/00000000). This new keyY generation can only be used with [[7.0.0-13|7.0.0-X]] NCCH encryption or above (that is, the new keyY is only used with the non-0x2C-keyslots).&lt;br /&gt;
&lt;br /&gt;
If a certain NCCH flag is set, a fixed AES key is used. There are two fixed keys, one for titles which have the system category bit set (SystemFixedKey), and one for the rest (&amp;quot;zeros&amp;quot; key). These are debug keys, as they aren&#039;t nomally supported on retail systems.&lt;br /&gt;
&lt;br /&gt;
As of [[7.0.0-13|7.0.0-X]] the system supports a new encryption method for secure-crypto (when ncchflag[3] != 0). Where a second key is generated using the same keyY but with another [[AES|keyslot]]. The second key is used to crypt the [[RomFS]] and [[ExeFS]] files which don&#039;t have filenames &amp;quot;icon&amp;quot; or &amp;quot;banner&amp;quot;(i.e. &amp;quot;.code&amp;quot; and &amp;quot;.firm&amp;quot;). While everything else is crypted with the original key. Note the CTR used is the same for both keys. This makes titles &amp;quot;recognizable&amp;quot; but not &amp;quot;launchable&amp;quot; on systems which don&#039;t support this method or the keyslot used. See below for keyslots used for generating the second key.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  ncchflag[3]&lt;br /&gt;
!  FW Introduced&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  AES Keyslot&lt;br /&gt;
!  Notes&lt;br /&gt;
|-&lt;br /&gt;
|  0x01&lt;br /&gt;
|  [[7.0.0-13|7.0.0-X]]&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  0x25&lt;br /&gt;
|  This keyslot is [[Savegames|initialized]] by the 6.0 gamecard savegame keyY init function during boot, using a different portion of the [[Savegames|final]] hash(this keyslot is separate from the one used for the 6.0 save crypto).&lt;br /&gt;
|-&lt;br /&gt;
|  0x0A&lt;br /&gt;
|  [[9.3.0-21|9.3.0-X]]&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  0x18&lt;br /&gt;
|  This keyslot is initialized by [[FIRM#New_3DS_FIRM|arm9loader]] on New3DS starting with [[8.1.0-0_New3DS]], but only [[9.3.0-21|9.3.0-X]] and later know how to use it with ncchflag[3].&lt;br /&gt;
|-&lt;br /&gt;
|  0x0B&lt;br /&gt;
|  [[9.6.0-24|9.6.0-X]]&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  0x1B&lt;br /&gt;
|  [[9.6.0-24|9.6.0-X]]&#039;s [[FIRM#New_3DS_FIRM|arm9loader]] changed the contents of keyslots 0x19-0x1F; 9.6.0-X was the first time they were used, so this works.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Format ===&lt;br /&gt;
&lt;br /&gt;
Currently, only [[ExeFS]]:/.code can be compressed (with a LZ77 variant). A flag in the [[NCCH/Extended Header#System Info|exheader]] determines if this is the case.&lt;br /&gt;
&lt;br /&gt;
On retail for SD applications, exheader_systeminfoflags.flag bit1 must be set.&lt;br /&gt;
&lt;br /&gt;
Retail CFAs use the default NCCH product code &amp;quot;CTR-P-CTAP&amp;quot;, while retail title/gamecard CXIs use NCCH product code &amp;quot;CTR-X-XXXX&amp;quot;. This product code is the NCCH [[Serials|serial code]]. The region-locking info checked by home menu is stored in the [[SMDH#BNR Region|icon]].&lt;br /&gt;
&lt;br /&gt;
All of the hashes stored in this NCCH header are over the cleartext data. The ExeFS/RomFS superblock starts at offset 0x0 in the ExeFS/RomFS, and the size is specified by the hash region fields. Nintendo&#039;s NCCH validation code seems to have the size of this region fixed to 0x200 bytes (for ExeFS at least). &lt;br /&gt;
&lt;br /&gt;
As of [[5.0.0-11]] the application [[ExeFS]]:/logo can be loaded from the plaintext region between the access descriptor and the plain region, all applications built since [[5.0.0-11]] store the logo here. The size of this logo is always 0x2000-bytes.&lt;br /&gt;
&lt;br /&gt;
The plain region mainly contains tags for each SDK library used when building the CXI. The version used for the &amp;quot;FIRMWARE&amp;quot; tag is the kernel/FIRM [[Configuration_Memory|version]], this version can also be stored in the exheader &amp;quot;kernel release version&amp;quot; ARM11 kernel descriptor field. As of [[2.2.0-X]] the NATIVE_FIRM kernels check the CXI exheader &amp;quot;kernel release version&amp;quot; field, if it is stored in the CXI exheader. If the kernel/FIRM version specified by this field is higher than the version of the running NATIVE_FIRM, the kernel will return error-code 0xD9001413.&lt;br /&gt;
&lt;br /&gt;
=== NCCH Header ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  OFFSET&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x000&lt;br /&gt;
|  0x100&lt;br /&gt;
|  RSA-2048 signature of the NCCH header, using SHA-256.&lt;br /&gt;
|-&lt;br /&gt;
|  0x100&lt;br /&gt;
|  4&lt;br /&gt;
|  Magic ID, always &#039;NCCH&#039;&lt;br /&gt;
|-&lt;br /&gt;
|  0x104&lt;br /&gt;
|  4&lt;br /&gt;
|  Content size, in media units (1 media unit = 0x200 bytes)&lt;br /&gt;
|-&lt;br /&gt;
|  0x108&lt;br /&gt;
|  8&lt;br /&gt;
|  Partition ID&lt;br /&gt;
|-&lt;br /&gt;
|  0x110&lt;br /&gt;
|  2&lt;br /&gt;
|  Maker code&lt;br /&gt;
|-&lt;br /&gt;
|  0x112&lt;br /&gt;
|  2&lt;br /&gt;
|  Version&lt;br /&gt;
|-&lt;br /&gt;
|  0x114&lt;br /&gt;
|  4&lt;br /&gt;
|  When ncchflag[7] = 0x20 starting with FIRM [[9.6.0-24|9.6.0-X]], this is compared with the first output u32 from a SHA256 hash. The data used for that hash is 0x18-bytes: &amp;lt;0x10-long title-unique seed&amp;gt; &amp;lt;programID from NCCH+0x118&amp;gt;. This hash seems to be purely for verification of 0x10-long keyY hash data, and is not the actual keyY.&lt;br /&gt;
|-&lt;br /&gt;
|  0x118&lt;br /&gt;
|  8&lt;br /&gt;
|  Program ID&lt;br /&gt;
|-&lt;br /&gt;
|  0x120&lt;br /&gt;
|  0x10&lt;br /&gt;
|  Reserved&lt;br /&gt;
|-&lt;br /&gt;
|  0x130&lt;br /&gt;
|  0x20&lt;br /&gt;
|  Logo Region SHA-256 hash. (For applications built with SDK 5+) (Supported from firmware: [[5.0.0-11]])&lt;br /&gt;
|-&lt;br /&gt;
|  0x150&lt;br /&gt;
|  0x10&lt;br /&gt;
|  Product code&lt;br /&gt;
|-&lt;br /&gt;
|  0x160&lt;br /&gt;
|  0x20&lt;br /&gt;
|  Extended header SHA-256 hash (SHA256 of 2x Alignment Size, beginning at 0x0 of ExHeader)&lt;br /&gt;
|-&lt;br /&gt;
|  0x180&lt;br /&gt;
|  4&lt;br /&gt;
|  Extended header size&lt;br /&gt;
|-&lt;br /&gt;
|  0x184&lt;br /&gt;
|  4&lt;br /&gt;
|  Reserved&lt;br /&gt;
|-&lt;br /&gt;
|  0x188&lt;br /&gt;
|  8&lt;br /&gt;
|  Flags (See Below)&lt;br /&gt;
|-&lt;br /&gt;
|  0x190&lt;br /&gt;
|  4&lt;br /&gt;
|  Plain region offset, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x194&lt;br /&gt;
|  4&lt;br /&gt;
|  Plain region size, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x198&lt;br /&gt;
|  4&lt;br /&gt;
|  Logo Region offset, in media units (For applications built with SDK 5+) (Supported from firmware: [[5.0.0-11]])&lt;br /&gt;
|-&lt;br /&gt;
|  0x19c&lt;br /&gt;
|  4&lt;br /&gt;
|  Logo Region size, in media units (For applications built with SDK 5+) (Supported from firmware: [[5.0.0-11]])&lt;br /&gt;
|-&lt;br /&gt;
|  0x1A0&lt;br /&gt;
|  4&lt;br /&gt;
|  ExeFS offset, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1A4&lt;br /&gt;
|  4&lt;br /&gt;
|  ExeFS size, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1A8&lt;br /&gt;
|  4&lt;br /&gt;
|  ExeFS hash region size, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1AC&lt;br /&gt;
|  4&lt;br /&gt;
|  Reserved&lt;br /&gt;
|-&lt;br /&gt;
|  0x1B0&lt;br /&gt;
|  4&lt;br /&gt;
|  RomFS offset, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1B4&lt;br /&gt;
|  4&lt;br /&gt;
|  RomFS size, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1B8&lt;br /&gt;
|  4&lt;br /&gt;
|  RomFS hash region size, in media units&lt;br /&gt;
|-&lt;br /&gt;
|  0x1BC&lt;br /&gt;
|  4&lt;br /&gt;
|  Reserved&lt;br /&gt;
|-&lt;br /&gt;
|  0x1C0&lt;br /&gt;
|  0x20&lt;br /&gt;
|  ExeFS superblock SHA-256 hash - (SHA-256 hash, starting at 0x0 of the ExeFS over the number of media units specified in the ExeFS hash region size)&lt;br /&gt;
|-&lt;br /&gt;
|  0x1E0&lt;br /&gt;
|  0x20&lt;br /&gt;
|  RomFS superblock SHA-256 hash - (SHA-256 hash, starting at 0x0 of the RomFS over the number of media units specified in the RomFS hash region size)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== NCCH Flags ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  INDEX&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  3&lt;br /&gt;
|  Crypto Method: When this is non-zero, a NCCH crypto method using two keyslots is used(see above).&lt;br /&gt;
|-&lt;br /&gt;
|  4&lt;br /&gt;
|  Content Platform: 1 = CTR.&lt;br /&gt;
|-&lt;br /&gt;
|  5&lt;br /&gt;
|  Content Type Bit-masks: Data = 0x1, Executable = 0x2, SystemUpdate = 0x4, Manual = 0x8, Child = (0x4&amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;0x8), Trial = 0x10. When &#039;Data&#039; is set, but not &#039;Executable&#039;, NCCH is a CFA. Otherwise when &#039;Executable&#039; is set, NCCH is a CXI.&lt;br /&gt;
|-&lt;br /&gt;
|  6&lt;br /&gt;
|  Content Unit Size i.e. u32 ContentUnitSize = 0x200*2^flags[6]; &lt;br /&gt;
|-&lt;br /&gt;
|  7&lt;br /&gt;
|  Bit-masks: FixedCryptoKey = 0x1, NoMountRomFs = 0x2, NoCrypto = 0x4, using a new keyY generator = 0x20(starting with FIRM [[9.6.0-24|9.6.0-X]]).&lt;br /&gt;
|}&lt;br /&gt;
CXIs NCCH header signature is verified using the RSA public key stored in the accessdesc,(which follows the exheader) while CFAs NCCH header is verified with a fixed RSA public key.&lt;br /&gt;
&lt;br /&gt;
==== NCCH header example for Lego Starwars III ====&lt;br /&gt;
 Signature:              720FF8F83F2A1E998322A026D1434165&lt;br /&gt;
                         ED19642ABC1CB2722135AA202BEAD60A&lt;br /&gt;
                         80BCD21C768C597B8268FEF2C64EA710&lt;br /&gt;
                         4C9BA5E12CFFBD1D0C619F4EF7B42CA7&lt;br /&gt;
                         DD8482CB4EB26720AD66CDA57ABCBCFB&lt;br /&gt;
                         D63268A6E2896A59B3B744E39E45B88A&lt;br /&gt;
                         ABB4C0980ACC6210818DCE6DAC838A10&lt;br /&gt;
                         95D0F66B352474D4B3DA4B333F49912D&lt;br /&gt;
                         29AF7EA58BC8C890B18C70B7D540A9FB&lt;br /&gt;
                         EBE24A5312055617D3353B28C3EB1D17&lt;br /&gt;
                         61021BEFF6AD22C384835B40BD44DFAD&lt;br /&gt;
                         981F6350F9458B17BCB5F768C92ABC93&lt;br /&gt;
                         2BCE9888855A8998F4CDE40C9543514A&lt;br /&gt;
                         C57B84EB75A680E7C742632614620D1D&lt;br /&gt;
                         A253284DF3DC01091EB3800C36FD62EE&lt;br /&gt;
                         BA15340F1FD498FAB67C0302E9CDA397&lt;br /&gt;
 Magic:                  NCCH&lt;br /&gt;
 Content size:           0x1cfef400&lt;br /&gt;
 Partition id:           0004000000038c00&lt;br /&gt;
 Maker code:             3436 (&amp;quot;46&amp;quot;)&lt;br /&gt;
 Version:                0002&lt;br /&gt;
 Program id:             0004000000038c00&lt;br /&gt;
 Temp flag:              00&lt;br /&gt;
 Product code:           CTR-P-ALGP&lt;br /&gt;
 Extended header hash:   0C27E3C1DE7B2AE2D3114F32A4EEBF46&lt;br /&gt;
                         9AFD0CF352C11D4984C2A9F1D2144C63&lt;br /&gt;
 Extended header size:   00000400&lt;br /&gt;
 Flags:                  0000030100000000&lt;br /&gt;
 Plain region offset:    0x00004a00&lt;br /&gt;
 Plain region size:      0x00000200&lt;br /&gt;
 ExeFS offset:           0x00004c00&lt;br /&gt;
 ExeFS size:             0x00143800&lt;br /&gt;
 ExeFS hash region size: 0x00000200&lt;br /&gt;
 RomFS offset:           0x00148400&lt;br /&gt;
 RomFS size:             0x1ceab000&lt;br /&gt;
 RomFS hash region size: 0x00000200&lt;br /&gt;
 ExeFS Superblock Hash:  130C042615F647C4C63225EA9E67F8A2&lt;br /&gt;
                         7B15246B88FBC7A927257B84977B787B&lt;br /&gt;
 RomFS Superblock Hash:  A65BEE1060BB6A6821BBCEC600035B7E&lt;br /&gt;
                         64FB6EACA7F0960CFB1F5A37087728F7&lt;br /&gt;
 Note: Offsets and sizes in media units have been converted to byte sizes.&lt;br /&gt;
&lt;br /&gt;
==== Plain region example for Lego Starwars III ====&lt;br /&gt;
 0004a00: 5b 53 44 4b 2b 4e 49 4e 54 45 4e 44 4f 3a 43 54  [SDK+NINTENDO:CT    [SDK+NINTENDO:CTR_SDK-0_14_23_200_none]&lt;br /&gt;
 0004a10: 52 5f 53 44 4b 2d 30 5f 31 34 5f 32 33 5f 32 30  R_SDK-0_14_23_20&lt;br /&gt;
 0004a20: 30 5f 6e 6f 6e 65 5d 00 5b 53 44 4b 2b 4e 49 4e  0_none].[SDK+NIN    [SDK+NINTENDO:Firmware-02_27]&lt;br /&gt;
 0004a30: 54 45 4e 44 4f 3a 46 69 72 6d 77 61 72 65 2d 30  TENDO:Firmware-0&lt;br /&gt;
 0004a40: 32 5f 32 37 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63  2_27].[SDK+Mobic    [SDK+Mobiclip:Deblocker_1_0_2]&lt;br /&gt;
 0004a50: 6c 69 70 3a 44 65 62 6c 6f 63 6b 65 72 5f 31 5f  lip:Deblocker_1_&lt;br /&gt;
 0004a60: 30 5f 32 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63 6c  0_2].[SDK+Mobicl    [SDK+Mobiclip:ImaAdpcmDec_1_0_0]&lt;br /&gt;
 0004a70: 69 70 3a 49 6d 61 41 64 70 63 6d 44 65 63 5f 31  ip:ImaAdpcmDec_1&lt;br /&gt;
 0004a80: 5f 30 5f 30 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63  _0_0].[SDK+Mobic    [SDK+Mobiclip:MobiclipDec_1_0_1]&lt;br /&gt;
 0004a90: 6c 69 70 3a 4d 6f 62 69 63 6c 69 70 44 65 63 5f  lip:MobiclipDec_&lt;br /&gt;
 0004aa0: 31 5f 30 5f 31 5d 00 5b 53 44 4b 2b 4d 6f 62 69  1_0_1].[SDK+Mobi    [SDK+Mobiclip:MoflexDemuxer_1_0_2]&lt;br /&gt;
 0004ab0: 63 6c 69 70 3a 4d 6f 66 6c 65 78 44 65 6d 75 78  clip:MoflexDemux&lt;br /&gt;
 0004ac0: 65 72 5f 31 5f 30 5f 32 5d 00 00 00 00 00 00 00  er_1_0_2].......&lt;br /&gt;
 0004ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................&lt;br /&gt;
 0004ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................&lt;br /&gt;
&lt;br /&gt;
==== Example dependency list from the extended header ====&lt;br /&gt;
 00850 41 50 54 3A 55 00 00 00 24 68 69 6F 46 49 4F 00 APT:U...$hioFIO.&lt;br /&gt;
 00860 24 68 6F 73 74 69 6F 30 24 68 6F 73 74 69 6F 31 $hostio0$hostio1&lt;br /&gt;
 00870 61 63 3A 75 00 00 00 00 62 6F 73 73 3A 55 00 00 ac:u....boss:U..&lt;br /&gt;
 00880 63 61 6D 3A 75 00 00 00 63 65 63 64 3A 75 00 00 cam:u...cecd:u..&lt;br /&gt;
 00890 63 66 67 3A 75 00 00 00 64 6C 70 3A 46 4B 43 4C cfg:u...dlp:FKCL&lt;br /&gt;
 008A0 64 6C 70 3A 53 52 56 52 64 73 70 3A 3A 44 53 50 dlp:SRVRdsp::DSP&lt;br /&gt;
 008B0 66 72 64 3A 75 00 00 00 66 73 3A 55 53 45 52 00 frd:u...fs:USER.&lt;br /&gt;
 008C0 67 73 70 3A 3A 47 70 75 68 69 64 3A 55 53 45 52 gsp::Gpuhid:USER&lt;br /&gt;
 008D0 68 74 74 70 3A 43 00 00 6D 69 63 3A 75 00 00 00 http:C..mic:u...&lt;br /&gt;
 008E0 6E 64 6D 3A 75 00 00 00 6E 65 77 73 3A 75 00 00 ndm:u...&amp;lt;nowiki&amp;gt;news:u..&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 008F0 6E 77 6D 3A 3A 55 44 53 70 74 6D 3A 75 00 00 00 nwm::UDSptm:u...&lt;br /&gt;
 00900 70 78 69 3A 64 65 76 00 73 6F 63 3A 55 00 00 00 pxi:dev.soc:U...&lt;br /&gt;
 00910 73 73 6C 3A 43 00 00 00 79 32 72 3A 75 00 00 00 ssl:C...y2r:u...&lt;br /&gt;
 00920 69 72 3A 55 53 45 52 00 6C 64 72 3A 72 6F 00 00 ir:USER.ldr:ro..&lt;br /&gt;
 00930 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................&lt;br /&gt;
 00940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................&lt;br /&gt;
 00950 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................&lt;br /&gt;
 00960 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................&lt;br /&gt;
 ... ...&lt;br /&gt;
 009D0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                 &lt;br /&gt;
 009E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................&lt;br /&gt;
 009F0 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 02 . .............&lt;br /&gt;
&lt;br /&gt;
=== Extended Header ===&lt;br /&gt;
See also: [https://github.com/3dshax/ctr/blob/master/ctrtool/exheader.h]&lt;br /&gt;
&lt;br /&gt;
See [[NCCH/Extended Header|this]]&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/3dshax/ctr/tree/master/ctrtool ctrtool] - (CMD)(Windows/Linux) Parsing and decrypting(debug only) NCCH files&lt;br /&gt;
&lt;br /&gt;
[[3DSExplorer]] - (GUI)(Windows Only) Parsing NCCH files&lt;/div&gt;</summary>
		<author><name>SciresM</name></author>
	</entry>
</feed>