[WiiU/Switch] nullptr dereference in the ENL framework
The ENL networking library looks up a content transporter by the ID in each received message but does not check whether the lookup returned null before calling a virtual method on it. A modified client could send a message with an unregistered transporter ID and crash the game or console of other players.
Originally disclosed on HackerOne
- Triaged in 5 days
- Fixed in 22 days
- Paid in 22 days
- Disclosed after 16 months
Summary by the program
Summary by the researcher
#Introduction
The vulnerability is fixed on all of the impacted games, the last fix was released for Splatoon 1 and Mario Kart 8 on August 3, 2023
Nintendo uses its own private library called ENL, it can do matchmaking using NEX (networking library for Nintendo game servers) and communication between players is done using PIA (UDP peer-to-peer networking library)
This library is used in many Nintendo games including:
- Mario Kart 8 / Mario Kart 8 Deluxe
- Splatoon 1 / 2 / 3
- Animal Crossing: New Horizons
- Super Mario Maker 2
- Nintendo Switch Sports
How ENL works
- ENL only sends packet through the Unreliable Protocol (PIA can also do reliable UDP transmission)
- Games can register "content transporters" to ENL, each content transporter have a unique ID
- Each content transporter implements its own data format
A packet can contain one or more ENL messages and each message has the following format:
| Type | Description |
|---|---|
| uint8 | Content transporter ID |
| uint16 | Data length |
| bytes | Data |
There's an End marker marking the end of a packet:
| Type | Description | Value |
|---|---|---|
| uint8 | Content transporter ID | 255 |
| uint16 | Data length | 0 |
The vulnerability
ENL is a C++ library, content transporters are implemented using abstract classes, each content transporter must implement some virtual methods to initialize state, handle received data, etc..
All of the data received and sent is handled by the TransportManager, when data is received it will eventually go through this function: enl::TransportManager::updateReceiveBuffer_
(pseudo-code obtained through reverse engineering)
class enl::TransportManager {
enl::IContentTransporter* getContentTransporter(uint8_t contentTransporterId) {
for (int i = 0; i < this->transporterList.size(); i++) {
if (this->transporterList[i]->getContentID() == contentTransporterId) {
return this->transporterList[i];
}
}
return nullptr;
}
void updateReceiveBuffer_(uint8_t bufferId, uint8_t* data, size_t size) {
/* ... */
while (1) {
ReceiveHeaderInfo hdrInfo;
sead::Serialization::read<ReceiveHeaderInfo>(userHeaderStream, &hdrInfo);
if(hdrInfo.contentID == 255 && hdrInfo.contentLength == 0)
break;
enl::IContentTransporter* transporter = this->getContentTransporter(receiveHdrInfo.type);
/* ... */
// Virtual method, but transporter may be "nullptr" ...
transporter->readyReceiveStream(userDataStream, this->recordStateBuffer, hdrInfo.size);
/* ... */
}
}
}
So as we can see transporter will be a nullptr if a packet is received with an unregistered content transporter ID, trigerring a nullptr dereference on the virtual call.
Impact
- A malicious user with a fake or modified client could abuse this vulnerability and crash the console/game of anyone
- Large scale denial of service for the players on multiple online games
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The transporter lookup returns nullptr for an unknown content transporter ID and the caller dereferences it without a null check.
Impact
A malicious user with a fake or modified client could crash the console or game of other players, enabling large-scale denial of service across multiple online games.
What the attacker needed
Modified or fake game client; ability to send packets to other players
The fix
The vulnerability was fixed on all impacted games, with the last fixes released in August 2023.
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 report has not been written yet. The Original tab links to the source.
Games on Nintendo consoles talk to each other over the internet using a shared library. Each incoming message carries a small number identifying which piece of code should handle it. The library forgot to check what happens when that number matches nothing, so it tried to use an empty reference and the game crashed.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.