Finding and exploiting hidden features of Animal Crossing's NES emulator (2018)
The generic NES console furniture item in Animal Crossing loads NES ROM files from the memory card, and the ROM loader's tag processing code contains memory copy operations with offsets and sizes that can exceed the intended bounds. An attacker could craft a malicious memory card file to write data outside the loaded ROM buffer, potentially achieving code execution on the GameCube.
jamchamb.net
Published on jamchamb.net
While looking for ways to activate the developer menus left over in Animal Crossing, including the NES emulator game selection menu, I found an interesting feature that exists in the original game that was always active, but never used by Nintendo. In addition to the NES/Famicom games that can be obtained in-game, it…
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 ROM loader's tag processing functions use attacker-controlled 24-bit offsets and 16-bit sizes in memcpy calls without properly validating that the destination stays within the allocated ROM buffer.
Impact
A crafted memory card file could cause out-of-bounds memory writes, potentially leading to code execution, though the text notes that heap sanity checks and limited forward-only offsets may constrain exploitation.
What the attacker needed
A memory card file; the generic NES console item; ability to import files to memory card
How it was found
- Obtain the generic NES console item in-game.
- Create a memory card file named with the required prefix and a non-SAVE suffix.
- Craft a file with a valid checksum and a 32-byte ROM header.
- Include a QDS tag with a 24-bit offset and 16-bit size in the unknown buffer.
- Interact with the NES console to trigger loading of the crafted file.
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.
Animal Crossing lets you play classic NES games on a virtual console inside the game. The game reads special files from the memory card to load these games, and the code that reads those files trusts some size and offset numbers in the file. A malicious file could make the game copy too much data to the wrong place in memory, which might let someone run their own code on the 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.