<?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=Plailect</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=Plailect"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/Plailect"/>
	<updated>2026-04-08T13:23:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Flash_Filesystem&amp;diff=19475</id>
		<title>Flash Filesystem</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Flash_Filesystem&amp;diff=19475"/>
		<updated>2017-02-07T01:06:09Z</updated>

		<summary type="html">&lt;p&gt;Plailect: added all known NAND flash sizes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Nintendo 3DS has several differently sized NAND flash chips. Due to the NCSD header, the actual used size of the Old3DS NAND is 0x3AF00000-bytes(943MiB). On New3DS, the actual NAND size and the total size used by the partitions, is 0x4D800000-bytes(1240MiB).&lt;br /&gt;
&lt;br /&gt;
===Physical Size===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Device&lt;br /&gt;
! Manufacturer&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
| 2DS&lt;br /&gt;
| Toshiba&lt;br /&gt;
| 0x3AF00000&lt;br /&gt;
|-&lt;br /&gt;
| 2DS&lt;br /&gt;
| Toshiba&lt;br /&gt;
| 0x76000000&lt;br /&gt;
|-&lt;br /&gt;
| 2DS&lt;br /&gt;
| Samsung&lt;br /&gt;
| 0x3BA00000&lt;br /&gt;
|-&lt;br /&gt;
| 2DS&lt;br /&gt;
| Samsung&lt;br /&gt;
| 0x4D800000&lt;br /&gt;
|-&lt;br /&gt;
| Old3DS&lt;br /&gt;
| Toshiba&lt;br /&gt;
| 0x3AF00000&lt;br /&gt;
|-&lt;br /&gt;
| Old3DS&lt;br /&gt;
| Samsung&lt;br /&gt;
| 0x3BA00000&lt;br /&gt;
|-&lt;br /&gt;
| New3DS&lt;br /&gt;
| Toshiba&lt;br /&gt;
| 0x76000000&lt;br /&gt;
|-&lt;br /&gt;
| New3DS&lt;br /&gt;
| Samsung&lt;br /&gt;
| 0x4D800000&lt;br /&gt;
|-&lt;br /&gt;
| New3DS&lt;br /&gt;
| Samsung&lt;br /&gt;
| 0x74800000&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Format===&lt;br /&gt;
Reading of the flash chip is possible through pinouts on the motherboard and has been performed successfully but the data is encrypted and can&#039;t be understood without first decrypting it.&lt;br /&gt;
&lt;br /&gt;
===Region Changing===&lt;br /&gt;
See [https://gist.github.com/yellows8/f15be7a51c38cea14f2c here].&lt;br /&gt;
&lt;br /&gt;
===Redirection to SD card===&lt;br /&gt;
See [[NAND_Redirection]].&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&lt;br /&gt;
The NAND file system is encrypted using [[AES|AES-CTR]]. The TWL regions of NAND use the TWL NAND [[AES|keyslot]], while the CTR regions use the CTR NAND [[AES|keyslots]]. The keyslot used for each partition is determined by the NCSD partition FS type and encryption type. The TWL/CTR NAND regions are specified by the NCSD header. The first 0x0B100000 bytes of NAND is encrypted with the TWL keyslot, however before 0x00012E00 only the MBR partition table is encrypted with the TWL keyslot. That region contains the TWL partitions listed below.&lt;br /&gt;
&lt;br /&gt;
The New3DS CTRNAND partition uses a [[AES|keyslot]] separate from the Old3DS one.&lt;br /&gt;
&lt;br /&gt;
Note that re-encrypting a NAND image alone from another 3DS for use on a different 3DS is not enough to use that NAND image on a different 3DS: certain files in the &amp;quot;nand&amp;quot; partition would need modified/replaced as well.&lt;br /&gt;
&lt;br /&gt;
===NAND structure===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  New3DS&lt;br /&gt;
!  Partition name&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  NCSD partition FS type&lt;br /&gt;
!  NCSD partition encryption type&lt;br /&gt;
!  NCSD partition index&lt;br /&gt;
!  [[AES_Registers|AES]] engine keyslot&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|  [[NCSD]] header, this contains the offsets/sizes of the below CTR-NAND partitions. This block also contains the TWL-NAND MBR partition table.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x00000000&lt;br /&gt;
|  0x0B100000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x00&lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL NAND region&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ffccbb&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
| &lt;br /&gt;
| 0x00012C00&lt;br /&gt;
| 0x200&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| See below.&lt;br /&gt;
| Console-unique encrypted New3DS key-storage, see below.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  twln&lt;br /&gt;
|  0x00012E00&lt;br /&gt;
|  0x08FB5200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL-NAND FAT16 File System. (DSi)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  twlp&lt;br /&gt;
|  0x09011A00&lt;br /&gt;
|  0x020B6600&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL-NAND PHOTO FAT12 File System. (DSi)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B100000&lt;br /&gt;
|  0x00030000&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x07&lt;br /&gt;
|  By default this partition is empty(only contains 0x00/0xFF bytes since it was never written to), when AGB_FIRM was never launched. This contains the AGB_FIRM GBA savegame.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  firm0&lt;br /&gt;
|  0x0B130000&lt;br /&gt;
|  0x00400000&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x06&lt;br /&gt;
|  [[FIRM|Firmware]] partition.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  firm1&lt;br /&gt;
|  0x0B530000&lt;br /&gt;
|  0x00400000&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x06&lt;br /&gt;
|  [[FIRM|Firmware]] partition.(Backup partition, same as above)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ffccbb&amp;quot; | No&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B930000&lt;br /&gt;
|  0x2F5D0000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x04&lt;br /&gt;
|  CTR-NAND partition. (3DS)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: #ffccbb&amp;quot; | No&lt;br /&gt;
|  nand&lt;br /&gt;
|  0x0B95CA00&lt;br /&gt;
|  0x2F3E3600&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  0x04&lt;br /&gt;
|  CTR-NAND FAT16 File System.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ffccbb&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B930000&lt;br /&gt;
|  0x41ED0000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x05&lt;br /&gt;
|  CTR-NAND partition. (New3DS)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: #ffccbb&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: #ccffbb&amp;quot; | Yes&lt;br /&gt;
|  nand&lt;br /&gt;
|  0x0B95AE00&lt;br /&gt;
|  0x41D2D200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  0x05&lt;br /&gt;
|  CTR-NAND FAT16 File System. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
3DS TWL NAND FAT partitions has FAT volume name &amp;quot;TWL&amp;quot;, for CTR FAT partitions this is &amp;quot;CTR&amp;quot;. The offset/size for TWL partitions are stored in the MBR partition table, while the CTR partition table info is stored in the NAND NCSD header. Sector0 in the CTR-NAND partition contains a MBR partition table for the nand FAT16 filesystem, and the MBR signature at +0x1fe.&lt;br /&gt;
&lt;br /&gt;
NAND sectors which were never written to before only contain plaintext 0x00 or 0xFF bytes.&lt;br /&gt;
&lt;br /&gt;
None of the NAND partitions are normally accessible from the ARM11, except for twlp. CTR/TWL NAND FS can only be accessed when the exheader access control descriptor for those are enabled. Normally the CTR/TWL NAND descriptors are never enabled for retail ARM11 [[NCCH#CXI|CXI]] processes. The ARM11 can only access &amp;quot;nand:/rw/&amp;quot; mounted as the nandrw [[FS:OpenArchive|archive]], and &amp;quot;nand:/ro/&amp;quot; mounted as the nandro archive below.&lt;br /&gt;
&lt;br /&gt;
==== 0x4000 ====&lt;br /&gt;
On some 3DS systems(such as 3DS XL), there&#039;s a plaintext FAT16 boot record located at NAND offset 0x4000. This block does not exist for launch-day 3DS systems. This is the only plaintext block for this &amp;quot;partition&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== 0x12C00 ====&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;
| 0x10&lt;br /&gt;
| Normal-key for keyslot 0x11, used for generating the rest of the New3DS keyslots&#039; keyX by decrypting various data with AES-ECB. With [[9.6.0-24|9.6.0-X]] this is only used for generating the keyX for keyslots 0x15 and 0x18.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]: Additional normal-key for keyslot 0x11, used for generating the keyX for keyslots 0x16 and 0x19..0x1F.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x1E0&lt;br /&gt;
| Not yet used as of New3DS FIRM [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This 0x200-byte sector contains New3DS keys, this entire sector is encrypted with a console-unique keyX+keyY. The keyX+keyY for this is generated by the New3DS [[FIRM|arm9bin-loader]]. Once the arm9bin-loader finishes decrypting this data, the keyX+keyY in the keyslot are then cleared, then the memory used for generating the keydata is disabled(after it finishes using it for TWL key init).&lt;br /&gt;
&lt;br /&gt;
This entire sector is encrypted with AES-ECB, the entire plaintext sector is identical for all retail and dev New3DS systems (differing between the two).&lt;br /&gt;
&lt;br /&gt;
=CTR partition=&lt;br /&gt;
The structure of [[nand/title]] appears to be exactly the same as [[SD Filesystem|SD]], except savegames are stored under the [[System SaveData|nand/data/&amp;lt;ID0&amp;gt;/sysdata]] directory instead.&lt;br /&gt;
The sub-directory name under [[nand/data]] is the SHA256 hash over the [[nand/private/movable.sed|movable.sed]] keyY. This nand/data/&amp;lt;ID0&amp;gt; directory is the NAND equivalent of the &amp;quot;sdmc/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;&amp;quot; directory, however the data contained here is stored in cleartext. The movable.sed keyY is only used for AES MACs for nand/data/&amp;lt;ID0&amp;gt;. The nand/data/&amp;lt;ID0&amp;gt;/extdata directory contains the shared [[extdata]], and is structured exactly the same way as SD extdata.&lt;br /&gt;
&lt;br /&gt;
 nand&lt;br /&gt;
 ├── __journal.nn_&lt;br /&gt;
 ├── [[nand/data|data]]&lt;br /&gt;
 │   └── &amp;lt;ID0&amp;gt;&lt;br /&gt;
 │       ├── [[Extdata|extdata]]          &lt;br /&gt;
 │       └── [[System SaveData|sysdata]]&lt;br /&gt;
 ├── [[Title Database|dbs]]&lt;br /&gt;
 ├── [[nand/fixdata|fixdata]]&lt;br /&gt;
 │   └── [[nand/fixdata/sysdata|sysdata]]&lt;br /&gt;
 ├── private&lt;br /&gt;
 │   └── [[nand/private/movable.sed|movable.sed]]&lt;br /&gt;
 ├── [[nand/ro|ro]]&lt;br /&gt;
 ├── [[nand/rw|rw]]&lt;br /&gt;
 ├── [[nand/ticket|ticket]] (This directory is empty since tickets are stored in [[Title Database|ticket.db]])&lt;br /&gt;
 ├── [[Title Data Structure|title]]&lt;br /&gt;
 └── [[nand/tmp|tmp]] (This is usually empty, even when installation for a system update still needs [[AMNet:FinishInstallToMedia|finalized]])&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;ro&amp;quot; and &amp;quot;rw&amp;quot; directories are accessible through the &amp;quot;nandrw&amp;quot; and &amp;quot;nandro&amp;quot; [[FS:OpenArchive|archives]], respectively. Their contents are as follows:&lt;br /&gt;
&lt;br /&gt;
 ro&lt;br /&gt;
 ├── [[nandro/private|private]]&lt;br /&gt;
 ├── [[nandro/shared|shared]]&lt;br /&gt;
 └── [[nandro/sys|sys]]&lt;br /&gt;
     ├── [[nandro/sys/HWCAL0.dat|HWCAL0.dat]]&lt;br /&gt;
     └── [[nandro/sys/HWCAL1.dat|HWCAL1.dat]]&lt;br /&gt;
 rw&lt;br /&gt;
 ├── [[nandrw/shared|shared]]&lt;br /&gt;
 └── [[nandrw/sys|sys]]&lt;br /&gt;
     ├── [[nandrw/sys/lgy.log|lgy.log]] (This is written to by [[FIRM|TWL_FIRM]] when errors occur, this is equivalent to native.log)&lt;br /&gt;
     ├── [[nandrw/sys/LocalFriendCodeSeed_B|LocalFriendCodeSeed_B]]&lt;br /&gt;
     ├── [[nandrw/sys/native.log|native.log]] (This is written to by [[ErrDisp]])&lt;br /&gt;
     ├── [[nandrw/sys/rand_seed|rand_seed]]&lt;br /&gt;
     ├── [[nandrw/sys/SecureInfo_A|SecureInfo_A]]&lt;br /&gt;
     └── [[nandrw/sys/updater.log|updater.log]]&lt;br /&gt;
&lt;br /&gt;
=TWL partition=&lt;br /&gt;
The structure of these TWL partitions is mostly the same as DSi, except tickets are stored in the CTR FAT FS. The twlp partition is exactly the same as DSi.&lt;br /&gt;
The structure of [[twln/title]] is exactly the same as CTR NAND/SD, except the .cmd file is a cleartext file.(This is likely a dummy file) The data directory under system titles&#039; /title directory does not exist, this likely only exists for DSiWare.&lt;br /&gt;
The directory names titleID-High used under [[twln/title]] is from DSi.&lt;br /&gt;
&lt;br /&gt;
 twln&lt;br /&gt;
 ├── [[twln/import/|import]]&lt;br /&gt;
 ├── [[twln/shared1/|shared1]]&lt;br /&gt;
 ├── [[twln/shared2/|shared2]]&lt;br /&gt;
 │   └── [[twln/shared2/0000|0000]]&lt;br /&gt;
 ├── [[twln/sys|sys]]&lt;br /&gt;
 │   ├── [[twln/sys/TWLFontTable.dat|TWLFontTable.dat]]&lt;br /&gt;
 │   └── [[twln/sys/log/|log]]&lt;br /&gt;
 │       ├── [[twln/sys/log/inspect.log|inspect.log]]&lt;br /&gt;
 │       └── [[twln/sys/log/product.log|product.log]]&lt;br /&gt;
 ├── [[twln/ticket/|ticket]]&lt;br /&gt;
 ├── [[twln/title/|title]]&lt;br /&gt;
 └── [[twln/tmp/|tmp]]&lt;br /&gt;
&lt;br /&gt;
 twlp&lt;br /&gt;
 └── [[twlp/photo/|photo]]&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FSPXI:CloseArchive&amp;diff=19116</id>
		<title>FSPXI:CloseArchive</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FSPXI:CloseArchive&amp;diff=19116"/>
		<updated>2017-01-01T06:02:54Z</updated>

		<summary type="html">&lt;p&gt;Plailect: Created page with &amp;quot;=Request= {| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot; |- !  Index Word !  Description |- | 0 | Header code [0x00160080] |- | 1 | Archive handle lower word |- | 2 | Archive handle upper wo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Request=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code [0x00160080]&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Archive handle lower word&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Archive handle upper word&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Response=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Result code&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FSPXI:CloseFile&amp;diff=19115</id>
		<title>FSPXI:CloseFile</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FSPXI:CloseFile&amp;diff=19115"/>
		<updated>2017-01-01T05:57:18Z</updated>

		<summary type="html">&lt;p&gt;Plailect: Created page with &amp;quot;=Request= {| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot; |- !  Index Word !  Description |- | 0 | Header code [0x000F0080] |- | 1 | File handle lower word |- | 2 | File handle upper word |}...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Request=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code [0x000F0080]&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| File handle lower word&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| File handle upper word&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Response=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Result code&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FSPXI:CreateFile&amp;diff=19114</id>
		<title>FSPXI:CreateFile</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FSPXI:CreateFile&amp;diff=19114"/>
		<updated>2017-01-01T05:55:33Z</updated>

		<summary type="html">&lt;p&gt;Plailect: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Request=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code [0x00050202]&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Transaction (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Archive handle lower word&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Archive handle upper word&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| LowPath.Type&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| LowPath.Size&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| [[Filesystem_services#Attributes|Attributes]]&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| File size lower word&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| File size upper word&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| (LowPath.Size&amp;lt;&amp;lt;8)  &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| LowPath.Data pointer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Response=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Result code&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FSPXI:CreateFile&amp;diff=19113</id>
		<title>FSPXI:CreateFile</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FSPXI:CreateFile&amp;diff=19113"/>
		<updated>2017-01-01T05:53:18Z</updated>

		<summary type="html">&lt;p&gt;Plailect: Created page with &amp;quot;=Request= {| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot; |- !  Index Word !  Description |- | 0 | Header code [0x00050202] |- | 1 | Transaction (usually 0) |- | 2 | File handle lower word |-...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Request=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code [0x00050202]&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Transaction (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| File handle lower word&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| File handle upper word&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| LowPath.Type&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| LowPath.Size&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| [[Filesystem_services#Attributes|Attributes]]&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| File size lower word&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| File size upper word&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| (LowPath.Size&amp;lt;&amp;lt;8)  &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; 4&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| LowPath.Data pointer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Response=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Result code&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=FSPXI:DeleteFile&amp;diff=19112</id>
		<title>FSPXI:DeleteFile</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=FSPXI:DeleteFile&amp;diff=19112"/>
		<updated>2017-01-01T05:47:05Z</updated>

		<summary type="html">&lt;p&gt;Plailect: Created page with &amp;quot;=Request= {| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot; |- !  Index Word !  Description |- | 0 | Header code [0x00020142] |- | 1 | Transaction (usually 0) |- | 2 | Archive handle lower word...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Request=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code [0x00020142]&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Transaction (usually 0)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Archive handle lower word&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Archive handle upper word&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| LowPath.Type&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| LowPath.Size&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| (LowPath.Size&amp;lt;&amp;lt;8)  &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; 4&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| LowPath.Data pointer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Response=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Index Word&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Header code&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Result code&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=User:Geekpersonman&amp;diff=17290</id>
		<title>User:Geekpersonman</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=User:Geekpersonman&amp;diff=17290"/>
		<updated>2016-05-09T23:12:28Z</updated>

		<summary type="html">&lt;p&gt;Plailect: Created page with &amp;quot;Stop editing every single page with &amp;quot;maybe,&amp;quot; that&amp;#039;s not actually helpful in any way.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stop editing every single page with &amp;quot;maybe,&amp;quot; that&#039;s not actually helpful in any way.&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=EShop&amp;diff=17264</id>
		<title>EShop</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=EShop&amp;diff=17264"/>
		<updated>2016-05-07T16:49:12Z</updated>

		<summary type="html">&lt;p&gt;Plailect: /* URLs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:eShop}}&lt;br /&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;
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 a decimal eShop content link id(same IDs used internally by eShop for all content) and then some special data, delimited by a dot symbol, which can be ommited.&lt;br /&gt;
&lt;br /&gt;
In order for the QR-code string data to be valid for eShop, it must begin with &amp;quot;ESHOP://5&amp;quot;, with the first ID being all decimal.&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 + cats: Golden Retriever &amp;amp; New Friends || ADAP || 0004000000030C00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000007870.PEAALL000000 || EUR || Crush 3D || ACRP || 0004000000040400&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008009.PEAALL000000 || EUR || Resident Evil Revelations || ABRE || 000400000005EE00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008123.J00101Z00095 || JPN || Rhythm Kaitou R: Koutei Napoleon no Isan || ARTJ || 0004000000078100&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008404.PEAALL000000 || EUR || Mario &amp;amp; Sonic at the London 2012 Olympic Games || ACMP || 0004000000054900&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008447.J00101Z00094 || JPN || Biohazard Revelations || ABRJ || 0004000000053B00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008449.J00101Z00082 || JPN || Itsu no Ma ni Koukan Nikki || JFRJ || 0004000000051600&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 || AMGJ || 000400000007A000&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008648.J00101Z00097 || JPN || Theatrythm Final Fantasy || ATHJ || 0004000000078200&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008782.PEAALL000000 || EUR || Metal Gear Solid Snake Eater 3D || AMGE || 0004000000082400&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000008842.PEAALL000000 || EUR || Rhythm Thief And The Emperor&#039;s Treasure || ARTP || 000400000006DA00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009084.J00101Z00121 || JPN || Hatsune Miku And Future Stars: Project Mirai || AM9J || 0004000000048000&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009102.J00101Z00106 || JPN || Denpa Ningen no RPG || JD8J || 0004000000077E00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009161.J00101Z00118 || JPN || The Rolling Western || JAMJ || 0004000000059B00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009261 || USA || Dillon&#039;s Rolling Western || JAME || 000400000007C400&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009401.J00101Z00120 || JPN || Kingdom Hearts 3D Nintendo Direct 2012.2.22 Video || JZ8J || 0004000000092E00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009403.J00101Z00119 || JPN || Dragon Quest Monsters: Terry no Wonderland 3D Nintendo Direct 2012.2.22 Video || JZ7J || 0004000000092F00&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009575.PEAALL000000 || EUR || Kid Icarus: Of Myths And Monsters (Virtual Console) || RBLP || 0004000000069500&lt;br /&gt;
|-&lt;br /&gt;
| ESHOP://50010000009846 || USA || Ketzal&#039;s Corridors || JELE || 0004000000083800&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;
== NS eShop application parameters ==&lt;br /&gt;
This section describes the 0x1C-byte structure stored at the application parameters from [[APT:StartApplication]], under the 0x300-byte buffer listed there.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&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;
| Unknown, usually 0x3?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown, usually 0x0?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| u64 binary eShop content ID, same ID from the first string in eShop QR-codes except in binary form.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| This is the last string from the QR-code(if any), no NUL-termination.&lt;br /&gt;
|}&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;br /&gt;
&lt;br /&gt;
== Music ==&lt;br /&gt;
The eShop pulls its music from a static, region-specific link in a format similar to the following: &lt;br /&gt;
&lt;br /&gt;
https:// a248.e.akamai.net/f/248/103046/10m/npdl.c.app.nintendowifi.net/p01/nsa/CtfKXACbUPl8s7lk/BGM1/US_BGM1 ,&lt;br /&gt;
where region is one of the primary system regions (JP, US, EU, KR, etc.) Support also exists for &#039;BGM2&#039;, but this seems to be unused.&lt;br /&gt;
The music is held in a [[SpotPass|BOSS]] container. &lt;br /&gt;
&lt;br /&gt;
The format consists of a brief XML header describing the audio (including the date it was set as the main eShop theme, loop times, size, etc) followed by a raw AAC stream. Tools such as FFmpeg can handle rebuilding this stream with ADTS headers for proper time info and such.&lt;br /&gt;
&lt;br /&gt;
The [[Home_Menu|Home Menu]] uses nearly the same format for the Theme Shop&#039;s background music.&lt;br /&gt;
&lt;br /&gt;
== URLs ==&lt;br /&gt;
&lt;br /&gt;
eShop uses the following domains over HTTPS:&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;
* 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;
ninja.ctr.shop.nintendo.net and samurai.ctr.shop.nintendo.net contain the bulk of the eShop information.&lt;br /&gt;
&lt;br /&gt;
Requests with the following parameters will always return XML unless the header &amp;quot;Accept: application/json&amp;quot; is used, in which case JSON will be returned.&lt;br /&gt;
&lt;br /&gt;
=== Common Parameters to ninja and samurai ===&lt;br /&gt;
&lt;br /&gt;
For every request to the ninja and samurai servers, three parameters are always sent, though are not necessarily required:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Parameter&lt;br /&gt;
!  Required&lt;br /&gt;
!  Description&lt;br /&gt;
!  Type&lt;br /&gt;
!  Normal value&lt;br /&gt;
|-&lt;br /&gt;
|  shop_id&lt;br /&gt;
|  depends on the URL, usually no&lt;br /&gt;
|  Describes which eShop instance should be used. 1 indicates the 3DS eShop, 2 indicates the Wii U eShop. 3 yields the same results as 2 but uses the img-eshop image server. 4 yields similar results as 3 but includes VC titles and updates, lacks image links for /titles and lacks release dates, prices and whether eShop and web sales are possible. For 4, links are given in both MP4 and Moflex formats for movies. Values greater than 4 or less than 1 are invalid. Defaults to 2 if not given.&lt;br /&gt;
|  unsigned integer&lt;br /&gt;
|  1&lt;br /&gt;
|-&lt;br /&gt;
|  lang&lt;br /&gt;
|  no&lt;br /&gt;
|  Describes the language. Seems to be an ISO 639-1 code in lower case. Every eShop region has a default language that is used if this parameter is not given. Some regions have multiple languages, such as CA (en and fr).&lt;br /&gt;
|  string (two characters)&lt;br /&gt;
|  depends on region and eShop settings; for US: en&lt;br /&gt;
|-&lt;br /&gt;
|  _type&lt;br /&gt;
|  no&lt;br /&gt;
|  Describes whether the client wants to receive JSON or XML. This parameter seems actually unused and the servers always return XML.&lt;br /&gt;
|  string&lt;br /&gt;
|  json&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== samurai ===&lt;br /&gt;
&lt;br /&gt;
samurai.ctr.shop.nintendo.net (samurai) provides metadata about titles. The samurai server provides the backend for the eShop title search.&lt;br /&gt;
&lt;br /&gt;
Common parameters described above can always be sent.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Path&lt;br /&gt;
!  Description&lt;br /&gt;
!  Parameters&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/titles&lt;br /&gt;
|  Fetches the title list, containing the content id (not the 3DS title id), the product code and the localized title name&lt;br /&gt;
|  All of these are optional.&lt;br /&gt;
* genre[]: genre ID (unsigned int)&lt;br /&gt;
* publisher[]: publisher ID (unsigned int)&lt;br /&gt;
* price_min: minimum price in region currency (signed int)&lt;br /&gt;
* price_max: maximum price in region currency (signed int)&lt;br /&gt;
* video_format: &amp;quot;moflex&amp;quot;&lt;br /&gt;
* freeword: keyword(s?) to look for (string)&lt;br /&gt;
* limit: maximum results&lt;br /&gt;
* offset: results to skip&lt;br /&gt;
* sort: one of &amp;quot;new&amp;quot;, &amp;quot;popular&amp;quot; or &amp;quot;score&amp;quot;&lt;br /&gt;
* release_date_before: date/time title must have been released before (UNIX timestamp prefixed by +)&lt;br /&gt;
* release_date_after: date/time title must have been released after (UNIX timestamp prefixed by -)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/news&lt;br /&gt;
|  eShop news section&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/telops&lt;br /&gt;
|  Scrolling news on the top screen&lt;br /&gt;
|  shop_id is required&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/directory/&#039;&#039;&#039;(long long unsigned int)&#039;&#039;&#039; and /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/directory/~&#039;&#039;&#039;(string)&#039;&#039;&#039;&lt;br /&gt;
|  Collections, like sales&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/title/&#039;&#039;&#039;content id&#039;&#039;&#039;&lt;br /&gt;
|  Returns information about the title, more verbose than /titles.&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/demo/&#039;&#039;&#039;content id&#039;&#039;&#039;&lt;br /&gt;
|  Returns information about a demo. Content ID is available in the main game&#039;s /title entry.&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/contents&lt;br /&gt;
|  Seems identical to /titles.&lt;br /&gt;
|  see /titles&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/genres&lt;br /&gt;
|  Returns a list of human-readable genre names and their corresponding genre id.&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/publishers&lt;br /&gt;
|  Returns a list of human-readable publisher names and their corresponding publisher id.&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/platforms&lt;br /&gt;
|  Returns a list of human-readable platform names and their corresponding platform id.&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /samurai/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/title/&#039;&#039;&#039;content id&#039;&#039;&#039;/aocs&lt;br /&gt;
|  Returns a list of add-on contents/downloadable content and prices in eShop region currency.&lt;br /&gt;
|  (none)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ninja ===&lt;br /&gt;
&lt;br /&gt;
ninja.ctr.shop.nintendo.net (ninja) contains the seeds for the new 9.6 crypto, pricing information and handles actions that require authentication, such as purchases. Authentication information seems to be obtained from the [[ACT_Services|act:u sysmodule]] and works through OAuth2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Path&lt;br /&gt;
!  Description&lt;br /&gt;
!  Parameters&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/title/&#039;&#039;&#039;content id&#039;&#039;&#039;/ec_info&lt;br /&gt;
|  Contains information about the title. Such as title id, content size, and if available, the 9.6 crypto seed&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/titles/id_pair&lt;br /&gt;
|  Provides the content id for the given title id, or vice versa.&lt;br /&gt;
|  title_id[] or ns_uid[] is required.&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/&#039;&#039;&#039;region&#039;&#039;&#039;/tax_locations&lt;br /&gt;
|  Provides the tax location ID&lt;br /&gt;
|  postal_code is required.&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/service_hosts&lt;br /&gt;
|  Provides CCIF and Samurai servers&lt;br /&gt;
|  country and shop_id is required.&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/country/&#039;&#039;&#039;region&#039;&#039;&#039;&lt;br /&gt;
|  Various eshop related information for a given region&lt;br /&gt;
|  (none)&lt;br /&gt;
|-&lt;br /&gt;
|  /ninja/ws/country/&#039;&#039;&#039;region&#039;&#039;&#039;/replenish_amounts&lt;br /&gt;
|  Provides the amounts of money you can replenish to your account.&lt;br /&gt;
|  (none)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Trusted Root CAs ===&lt;br /&gt;
The eShop application itself uses a [[HTTP_Services|RootCertChain]] for all HTTPS requests, all of the trusted root CAs are the following [[SSLC:RootCertChainAddDefaultCert|default]] ones:&lt;br /&gt;
* CertID 0x3&lt;br /&gt;
* CertID 0x6&lt;br /&gt;
* CertID 0x7&lt;br /&gt;
* CertID 0x8&lt;br /&gt;
* CertID 0x9&lt;br /&gt;
* CertID 0xA&lt;br /&gt;
&lt;br /&gt;
=== Server changes following the November 2, 2015, maintenance ===&lt;br /&gt;
Pre-v10.0 eShop used an URL like this: &amp;quot;%s/samurai/ws/%s/title/%llu/other_purchased?shop_id=1&amp;amp;lang=%s&amp;amp;_type=json&amp;quot;. That URL was removed with v10.0. That URL was requested when trying to load eShop app-pages. Following the maintenance mentioned above, this page was removed from the server, which broke pre-v10.0 eShop app whenever it tried to access that page.&lt;br /&gt;
&lt;br /&gt;
URL changes between [[9.7.0-25]] and [[10.0.0-27]] are (green = add, red = remove):&lt;br /&gt;
&lt;br /&gt;
%s/ninja/ws/%s/titles/online_prices?title%%5B%%5D=%s&amp;amp;lang=%s&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;&amp;amp;include_coupon=true&amp;lt;/span&amp;gt;&amp;amp;shop_id=1&amp;amp;_type=json&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/%s/coupon/!check?shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/my/owned_coupons?ns_uid=%llu&amp;amp;shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/my/owned_coupons?shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/my/parental_control/!put?shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/%s/title/%llu/prepurchase_info?%s=%s&amp;amp;shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/samurai/ws/%s/coupon/%llu/titles?lang=%s&amp;amp;limit=%u&amp;amp;offset=%u&amp;amp;shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/my/auto_billing/plans?limit=%u&amp;amp;offset=%u&amp;amp;shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/%s/titles/online_prices?title%%5B%%5D=%s&amp;amp;lang=%s&amp;amp;include_coupon=true&amp;amp;coupon_id=%llu&amp;amp;shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#00FF00&amp;quot;&amp;gt;%s/ninja/ws/my/auto_billing/%014llu/!cancel?shop_id=1&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;%s/samurai/ws/%s/title/%llu/other_purchased?shop_id=1&amp;amp;lang=%s&amp;amp;_type=json&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;%s/samurai/movie/%s/%s/%014llu/moflex&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==New3DS==&lt;br /&gt;
CheckNew3DS is called in two functions. This is only used for disabling UI button(s) for downloading New3DS titles when running on Old3DS. For example, on a New3DS patching a CheckNew3DS func-call with &amp;lt;retval=0&amp;gt;, results in the download button on the app page being grayed-out for a New3DS-only title.&lt;br /&gt;
&lt;br /&gt;
==TitleID checks==&lt;br /&gt;
There&#039;s titleID checks in the system eShop application code for &amp;quot;Pokémon Omega Ruby&amp;quot;. This appears to be used with UI-related code, unknown why.&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Userland_Flaws&amp;diff=17219</id>
		<title>3DS Userland Flaws</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Userland_Flaws&amp;diff=17219"/>
		<updated>2016-04-30T20:55:43Z</updated>

		<summary type="html">&lt;p&gt;Plailect: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists vulnerabilities / exploits for 3DS applications and applets. Exploiting these initially results in ROP, from that ROP one can then for example try exploiting [[3DS_System_Flaws|system]] flaw(s).&lt;br /&gt;
&lt;br /&gt;
=Non-system applications=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Application name&lt;br /&gt;
!  Summary&lt;br /&gt;
!  Description&lt;br /&gt;
!  Fixed in app/system version&lt;br /&gt;
!  Last app/system version this flaw was checked for&lt;br /&gt;
!  Timeframe info related to this was added to wiki&lt;br /&gt;
!  Timeframe this vuln was discovered&lt;br /&gt;
!  Vuln discovered by&lt;br /&gt;
|-&lt;br /&gt;
| Cubic Ninja&lt;br /&gt;
| Map-data stack smash&lt;br /&gt;
| See [[Ninjhax|here]] regarding Ninjhax.&lt;br /&gt;
| None&lt;br /&gt;
| App: Initial version. System: [[10.4.0-29]].&lt;br /&gt;
| Ninjhax release&lt;br /&gt;
| July 2014&lt;br /&gt;
| [[User:smea|smea]]&lt;br /&gt;
|-&lt;br /&gt;
| The Legend of Zelda: Ocarina of Time 3D&lt;br /&gt;
| UTF-16 name string buffer overflow via unchecked u8 length field&lt;br /&gt;
| The u8 at offset 0x2C in the savefile is the character-length of the UTF-16 string at offset 0x1C. When copying this string, it&#039;s essentially a memory-copy with lenval*2, not a string-copy. This can be used to trigger buffer overflows at various locations depending on the string length.&lt;br /&gt;
* When value is &amp;gt;=0x6E it crashes when saving the saveslot, this causes a stack-smash however it normally crashes before it returns from the function which had the stack-frame overwritten.&lt;br /&gt;
* With value &amp;gt;=0x9A, it crashes via stack-smash in-game once any dialogs are opened(touching buttons on the touch-screen can trigger it too).&lt;br /&gt;
* Length value&amp;gt;=0xCD causes a crash while loading the saveslot, via a heap buffer overflow. This buf-overflow overwrites a heap memchunk following the allocated buffer. When the first 16-bits overwriting that heap memchunk is not the memchunk magic-number(0x7373), the mem-alloc code will just return a NULL ptr which later results in a crash. When the magic-number is valid, the mem-alloc code will continue to attempt to parse the memchunk, which may crash depending on the data which overwrote the memchunk. This heap code is separate from the CTRSDK heap code. Exploiting this doesn&#039;t seem to be possible: since the heap code actually verifies that the magic-number for the next/prev memchunk ptrs are correct(unlike CTRSDK), it&#039;s not possible to change those ptrs to useful arbitrary addresses outside of savedata(like with triggering a write to a c++ object ptr which later is used with a vtable func-call, this is what one would do with CTRSDK heap here).&lt;br /&gt;
&lt;br /&gt;
On March 11, 2015, an exploit using this vuln was released, that one was intended for warez/etc. The following exploit wasn&#039;t released before then mainly because doing so would (presumably) result in the vuln being fixed. The following old exploit was released on March 14, 2015: [https://github.com/yellows8/oot3dhax].&lt;br /&gt;
| None&lt;br /&gt;
| App: Initial version. System: [[10.6.0-31]].&lt;br /&gt;
| March 11, 2015&lt;br /&gt;
| Around October 22, 2012&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Super Smash Bros 3DS&lt;br /&gt;
| Buffer overflow in local-multiplayer beacon handling.&lt;br /&gt;
| See [[smashbroshax|here]].&lt;br /&gt;
| App: v1.1.3&lt;br /&gt;
| See [[smashbroshax|here]]. System: [[10.3.0-28]].&lt;br /&gt;
| Time of exploit release.&lt;br /&gt;
| See [[smashbroshax|here]].&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Pokemon Super Mystery Dungeon&lt;br /&gt;
| Heap overflow within linear memory via unchecked save file length&lt;br /&gt;
| Pokemon Super Mystery Dungeon uses zlib compression for most of its save files, possibly due to the save files being larger than it&#039;s predecessor, Gates to Infinity. When a save file is being prepared to be loaded and read from, only a 0x32000 large buffer is allocated for file reading, and a 0x3e800-large buffer for decompression is also allocated before the file is read. However, the game does not limit the size of the file read to this allocation bound, allowing for the file to overflow into the linear memory heap and into the next allocation. Since Pokemon Super Mystery Dungeon stores allocation memchunks directly before the allocation, overwriting the next memchunk with a corrupted one allows for arbitrary writes of linear heap pointers when the next buffer is allocated or arbitrary writes of any pointer within writable memory when the corrupted buffer is freed.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.7.0-32]].&lt;br /&gt;
| Time of exploit release.&lt;br /&gt;
| April 14, 2016&lt;br /&gt;
| [[User:Shinyquagsire23|Shiny Quagsire]]&lt;br /&gt;
|-&lt;br /&gt;
| VVVVVV&lt;br /&gt;
| Buffer overflow in XML save file array parsing&lt;br /&gt;
| VVVVVV utilizes several XML files (renamed with a .vvv extension) to store level save data, stats and settings. Within these XML files are several tags containing an array of data which, when parsed, is not properly checked to be of proper length for the tag being parsed from. This allows for an overflow of 16-bit array values from the location where the array is parsed. With unlock.vvv, XML data is parsed to the stack, and with level saves the heap. This allows for the pointer where the level save worldmap tag array should be parsed into to be overwritten with a stack address, allowing for ROP from within the XML array parsing function on the next level load.&lt;br /&gt;
| None&lt;br /&gt;
| [[10.7.0-32]].&lt;br /&gt;
| Time of exploit release.&lt;br /&gt;
| April 25, 2016&lt;br /&gt;
| [[User:Shinyquagsire23|Shiny Quagsire]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Useless crashes / applications which were fuzzed==&lt;br /&gt;
* Pushmo (3DSWare), QR codes: level name is properly limited to 16 characters, game doesn&#039;t crash with a longer name. The only possible crashes are triggered by out-of-bounds array index values, these crashes are not exploitable due to the index value being 8bit.&lt;br /&gt;
&lt;br /&gt;
* Pyramids (3DSWare), QR codes: no strings. Only crashes are from out-of-bounds values (like background ID) and are not exploitable.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/yellows8/mm3d_re The Legend of Zelda: Majora&#039;s Mask 3D]&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;The Legend of Zelda: A Link Between Worlds&amp;quot; and &amp;quot;The Legend of Zelda: Tri Force Heroes&amp;quot;: these games don&#039;t crash at all when the entire save-file(minus constant header data) is overwritten with /dev/random output / 0xFF-bytes. All of the CRC32s were updated for this of course.&lt;br /&gt;
&lt;br /&gt;
* Pokemon Mystery Dungeon: Gates to Infinity has the same unchecked file bounds as Pokemon Super Mystery Dungeon, however since save compression was introduced in Pokemon Super Mystery Dungeon, it only allocates one buffer within the application heap instead of several within the linear heap, resulting in nothing to corrupt or overwrite even if the file&#039;s length is extended past it&#039;s allocation.&lt;br /&gt;
&lt;br /&gt;
==Crashes needing investigation==&lt;br /&gt;
* Disney Infinity crashes when all savedata overwritten with /dev/urandom. No checksums. 0xFF bytes don&#039;t cause a crash.&lt;br /&gt;
&lt;br /&gt;
* Football Up Online / Soccer Up Online and Football Up 3D / Soccer Up 3D crash when teamname(UTF-16) length = 0x48 AND 0x20 null bytes are removed after just the name or if teamname length is way longer than 0x48.&lt;br /&gt;
&lt;br /&gt;
=System applications=&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;
!  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;
| 3DS [[System Settings]] DS profile string stack-smash&lt;br /&gt;
| Too long or corrupted strings (01Ah  2   Nickname length in characters     050h  2   Message length in characters) in the NVRAM DS user settings (System Settings-&amp;gt;Other Settings-&amp;gt;Profile-&amp;gt;Nintendo DS Profile) cause it to crash in 3DS-mode due to a stack-smash. The DSi is not vulnerable to this, DSi launcher(menu) and DSi System Settings will reset the NVRAM user-settings if the length field values are too long(same result as when the CRCs are invalid). TWL_FIRM also resets the NVRAM user-settings when the string-length(s) are too long.&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| [[7.0.0-13]]&lt;br /&gt;
| 2012&lt;br /&gt;
| [[User:Ichfly|Ichfly]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=System applets=&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;
!  Fixed in version&lt;br /&gt;
!  Last version this flaw was checked for&lt;br /&gt;
!  Timeframe info related to this was added to wiki&lt;br /&gt;
!  Timeframe this was discovered&lt;br /&gt;
!  Discovered by&lt;br /&gt;
|-&lt;br /&gt;
| [[Home Menu]] [[System_SaveData|NAND-savedata]] Launcher.dat icons&lt;br /&gt;
| The homemenu code processing the titleid list @ launcherdat+8 copies those titleIDs to another buffer, where the offset relative to that buffer is calculated using the corresponding s8/s16 entries. Those two values are not range checked at all. Hence, one can use this to write u64(s) with arbitrary values to before/after this allocated output buffer. See [[Home_Menu|here]] regarding Launcher.dat structure.&lt;br /&gt;
&lt;br /&gt;
This can be exploited(with Launcher.dat loading at startup at least) by using a s16 for the icon entry with value 0xFFEC(-20)(and perhaps more icons with similar s16 values to write multiple u64s). The result is that the u64 value is written to outbuf-0xA0, which overwrites object+0(vtable) and object+4(doesn&#039;t matter here) for an object that gets used a bit after the vulnerable function triggers. The low 32bits of the u64 can then be set to the address of controlled memory(either outbuf in regular heap or the entire launcherdat buffer in linearmem), for use as a fake vtable in order to get control of PC. From there one can begin ROP via vtable funcptrs to do a stack-pivot(r4=objectaddr at the time the above object gets used).&lt;br /&gt;
&lt;br /&gt;
Originally this vuln could only be triggered via Launcher.dat at Home Menu startup, right after Launcher.dat gets loaded + memory gets allocated, once the file-format version code is finished running. Starting with v9.6 this can be triggered when loading layouts from SD extdata as well. The vuln itself triggers before the layout data is written to Launcher.dat, but it doesn&#039;t seem to be possible to overwrite anything which actually gets used before the function which writes Launcher.dat into the layout gets called.&lt;br /&gt;
&lt;br /&gt;
Home Menu has some sort of fail-safe system(or at least on v9.7) when Home Menu crashes due to Launcher.dat(this also applies for other things with Home Menu): after crashing once, Home Menu resets Launcher.dat to a state where it no longer crashes anymore. However, note that any exploits using this which hang/etc without crashing will still brick the system. &#039;&#039;&#039;Hence, attempting anything with this on physnand without hw-nand-access isn&#039;t really recommended.&#039;&#039;&#039;&lt;br /&gt;
| None&lt;br /&gt;
| [[10.3.0-28|10.3.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| May 14, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Home Menu]] theme-data decompression buffer overflow ([[menuhax|themehax]])&lt;br /&gt;
| The only func-call size parameter used by the theme decompression function is one for the compressed size, none for the decompressed size. The decompressed-size value from the LZ header is used by this function to check when to stop decompressing, but this function itself has nothing to verify the decompressed_size with. The code calling this function does not check or even use the decompressed size from the header either.&lt;br /&gt;
&lt;br /&gt;
This function is separate from the rest of the Home Menu code: the function used for decompressing themes is *only* used for decompressing themes, nothing else. There&#039;s a separate decompression function in Home Menu used for decompressing everything else.&lt;br /&gt;
&lt;br /&gt;
That other decompression function in Home Menu handles decompression size properly(decompressed size check for max buffer size is done by code calling the other function, not in the function itself). Unlike the other function, the theme function supports multiple LZ algorithms, but the one which actually gets used in official themes is the same one supported by the other function anyway.&lt;br /&gt;
&lt;br /&gt;
See also [[menuhax|here]].&lt;br /&gt;
&lt;br /&gt;
With [[10.2.0-28|10.2.0-X]] Home Menu, the only code change was that the following was added right after theme-load and before actual decompression: &amp;quot;if(&amp;lt;get_lzheader_decompressed_size&amp;gt;(compressed_buf) &amp;gt; 0x150000)&amp;lt;exit&amp;gt;;&amp;quot;. This fixed the vuln.&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| December 22, 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Myria|Myria]] independently (~spring 2015)&lt;br /&gt;
|-&lt;br /&gt;
| [[Home Menu]] shuffle body-data buffer overflow ([[menuhax|shufflehax]])&lt;br /&gt;
| See [[menuhax|here]].&lt;br /&gt;
| [[10.6.0-31|10.6.0-X]]&lt;br /&gt;
| [[10.6.0-31|10.6.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| January 3, 2015&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|-&lt;br /&gt;
| Webkit/web-browser bugs&lt;br /&gt;
| spider has had at least three different code-execution exploits. Majority of them are use-after-free issues. See also [[browserhax|here]].&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| 2013?&lt;br /&gt;
|&lt;br /&gt;
| A lot of people.&lt;br /&gt;
|-&lt;br /&gt;
| Old3DS/New3DS [[Internet_Browser|Browser-version-check]] bypass&lt;br /&gt;
| When the browser-version-check code runs where the savedata for it was never initialized(such as when the user used the &amp;quot;Initialize savedata&amp;quot; option), it will use base_timestamp=0 instead of the timestamp loaded from savedata. This is then used with &amp;quot;if(cur_timestamp - base_timestamp &amp;gt;= &amp;lt;24h timestamp&amp;gt;){Run browser-version-check HTTPS request code}&amp;quot;.&lt;br /&gt;
Hence, if the savedata was just initialized, and if the system datetime is set to before January 2, 2000, the browser-version-check will be skipped. This includes January 1, 2000, 00:00, because that&#039;s the epoch(timestamp value 0x0) used with this timestamp.&lt;br /&gt;
&lt;br /&gt;
See [http://yls8.mtheall.com/3dsbrowserhax.php here] for bypass usage instructions.&lt;br /&gt;
&lt;br /&gt;
This was fixed with [[10.7.0-32|10.7.0-32]], see [[Internet_Browser|here]] for details.&lt;br /&gt;
| [[10.7.0-32|10.7.0-32]]&lt;br /&gt;
| &lt;br /&gt;
| February 25, 2016&lt;br /&gt;
| November 2, 2015 (Exactly one week after the browser version pages were initially updated server-side)&lt;br /&gt;
| [[User:Yellows8|Yellows8]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Useless crashes==&lt;br /&gt;
Old3DS system web-browser:&lt;br /&gt;
* 2^32 characters long string(&#039;&#039;finally&#039;&#039; fixed with v10.6): this is similar to the vulnerability fixed [http://git.chromium.org/gitweb/?p=external/Webkit.git;a=commitdiff;h=ec471f16fbd1f879cb631f9b022fd16acd75f4d4 here], concat-large-strings-crash2.html triggers a crash which is about the same as the one triggered by a 2^32 string. Most of the time this vulnerability will cause a memory page permissions fault, since the WebKit code attempts to copy the string text data to the output buffer located in read-only [[CRO0|CRO]] heap memory. The only difference between a crash triggered by a 2^32 string and the concat-large-strings-crash2.html crash is at the former copies the string data using the original string length(like 1 text character for &amp;quot;x&amp;quot;, 4 for &amp;quot;xxxx&amp;quot;) while the latter attempts to copy &amp;gt;12MB. In some &#039;&#039;very&#039;&#039; rare cases a thread separate from the string data-copy thread will crash, this might be exploitable. However, this is mostly useless since it rarely crashes this way.&lt;br /&gt;
&lt;br /&gt;
* Trying to directly load a page via the browser &amp;quot;URL&amp;quot; option with [https://github.com/yellows8/3ds_browserhax_common webkitdebug] setup, causes a crash to trigger in oss.cro due to an use-after-free being caught with webkitdebug. This is presumably some sort of realloc() issue in the libcurl version used by the &amp;lt;={v10.2-v10.3} browser. This happens with *every* *single* *page* one tries to load via the &amp;quot;URL&amp;quot; option, but not when loading links on the current page, hence this is probably useless. A different use-after-free with realloc triggers with loading any page at all regardless of method too(libcurl probably).&lt;br /&gt;
&lt;br /&gt;
* This WebKit build has &#039;&#039;a lot&#039;&#039; of crash-trigger bugs that only happen with [https://github.com/yellows8/3ds_browserhax_common webkitdebug] completely setup(addr accesses near 0x0), with &#039;&#039;just&#039;&#039; trying to load any page at all.&lt;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16036</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16036"/>
		<updated>2016-03-15T00:17:10Z</updated>

		<summary type="html">&lt;p&gt;Plailect: fine&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Console-unique keys seem to be derived from here, though it is unknown how. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is very likely the console-unique data store, including [[CTCert]] and other unit info values, that ends up in ITCM at 0x01FFB800. Bootrom would decrypt it, check for magic (0xDEADB00F), and then set CFG_UNITINFO, etc to match the specific console at hand. This is a guess based on the matching size of both sets of data (ITCM&#039;s is padded to 0x100, specifically) and the lack of another known source for this data on the system (it is not sourced from eMMC). On top of this, the latter half of this data is likely used as console-unique keydata, thus explaining ITCM&#039;s copy being memcleared and the OTP lock mechanism existing.  &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]]. It is unknown if bootrom reads from it, but it is likely.&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. This data appears to be random, even when multiple consoles&#039; dumps from this area are XORed. None of the raw data here seems to match any of the console-unique keys (tested: keyX, keyY and normal-key, both big and little u32 endianness for all keyslots) for the AES engine. It&#039;s unknown whether there&#039;s any encryption on this area.&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;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16034</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16034"/>
		<updated>2016-03-15T00:01:01Z</updated>

		<summary type="html">&lt;p&gt;Plailect: if we&amp;#039;re going by firm version rather than system version we may as well be specific&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Console-unique keys seem to be derived from here, though it is unknown how. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is very likely the console-unique data store, including [[CTCert]] and other unit info values, that ends up in ITCM at 0x01FFB800. Bootrom would decrypt it, check for magic (0xDEADB00F), and then set CFG_UNITINFO, etc to match the specific console at hand. This is a guess based on the matching size of both sets of data (ITCM&#039;s is padded to 0x100, specifically) and the lack of another known source for this data on the system (it is not sourced from eMMC). On top of this, the latter half of this data is likely used as console-unique keydata, thus explaining ITCM&#039;s copy being memcleared and the OTP lock mechanism existing.  &lt;br /&gt;
&lt;br /&gt;
On [[FIRM]] versions prior to 2.32-15 ([[3.0.0-6|3.0.0-X]]), this region was left unprotected. On versions since 2.32-15 ([[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]]. It is unknown if bootrom reads from it, but it is likely.&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. This data appears to be random, even when multiple consoles&#039; dumps from this area are XORed. None of the raw data here seems to match any of the console-unique keys (tested: keyX, keyY and normal-key, both big and little u32 endianness for all keyslots) for the AES engine. It&#039;s unknown whether there&#039;s any encryption on this area.&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;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16028</id>
		<title>OTP Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=OTP_Registers&amp;diff=16028"/>
		<updated>2016-03-14T20:37:59Z</updated>

		<summary type="html">&lt;p&gt;Plailect: clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Console-unique keys seem to be derived from here, though it is unknown how. Access to this region is disabled once the ARM9 writes 0x2 to [[CONFIG|REG_SYSPROT9]].&lt;br /&gt;
&lt;br /&gt;
This is very likely the console-unique data store, including [[CTCert]] and other unit info values, that ends up in ITCM at 0x01FFB800. Bootrom would decrypt it, check for magic (0xDEADB00F), and then set CFG_UNITINFO, etc to match the specific console at hand. This is a guess based on the matching size of both sets of data (ITCM&#039;s is padded to 0x100, specifically) and the lack of another known source for this data on the system (it is not sourced from eMMC). On top of this, the latter half of this data is likely used as console-unique keydata, thus explaining ITCM&#039;s copy being memcleared and the OTP lock mechanism existing.  &lt;br /&gt;
&lt;br /&gt;
On versions &amp;lt;[[3.0.0-6|3.0.0-X]], the [[OTP Registers|0x10012000]]-region was left unprotected. On versions &amp;gt;[[3.0.0-6|3.0.0-X]], the console-unique TWL keyinit + region disable was done by Kernel9 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 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]]. It is unknown if bootrom reads from it, but it is likely.&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. This data appears to be random, even when multiple consoles&#039; dumps from this area are XORed. None of the raw data here seems to match any of the console-unique keys (tested: keyX, keyY and normal-key, both big and little u32 endianness for all keyslots) for the AES engine. It&#039;s unknown whether there&#039;s any encryption on this area.&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;/div&gt;</summary>
		<author><name>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=16023</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=16023"/>
		<updated>2016-03-14T18:00:49Z</updated>

		<summary type="html">&lt;p&gt;Plailect: /* arm9loader */&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;
| 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;
| [[10.4.0-29|10.4.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 (System Update firm partition writes can be blocked by patching System calls at boot time). 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&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.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;
| None&lt;br /&gt;
| [[10.3.0-28|10.3.0-X]]&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;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| None&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[10.0.0-27|10.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;
| [[10.2.0-28|10.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;
| [[10.2.0-28|10.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]] and instead blocked access to the [[OTP Registers|OTP Registers]] itself, presumably under the assumption that an attacker would never gain code execution under Kernel9. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!) to an attacker with sufficient privileges. 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, [[User:Plailect|Plailect]] (hardware-less public implementation)&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;
| [[10.2.0-28|10.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) requires patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
|  None&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&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;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &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;
|  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;
| [[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;
| [[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>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=16022</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=16022"/>
		<updated>2016-03-14T17:51:25Z</updated>

		<summary type="html">&lt;p&gt;Plailect: /* Kernel9 */&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;
| 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;
| [[10.4.0-29|10.4.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&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.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;
| None&lt;br /&gt;
| [[10.3.0-28|10.3.0-X]]&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;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| None&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[10.0.0-27|10.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;
| [[10.2.0-28|10.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;
| [[10.2.0-28|10.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]] and instead blocked access to the [[OTP Registers|OTP Registers]] itself, presumably under the assumption that an attacker would never gain code execution under Kernel9. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!) to an attacker with sufficient privileges. 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, [[User:Plailect|Plailect]] (hardware-less public implementation)&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;
| [[10.2.0-28|10.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) requires patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
|  None&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&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;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &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;
|  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;
| [[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;
| [[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>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=16021</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=16021"/>
		<updated>2016-03-14T17:47:19Z</updated>

		<summary type="html">&lt;p&gt;Plailect: /* Kernel9 */&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;
| 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;
| [[10.4.0-29|10.4.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&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.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;
| None&lt;br /&gt;
| [[10.3.0-28|10.3.0-X]]&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;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| None&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[10.0.0-27|10.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;
| [[10.2.0-28|10.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;
| [[10.2.0-28|10.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]] and instead blocked access to the [[OTP Registers|OTP Registers]] itself, presumably under the assumption that an attacker would never gain code execution under Kernel9. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!) to an attacker with sufficient privileges. 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 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, [[User:Plailect|Plailect]] (hardware-less public implementation)&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;
| [[10.2.0-28|10.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) requires patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
|  None&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&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;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &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;
|  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;
| [[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;
| [[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>Plailect</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_System_Flaws&amp;diff=16020</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=16020"/>
		<updated>2016-03-14T17:44:42Z</updated>

		<summary type="html">&lt;p&gt;Plailect: /* Kernel9 */&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;
| 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;
| [[10.4.0-29|10.4.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&lt;br /&gt;
| None&lt;br /&gt;
| [[10.4.0-29|10.4.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;
| None&lt;br /&gt;
| [[10.3.0-28|10.3.0-X]]&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;
| Bypassing title version check at installation, which then allows downgrading any title.&lt;br /&gt;
| None&lt;br /&gt;
| NATIVE_FIRM / AM-sysmodule [[10.0.0-27|10.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;
| [[10.2.0-28|10.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;
| [[10.2.0-28|10.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]] and instead blocked access to the [[OTP Registers|OTP Registers]] itself, presumably under the assumption that an attacker would never gain code execution under Kernel9. This leaves the [[OTP Registers|0x10012000]]-region unprotected (this region should be locked early during boot!) to an attacker with sufficient privileges. 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 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]], and 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, [[User:Plailect|Plailect]] (hardware-less public implementation)&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;
| [[10.2.0-28|10.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) requires patching the kernel .text or modifying SVC-access-control.&lt;br /&gt;
| See description&lt;br /&gt;
|  None&lt;br /&gt;
| [[10.2.0-28|10.2.0-X]]&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;
| [[10.2.0-28|10.2.0-X]]&lt;br /&gt;
| &lt;br /&gt;
| &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;
|  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;
| [[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;
| [[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>Plailect</name></author>
	</entry>
</feed>