<?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=Thedax</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=Thedax"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/Thedax"/>
	<updated>2026-04-18T13:09:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Userland_Flaws&amp;diff=15416</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=15416"/>
		<updated>2016-01-19T02:53:20Z</updated>

		<summary type="html">&lt;p&gt;Thedax: &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.3.0-28]].&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.4.0-29]].&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;
| None&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;
&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;
=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 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;
| 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;
| December 22, 2014&lt;br /&gt;
| [[User:Yellows8|Yellows8]], [[User:Myria|Myria]] independently (~spring 2015)&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;
| A lot of people.&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(still affects latest spider version as of system-version v10.3): 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>Thedax</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=NWM_Services&amp;diff=14118</id>
		<title>NWM Services</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=NWM_Services&amp;diff=14118"/>
		<updated>2015-10-20T05:59:40Z</updated>

		<summary type="html">&lt;p&gt;Thedax: Added an error section with one error.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Services]]&lt;br /&gt;
&lt;br /&gt;
These NWM services are used for local-WLAN communications, NWM module handles regular wifi APs as well. These services are used for creating/connecting to networks, and for sending/receiving data over the network etc. NWM module uses the wifi SDIO hardware via the IO registers for this.&lt;br /&gt;
&lt;br /&gt;
=NWM local-WLAN service &amp;quot;nwm::UDS&amp;quot;=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Command Header&lt;br /&gt;
!  Available since system version&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00010442&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00020000&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00030000&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:Shutdown|Shutdown]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00040402&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00050040&lt;br /&gt;
|&lt;br /&gt;
| [[NWMUDS:EjectClient|EjectClient]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00060000&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00070080&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:UpdateNetworkAttribute|UpdateNetworkAttribute]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080000&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:DestroyNetwork|DestroyNetwork]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00090442&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x000A0000&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:DisconnectNetwork|DisconnectNetwork]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x000B0000&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:GetConnectionStatus|GetConnectionStatus]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x000C0000&lt;br /&gt;
| &lt;br /&gt;
| This writes two output u8 values to cmdreply[2] +0/+1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x000D0040&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:GetNodeInformation|GetNodeInformation]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x000E0006&lt;br /&gt;
| &lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x000F0404&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:RecvBeaconBroadcastData|RecvBeaconBroadcastData]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00100042&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:SetBeaconAdditionalData|SetBeaconAdditionalData]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00110040&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:GetApplicationData|GetApplicationData]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00120100&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:Bind|Bind]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00130040&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:Unbind|Unbind]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x001400C0&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:RecvBroadcastDataFrame|RecvBroadcastDataFrame]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00150080&lt;br /&gt;
| &lt;br /&gt;
| (u32 unk0, u32 unk1) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00160040&lt;br /&gt;
| &lt;br /&gt;
| (u8 inputval) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00170182&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:SendTo|SendTo]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00180040&lt;br /&gt;
| &lt;br /&gt;
| (u16 inputval) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x001A0000&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:GetChannel|GetChannel]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x001B0302&lt;br /&gt;
| &lt;br /&gt;
| [[NWMUDS:Initialize|Initialize]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x001C0040&lt;br /&gt;
| &lt;br /&gt;
| (u8 inputval) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x001D0044&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| [[NWMUDS:BeginHostingNetwork|BeginHostingNetwork]] This appears to be a replacement for the original network-creation command(newer titles don&#039;t use the original one anymore).&lt;br /&gt;
|-&lt;br /&gt;
| 0x001E0084&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| [[NWMUDS:ConnectToNetwork|ConnectToNetwork]] This appears to be a replacement for the original network-connection command(newer titles don&#039;t use the original one anymore).&lt;br /&gt;
|-&lt;br /&gt;
| 0x001F0006&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| [[NWMUDS:DecryptBeaconData|DecryptBeaconData]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00200040&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| (u8 inputval) ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00210080&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| [[NWMUDS:SetProbeResponseParam|SetProbeResponseParam]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00220402&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| [[NWMUDS:ScanOnConnection|ScanOnConnection]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00230000&lt;br /&gt;
| Unknown, &amp;gt;[[2.0.0-2]]&lt;br /&gt;
| This writes an output u16 value to cmdreply[2].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=NWM infrastructure service &amp;quot;nwm::INF&amp;quot;=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Command Header&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x000603C4&lt;br /&gt;
| [[NWMINF:RecvBeaconBroadcastData|RecvBeaconBroadcastData]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x00070742&lt;br /&gt;
| [[NWMINF:ConnectToEncryptedAP|ConnectToEncryptedAP]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x0008....&lt;br /&gt;
| [[NWMINF:ConnectToAP|ConnectToAP]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=NWM socket service &amp;quot;nwm::SOC&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
=NWM service &amp;quot;nwm::SAP&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
=NWM local-WLAN [[StreetPass]] service &amp;quot;nwm::CEC&amp;quot;=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Command Header&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00060002&lt;br /&gt;
| Unknown, called by CECD module, cmdbuf[2] takes an event handle&lt;br /&gt;
|-&lt;br /&gt;
| 0x000D0082&lt;br /&gt;
| [[NWMCEC:SendProbeRequest|SendProbeRequest]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=NWM service &amp;quot;nwm::EXT&amp;quot;=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Command Header&lt;br /&gt;
!  Available since system version&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0001....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0002....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0003....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0004....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0005....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0006....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x00070000&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| This copies 0x1C-bytes from NWM-module state to the data starting at cmdreply[2].&lt;br /&gt;
|-&lt;br /&gt;
| 0x00080040&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| [[NWMEXT:ControlWirelessEnabled|ControlWirelessEnabled]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x0009....&lt;br /&gt;
| &amp;lt;=[[2.0.0-2]]&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=NWM service &amp;quot;nwm::TST&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
=Local-WLAN=&lt;br /&gt;
UDS is used for 3DS&amp;lt;&amp;gt;3DS local-WLAN communications, and for 3DS&amp;lt;&amp;gt;Wii U communications. The latter is mainly only used for multi-player in games.&lt;br /&gt;
&lt;br /&gt;
All UDS local-WLAN communications have the CCMP key for data encryption generated via NWM module. The CCMP key passed to nwm::CEC commands(stored in a 0x44-byte input structure) for [[StreetPass]] is generated by the CECD module. The input data used with [[Process_Services|EncryptDecryptAes]] with [[PSPXI:EncryptDecryptAes|keytype1]] is a MD5 hash over an input passphrase. This input passphrase is fixed for [[Download Play]], it&#039;s unique per local-WLAN protocol. The CTR is a MD5 hash over the below 0x10-byte structure. The output from encrypting that data with AES-CTR is the final CCMP key.&lt;br /&gt;
&lt;br /&gt;
==Structure used for generating the CTR for CCMP key generation==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Local-WLAN communication ID, normally this is: (user_process [[Title_list|uniqueID]] &amp;lt;&amp;lt; 8) | val. Where val is 0x10 on retail([[Configuration_Memory|configmem]] UNITINFO bit0 set), 0x90 for devunit. For [[Download Play]], this is always 0x2810 on retail(0x2890 on devunit).&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32 networkID, randomly-generated when creating the network. The network SSID used when a client connects to the network is sprintf(out, &amp;quot;%08X&amp;quot;, networkID).&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x6&lt;br /&gt;
| Host MAC address.&lt;br /&gt;
|-&lt;br /&gt;
| 0xE&lt;br /&gt;
| 0x2&lt;br /&gt;
| ID, for [[Download Play]] this is 0x55.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This data is stored as little-endian.&lt;br /&gt;
&lt;br /&gt;
==CTR used for beacon tags crypto==&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;
| 0x6&lt;br /&gt;
| Host MAC address&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 0x4&lt;br /&gt;
| wlancommID&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| 0x1&lt;br /&gt;
| This ID is also stored at offset 0xE in the CTR-generation structure.&lt;br /&gt;
|-&lt;br /&gt;
| 0xB&lt;br /&gt;
| 0x1&lt;br /&gt;
| Padding, value zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| This is the u32 from offset 0x18 in the network-struct.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This data is stored as little-endian. All data here is all-zero except for the MAC address, when the u8 at offset 0x8 in the network-struct is 0.&lt;br /&gt;
&lt;br /&gt;
==Network structure==&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;
| 0x6&lt;br /&gt;
| This is the MAC address of the host. This is all-zero on the host, like with [[NWMUDS:BeginHostingNetwork]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x1&lt;br /&gt;
| This is non-zero when at least one entry is stored in the array under the encrypted beacon data.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x3&lt;br /&gt;
| This is the OUI value for use with the beacon tags. Normally this is 001F32.&lt;br /&gt;
|-&lt;br /&gt;
| 0xF&lt;br /&gt;
| 0x1&lt;br /&gt;
| OUI type (21/0x15)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| wlancommID&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x1&lt;br /&gt;
| This ID is also stored at offset 0xE in the CTR-generation structure.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| 0x1&lt;br /&gt;
| This is the total number of entries stored under the array in the encrypted beacon data.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Size of additional data. Normally zero.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0xC8&lt;br /&gt;
| Additional data, if any. Size of the additional data is specified via the u8 at offset 0x3F. This data is not used when the size-field is zero.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This 0x108-byte structure is used for [[NWMUDS:BeginHostingNetwork]], [[NWMUDS:ConnectToNetwork]], etc. This data is stored as big-endian.&lt;br /&gt;
&lt;br /&gt;
== UDS Beacons ==&lt;br /&gt;
The UDS host broadcasts a beacon containing at least two Nintendo-vendor tags(tag number 0xDD, see above for the OUI), normally the data stored in these tags are static. The second tag contains the big-endian u32 networkID, used by the clients when connecting to the host and for the above CCMP key generation. The Nintendo-vendor tag(s) following the first two are unique to the process using UDS, these tags are used for broadcasting metadata regarding the host.&lt;br /&gt;
&lt;br /&gt;
A tool for these beacons is available here: [https://github.com/yellows8/ctr-wlanbeacontool]&lt;br /&gt;
&lt;br /&gt;
=== UDS Beacon Tags ===&lt;br /&gt;
The following is the structure of each tag, starting at the OUI. The order of the tags is the same as listed below. All data stored under these tags are stored as big-endian.&lt;br /&gt;
&lt;br /&gt;
==== OUI Type 20 ====&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;
| 0x3&lt;br /&gt;
| OUI, see above.&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| OUI type (20/0x14)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x3&lt;br /&gt;
| Sample data: 0a 00 00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Normally the size of this tag(from the tag size field) is 0x07.&lt;br /&gt;
&lt;br /&gt;
==== OUI Type 21 ====&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;
| 0x1F&lt;br /&gt;
| This is the network structure starting at offset 0xC, with the first 0x1F-bytes from there.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| 0x14&lt;br /&gt;
| SHA1 hash. When doing the hashing, this hash is cleared to zero. The hash data starts at offset 0x0(OUI), and the size is 0x34 + &amp;lt;value of the u8 at offset 0x33&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x33&lt;br /&gt;
| 0x1&lt;br /&gt;
| Size of additional data. Normally zero. When non-zero this additional data is located at offset 0x34.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Normally the size of this tag(from the tag size field) is 0x34.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== OUI Type 24 ====&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;
| 0x3&lt;br /&gt;
| OUI, see above.&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| OUI type (24/0x18)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| See below&lt;br /&gt;
| Encrypted data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is the tag0 used with [[NWMUDS:DecryptBeaconData]]. The size of data stored under this tag has a maximum size of 0xFA-bytes, however normally the size is smaller than that. Additional encrypted data, if any, is stored under the below tag1.&lt;br /&gt;
&lt;br /&gt;
==== OUI Type 25 ====&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;
| 0x3&lt;br /&gt;
| OUI, see above.&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| OUI type (25/0x19)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| See above&lt;br /&gt;
| Encrypted data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When this exists in the beacon, this is the tag1 used with [[NWMUDS:DecryptBeaconData]]. The data stored here is the 0xFA-bytes following the previous encrypted data in tag0, for more space for storing the encrypted data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Encrypted beacon data ====&lt;br /&gt;
The following structure is for the plaintext version of the encrypted data.&lt;br /&gt;
&lt;br /&gt;
This data is encrypted with AES-CTR, by NWM module in software. The AES key is stored in NWM module itself. See above for the CTR. The size of this encrypted data is 0x12 + (0x1E*val), where val is the u8 from networkstruct offset 0x1D(zero when the u8 at networkstruct offset 0x8 is value zero).&lt;br /&gt;
&lt;br /&gt;
===== Structure =====&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;
| MD5 over the rest of the data following this(plaintext).&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| 0x1E * &amp;lt;total array entries&amp;gt;&lt;br /&gt;
| This is an array of entries for each of the devices on this network, the first entry is for the host and the rest is for the client(s).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Array entry =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x18&lt;br /&gt;
| This is the first 0x18-bytes of the structure from [[NWMUDS:Initialize|here]].&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x2&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Errors=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Error code&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8A06C0D&lt;br /&gt;
| The operation being performed is already done (e.g., if you run NWMEXT_ControlWirelessEnabled to turn wifi on when it&#039;s on already, you can&#039;t turn it on again).&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Thedax</name></author>
	</entry>
</feed>