ENLBufferPwn (CVE-2022-47949)
A buffer overflow in the NetworkBuffer class of Nintendo's enl network library allowed an attacker to execute code on a victim's console by joining an online game session. The attacker could take full control of the console, potentially stealing account or credit card information or making unauthorised recordings.
BranchesTags
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the NetworkBuffer class's Set and Add methods used memcpy without verifying that the incoming data size fit within the allocated buffer size.
Impact
An attacker could execute arbitrary code on the victim's console, potentially taking full control and stealing sensitive information or making unauthorised recordings; the 3DS lacked ASLR, making exploitation easier, while on Switch ASLR might be bypassed by leaking pointers.
What the attacker needed
Online game session with attacker; victim joins attacker's game
The fix
The vulnerability was fixed in many games through updates, and a possible fix for the NetworkBuffer class is provided in the repository.
How it was found
- Build a specially crafted payload and send it in Buffer0 to trigger an overflow that overwrites dataPtr of Buffer1.
- Set the contents of Buffer1 with arbitrary data, which will be copied to the address pointed by dataPtr of Buffer1 on the remote console.
- Increase the arbitrary address and size and repeat from step 1.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A buffer overflow happens when a program copies more data into a fixed-size memory area than it can hold, so the extra data spills over into nearby memory. Here, the game's network code did not check the size of incoming data, so an attacker in the same online match could send a specially crafted message that overwrote memory and let them run their own code on the victim's console.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.