Wii Security

From WiiBrew
Jump to: navigation, search

The Wii has four basic ways of communicating with the environment -- games on disc, savegames on SD card, channels/VCs on SD card and updates downloaded from the Internet. All of them need to be protected for the Wii security model to keep its integrity. Different security methods are used for each of the 4 methods, with some similarities between them.

Definitions

  • Encryption: Technology used to prevent unauthorized parties from viewing data. The Wii uses AES-128-CBC.
    • Symmetric Encryption: The same key is used for both encryption and decryption. AES is a symmetric cipher, meaning the same key is used for encryption and decryption (this is why the key must be kept secret).
  • Hashing: Technology used to detect modification of data. The Wii uses both SHA-1 and MD5.
  • Signing: Technology used to prevent unauthorized parties from modifying (changing, editing) data. (Generally, this is a combination of encryption and hashing.) For the purposes of signing, the Wii uses RSA and ECC. Signing is an asymmetric algorithm: a signature can be verified by a party without sufficient information to produce a signature.
  • Title: In Wii terminology, a "title" is a self-contained set of code and data. Every game is a title; a channel is a title, etc.
  • Content: In Wii terminology, a "content" is a piece of code or data. Discs contain one "content" per partition; channels usually contain several "contents" per title.

The rest of this page will assume you know the difference between symmetric and asymmetric cryptography.

Game discs

Game discs are encrypted to avoid analysis (as you would need the key from a Wii) and signed by Nintendo to stop modifications.

The encryption is a symmetric cipher, 128-bit AES-CBC. Each disc usually contains two or more partitions. Each partition has its own AES key, referred to as a "title key". This key is stored on the disc, inside of a "ticket", but it is encrypted with the master AES key (also known as the common key). So, with the master AES key, you can decrypt the title keys, which can decrypt the partitions. This master AES key was extracted by the Tweezer hack and has been known publicly since April 2008.

The disc is signed by building SHA-1 hashes of small parts of the disc, then aggregating these hashes into a hierarchical structure, which is finally signed with Nintendo's asymmetric private key; this is chosen for speed, as asymmetric cryptography is slower than symmetric.

For more details, see Partition Data info on the Wiidisc page.

Typically, the first partition contains system updates, in the form of WAD files. The data content of the WAD files themselves are encrypted and signed, as well. It is encrypted by 128-bit AES-CBC, by a title key. The title key is encrypted with the master AES key and is stored in the WAD.

Exploits

Save games on SD cards

When copying a save game from a Wii system memory to an SD card (in "Data Management"), it encrypts it with an AES key known to all consoles (SD-key). This serves only to keep prying eyes from reading a save game file. In crypto terminology, the SD-key is a "shared secret".

The Wii then signs the file on the SD card with its private (ECC) key. This is to prevent anyone from modifying the save file while it is on the SD card.

If someone shares save games to another Wii using an SD card, the Wii will be able to decrypt it using the shared secret. However, it has no way of checking the Wii's signature, because it doesn't know the other console's public key. To solve this problem, the save game also contains a copy of the Wii's unique public key -- the one that matches the private key used to sign the save file. (The copy of the Wii's public key is called a 'certificate'.)

Thanks to this, the Wii can verify that the file is signed, but it has no way of knowing whether it was a real Wii that signed it, or if the key was just generated randomly. To solve this, each Wii's certificate used for save game signing is also signed by Nintendo using their private key which all Wii's must know for game signature validation.

The original memory-dumping hack for the Wii solves the problem of needing a key to sign a new save; a private ECC key was extracted from one console, and since any Wii can read any savefile signed by a Wii's certificate, there can just be one shared key for exploits -- it doesn't need to be re-encrypted / re-signed every time.

Exploits

Message Board

The Wii Message Board is able to read messages from an SD card if properly signed using the Wii's MAC address. LetterBomb and other exploits use this as a way to run unsigned code on the Wii from the System Menu.

Exploits

Internet

The Internet Channel for the Wii does not feature the ability to download files by any normal means. By running unsigned code via bookmarking, it is possible to send unsigned code to the Wii and run exploit code.

The EULA for WiiConnect24 and Wii Shop downloads HTML from Nintendo's official servers over HTTP; by using a DNS server, it can instead run unsigned code to run an exploit via the EULA channel.

Exploits