Skip to content
Memory corruption Disclosed report Advanced

[3DS][StreetPass] Buffer Overflow in Super Mario Maker level decompression

Super Mario Maker does not check the declared size of a compressed level received over StreetPass, so a crafted file causes the decompressor to read and write past its buffers. An attacker could overwrite heap objects and achieve userland remote code execution.

mrnbayoh Follow

Originally disclosed on HackerOne

Informational View original
  • Triaged in 16 hours
  • Fixed in 4 months
  • Paid in 4 months
  • Disclosed after 20 months

Summary by the program

--

Summary by the researcher

#Information

  • Platform: (New) Nintendo 3DS
  • Region: EU (all regions are affected)
  • System version: less or equal to 11.10 (latest)

#Description

Since the bootroms have been dumped, it is now possible for an attacker to decrypt streetpass communications. Super Mario Maker is vulnerable to a buffer overflow vulnerability when parsing received levels.

###Vulnerability

When parsing a compressed level received via StreetPass, the application decompress each compressed chunk of the file. The size of the received file cannot exceed 0x18000 bytes but the size isn't checked so the application will try to parse past the end of the compressed buffer if a greater size is provided. Even though we cannot send more than 0x18000 bytes, the decompressed buffer is located just after the compressed buffer. Thus, one can craft a file where the first chunk is 0x18000 bytes long, the decompressed part is copied to compressed_buf+0x18000 and since the size isn't checked, the content at compressed_buf+0x18000 is parsed as the next compressed chunk and eventually copied past the end of the decompressed buffer. This makes it possible to overwrite objects on the heap and gain code execution.

Impact

This gives an attacker the ability to get userland remote code execution in Super Mario Maker.

The original report as published on HackerOne, by mrnbayoh. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 decompression routine trusts the size field of each compressed chunk without checking it against the actual buffer length, so parsing continues past the compressed buffer and the decompressed output overflows into adjacent heap memory.

Impact

An attacker could overwrite heap objects and gain userland remote code execution in the game.

What the attacker needed

Decrypted StreetPass data (bootroms dumped); crafted level file; StreetPass exchange with victim

How it was found

  1. Decrypt StreetPass communications using dumped bootroms.
  2. Craft a level file whose first chunk is the maximum allowed size.
  3. Send it so the game parses content beyond the compressed buffer as the next chunk.
  4. The decompressed data is copied past the end of the decompressed buffer, overwriting heap objects.

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.

StreetPass lets nearby 3DS consoles swap small pieces of game data automatically. The game trusts a size value inside that data and copies more than it should, so carefully arranged bytes spill into memory the game uses for other things. An attacker who sends such data could make the game run their own code.

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.

More by mrnbayoh

View all

6 more disclosed reports, best first.

More from Nintendo

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.