Homebrew Why the otp?

Mrrraou

Well-Known Member
Member
Joined
Oct 17, 2015
Messages
1,873
Trophies
0
XP
2,384
Country
France
it actually only needs an hash for a portion of the otp for it to be installed
that hash is used as an key to decrypt and encrypt the "secret keysector" which contains k9lh keys for decrypting and encrypting the arm9bin.
there is a vuln in the k9l that makes it not check the keys used for decryption. so you can bruteforce a key in order to make it decrypt into specific instructions that will jump to your payload (in this case, stage1)
that key is then inserted into the "secret keysector", then encrypted with the hash as a key, and finally written to nand.
the otp is unique per console.
 

ScarletDreamz

[Debug Mode]
Member
Joined
Feb 16, 2015
Messages
3,991
Trophies
2
Location
/dev/sda1
XP
4,557
Country
United States
From Plailect:

The OTP is a 0x100 byte region of seemingly random data at address 0x10012000. It is presumed that console unique keys are derived from this region, although it is currently unknown exactly how. The region is likely the console unique data store which is decrypted by the bootrom, but we don't know how that is done until somebody dumps the full protected bootrom. It is unknown at this time if anyone has successfully dumped the protected bootrom.

Prior to version 3.0.0-X, the 0x10012000-region (the OTP) was left unprotected and could be dumped by an attacker with sufficient permissions (arm9 code execution).

After version 3.0.0-X, Nintendo switched to locking this region using the register CFG_SYSPROT9, which also locks the bootloader and is set extremely early in boot, long before we are able to gain code execution. This register can be set exactly once, and cannot be switched off until the unit is fully powered off, and therefore it is impossible to dump the full OTP without a version 2.1.0-X or below.

There is, however, a method to dump the hash of the OTP on version 9.6.0-X. Because Kernel9Loader does not clear the SHA_HASH register after it has been used, dumping the SHA_HASH will give the hash of the OTP which was handed over to Kernel9 from Kernel9Loader. In addition, there is a long standing vulnerability where an MCU reboot caused by the i2c will not clear RAM like it's supposed to.

This allows for a hardware based attack where arbitrary data is written to nand_sector96+0x10 in a SysNAND backup and flashed to the device. Afterwards we wire the i2c to MCU reboot on our command, write a payload (which will write 0x1000A040 - 0x1000A060 to a file on the SD card) to arm9 memory somewhere, fill all memory with a NOP sled followed by a JMP instruction pointing to the payload. We can then MCU reboot repeatedly (incrementing nand_sector96+0x10 by 1 each time) until the Kernel9Loader jumps to the payload by random chance.

Because of the complexity and extra hardware involved in the method described above, I have decided to limit the scope of this guide strictly to the software based approach of downgrading to a version below 3.0.0-X. Version 2.1.0-X was selected because it is the only version below 3.0.0-X that contains a fully exploitable browser version (2.0.0-X has a partially exploitable browser, but it won't work for other reasons).

The OTP section of this guide will take you through the process of downgrading your RedNAND to 2.1.0-X to ensure you do not get a partial downgrade (which is when some titles are on one version and others are on a different version) which are difficult to recover from. On the New 3DS you must then decrypt with your console's 0x5 xorpad (which is New 3DS only) and then reencrypt with your console's 0x4 xorpad. Afterwards you overwrite the New 3DS's NAND NCSD (the header that specifies each partition's location) with the NCSD from an Old 3DS and flash the RedNAND to SysNAND. These steps are unneeded on an Old 3DS.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Skv0ra @ Skv0ra:
    last clam chowder i had was quite nice
  • K3Nv3 @ K3Nv3:
    Don't know why she stopped responding after I said I'll make you look like a jetskie
    +1
  • Kirbydogs @ Kirbydogs:
    turns out there is caffeine in sunkist - 12 fluid ounces, aka the LITERAL THING
  • K3Nv3 @ K3Nv3:
    Caffeine free is generally printed in big bold text
    +1
  • BigOnYa @ BigOnYa:
    Turns out there's ground up and processed Coca leaves in my Cocaine. Nobody ever told me that...I'm switching to Cocaine Light.
  • Veho @ Veho:
    Wut.
  • K3Nv3 @ K3Nv3:
    There is pain in my body from cocoaine
  • Veho @ Veho:
    Some morphine should clear that right out.
  • K3Nv3 @ K3Nv3:
    Nah fetty is free they don't even tell me it's included with my purchase
  • BigOnYa @ BigOnYa:
    My Morphine says in big bold print on the package "Cocaine Free"
  • Veho @ Veho:
    My cocaine is 37% asbestos, shitsux.
  • K3Nv3 @ K3Nv3:
    May contain drywall
    +1
  • Veho @ Veho:
    JF "Brainworms" Kennedy has vowed to find a cure for autism by October. I'm taking bets on what he comes up with.
  • Veho @ Veho:
    According to him, all these autisms are a huge drain on society and someone needs to find a final solution for them.
  • K3Nv3 @ K3Nv3:
    Cure: free sex change for all
  • Veho @ Veho:
    If he cures autism GBAtemp will lose half its members.
    +1
  • K3Nv3 @ K3Nv3:
    Imagine if he cures gay :(
  • Veho @ Veho:
    Imagine if he cured an actual disease.
  • SillyBee @ SillyBee:
    Wdym? Measles sounds fun for everyone
  • K3Nv3 @ K3Nv3:
    Apparently had a case in the state next to me recently
  • Veho @ Veho:
    Speaking of autism, Glitch studios have a new cartoon out: https://www.youtube.com/watch?v=IC8KsZniulw
  • Veho @ Veho:
    Better watch it now before it generates another rabid fandom.
  • Skv0ra @ Skv0ra:
    @Veho,
    oooooooo
    Skv0ra @ Skv0ra: @Veho, oooooooo