Skip to content
Memory corruption Write-up Advanced

Hacking the Nintendo DSi Browser

A use-after-free vulnerability in the Nintendo DSi browser's handling of CSS media rules allowed an attacker to execute arbitrary code by reclaiming freed memory with canvas pixel data and jumping to shellcode.

Nathan Farlow Follow

Published on farlow.dev

I managed to exploit the Nintendo DSi browser 15 years after it was released in Japan. This post will go over the journey and the technical details.

Nathan Farlow, on farlow.dev

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 a use-after-free in the browser's CSS rule handling, where deleting rules frees memory but a dangling pointer is later dereferenced.

Impact

An attacker could execute arbitrary code on the DSi, but the exploit worked only about half the time and required a specific browser version without mitigations.

What the attacker needed

Nintendo DSi with vulnerable browser; User visits malicious webpage

How it was found

  1. Create many canvases with width and height set to 1.
  2. Trigger the insertRule/deleteRule bug to free the cssRules memory.
  3. Write the address of the NOP sled into the canvases as RGBA pixels to reclaim the freed memory.
  4. Spray NOP sleds and shellcode.
  5. Evaluate mediaRule.cssRules.length to jump to the NOP sled.

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.

The DSi browser had a bug where deleting certain CSS rules left a pointer to memory that had been freed. An attacker could fill that freed memory with their own data and trick the browser into jumping to it, running their 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 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.