Hacking 3DS unbricking progress

bkifft

avowed Cuthwaldian
Member
Joined
Jun 10, 2010
Messages
613
Trophies
0
XP
625
Country
Gambia, The
Update: RPU can now unlock the eMMC.

The usual header: this will neither enable a downgrade nor running pirated porkemon [sic] on >4.5.

An anonymous source gave me the key required to generate the console specific eMMC lock/unlock password in exchange for posting his/her following statement in my initial release posts and the tool itself:

If you are reading this your 3DS has most likely been bricked by a Virus called Gateway 3DS. If so return it and get a refund immediately.
Because what they have done is they made a soft-mod for the 3DS but then decided that they would earn more money if they added their own AP.
They also added a lot of obfuscation (to prevent pirates from pirating their card and software), which most likely also is the reason why some versions are not stable (and the brick code is triggered). And as you already see on your 3DS they added brick code in the 2.0_2b Version. This brick code is not even written correctly (else this unbricker wouldn't work). So they even failed at programming brick code.
To sum it all up you bought a badly programmed Virus.

Buy your games, don't pirate them. You see what happens when you pirate. I hope you learned from your mistake.

The good news: this makes it possible to unbrick even if you don't have a prior NAND backup.

The bad news: for now it has to be done in a quite roundabout way: unlock the eMMC/NAND -> dump it -> relock the eMMC/NAND -> force erase -> flash the NAND image -> unbricked.

The reason for this detour is that besides being locked, the eMMC also gets write protected (just like some people had already stated) and I wasn't able to remove said write protection yet (in this context: if anyone got any idea how on earth i could get the Pi to do CMD27 like it's supposed to work please let me know).

But said write protection gets wiped by a force erase too, thus offering a working solution for now (although I'd have preferred a single keypress unlock and will keep working on that).

I just pushed the changes to github, either do the online or offline update as described in the guide to get the new version.

As i believe not everyone to be interested in the technical details I'll put them in a spoiler:
The lock/unlock password is generated by encrypting the console specific CID (the unique serialnumber of the eMMC) with GW's master AES key (which I don't and don't want to have) using the 3DS AES engine in CTR mode. I had to look that one up as I only ever use CBC and XTS: CTR uses the block cipher to generate a keystream to be xored to the plaintext with no cleartext or cyphertext feedback whatsoever. In other words: this keystream is constant for all 3DSes, thus enabling an unlock without using a working 3DS to generate the password. To get this keystream one has just to encrypt 16 bytes of 0x00, which my source did.

Lock/Unlock mechanism (in pseudocode, those functions are named differently and have different signatures on the 3DS as well as in RPU):
Code:
uint8_t CID_buffer[CID_length];
CID_buffer = read_CID(eMMC);
CID = AES_encrypt(CTR , GW_MASTERKEY, CID, CID_length ); //this is equivalent to CID = CID xor AES_encrypt(CTR , GW_MASTERKEY, 0x0, CID_length);
CID[0] = 5; //bit 0 and 2 set, meaning "set password" and "lock eMMC", for the unlock it's CID[0] = 2; //bit 1 set meaning "clear password" (unlock happens implicit)
CID[1] = 14; //next 14 bytes are the password
SD_command(eMMC, 42, CID, CID_length); //command 42 (lock/unlock) on the eMMC sending 16 bytes starting from &CID as data payload

Thanks GW for choosing the one AES mode which made this approach possible.

This is another piece of evidence that the bricking doesn't happen random, as (on the most objective level) the locking occurs using a deterministic (not random) console specific password. I don't want to and will not make any claims beyond that (even though personally I do believe it happens with intent as a clone deterrent gone horribly wrong, this IMHO still isn't decisive damning evidence).

Feasibility of the unlock -> dump -> lock -> force erase -> flash approach was proven by gamesquest1 (using the unmodified 2.0b2) and Inaki (using the region patched 2.0b2). Thanks for testing dudes.
Also thanks to krisztian1997, khalaan and of course the anonymous source. Love you guys (no homo).


p.s. I'll use this opportunity to once again draw attention to step 18 of the guide *nudge nudge wink wink know what i mean*
 

inian

Active Member
Newcomer
Joined
Dec 10, 2013
Messages
30
Trophies
0
Age
46
XP
63
Country
This brick code is not even written correctly (else this unbricker wouldn't work)
bkifft, do you know what this means, what would have happened if the code was written correctly?
 

bkifft

avowed Cuthwaldian
Member
Joined
Jun 10, 2010
Messages
613
Trophies
0
XP
625
Country
Gambia, The
bkifft, do you know what this means, what would have happened if the code was written correctly?

Yes i know. GW would have created high price segment paper weights and incurred the biggest shitstorm in the history of the internet.

But i believe said sentence from the statement wasn't only meant as a "if you are gonna brick it brick it for good" but was also a snide remark on the choosen blockcipher operation mode. Heck, even ECB (which you should never ever use in production code) would have made it way harder to unlock.
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,825
Trophies
3
Location
Gaming Grotto
XP
29,851
Country
Poland
The front page F.A.Q has been updated with the information supplied by bkifft as well as a direct link to the original statement - thank you for keeping us up-to-date with the unbricking progress! :)
 

bkifft

avowed Cuthwaldian
Member
Joined
Jun 10, 2010
Messages
613
Trophies
0
XP
625
Country
Gambia, The
The front page F.A.Q has been updated with the information supplied by bkifft as well as a direct link to the original statement - thank you for keeping us up-to-date with the unbricking progress! :)

hey, I'll do everything to fill my email storage.

anyway @thread: as I don't want to invade the non English and non German forums again to spread the news, feel free to do so if you can speak their respective languages.
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,825
Trophies
3
Location
Gaming Grotto
XP
29,851
Country
Poland
hey, I'll do everything to fill my email storage.

anyway @thread: as I don't want to invade the non English and non German forums again to spread the news, feel free to do so if you can speak the languages.
Just so that it's clear, the Raspbery Pi-based Unbricker now has the eMMC-unlocking routine implemented, but the Arudino-based Unbricker does not (yet), correct?
 

krisztian1997

Well-Known Member
OP
Member
Joined
Dec 14, 2013
Messages
370
Trophies
0
Age
27
XP
300
Country
Romania
Just so that it's clear, the Raspbery Pi-based Unbricker now has the eMMC-unlocking routine implemented, but the Arudino-based Unbricker does not (yet), correct?

Working on the arduino based unblocker, I am having some difficulty with it at the moment, mostly with the byte shifting and xoring but gonna fix it tonight or tommorow
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,825
Trophies
3
Location
Gaming Grotto
XP
29,851
Country
Poland
Working on the arduino based unblocker, I am having some difficulty with it at the moment, mostly with the byte shifting and xoring but gonna fix it tonight or tommorow
Fantastic, thank you for your hard work!

I've updated the F.A.Q accordingly, I'm glad that RP users can now unbrick without having to worry about their NAND backups... which they should have anyways, but you know how it is! :P
 

bkifft

avowed Cuthwaldian
Member
Joined
Jun 10, 2010
Messages
613
Trophies
0
XP
625
Country
Gambia, The
Just so that it's clear, the Raspbery Pi-based Unbricker now has the eMMC-unlocking routine implemented, but the Arudino-based Unbricker does not (yet), correct?
Yes, only that frigging write protect seems to be left in the way to an (on the software side) easy to use one click unbrick solution.
 
  • Like
Reactions: Foxi4

gamesquest1

Nabnut
Former Staff
Joined
Sep 23, 2013
Messages
15,153
Trophies
2
XP
12,247
...not to try start another of these what does and doesn't deserve a sticky debates, but personally i think this is sticky worthy very good news for people who are bricked and dont have their nand dump

ps im going to throw a little video tutorial up as the people who didn't follow the written instructions properly about getting a nand dump in the first place will be the most likely users for this.......and if they don't follow the steps properly you end up with a 100% bricked console
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,825
Trophies
3
Location
Gaming Grotto
XP
29,851
Country
Poland
...not to try start another of these what does and doesn't deserve a sticky debates, but personally i think this is sticky worthy very good news for people who are bricked and dont have their nand dump

ps im going to throw a little video tutorial up as the people who didn't follow the written instructions properly about getting a nand dump in the first place will be the most likely users for this.......and if they don't follow the steps properly you end up with a 100% bricked console
It indeed does. The thread is now stickied until both tools are complete - then we'll think of replacing it with a comprehensive guide. Well, spotted. ;)
 

krisztian1997

Well-Known Member
OP
Member
Joined
Dec 14, 2013
Messages
370
Trophies
0
Age
27
XP
300
Country
Romania
After playing around with those annoying bits, my code is updated too (and like before, not tested and its gonna take several weeks untill someone tests it), I succesfully locked my sd cards with it, and the password is unique, and then I unlocked them and it worked.
 

Msparky83

Well-Known Member
Newcomer
Joined
Jan 10, 2014
Messages
54
Trophies
1
Age
41
XP
473
Country
United States
...not to try start another of these what does and doesn't deserve a sticky debates, but personally i think this is sticky worthy very good news for people who are bricked and dont have their nand dump

ps im going to throw a little video tutorial up as the people who didn't follow the written instructions properly about getting a nand dump in the first place will be the most likely users for this.......and if they don't follow the steps properly you end up with a 100% bricked console

Good on you mate. Can't wait to see the vid in question. Ii was going to make one myself and probably still am, but im left back at square one trying to make another solder less pogo pin setup as my current pins are too damn long. Cheers mate, and thanks for all the testing thus far.
 

greyneon

Well-Known Member
Newcomer
Joined
Sep 5, 2013
Messages
74
Trophies
0
Age
34
Location
Hidden Nuclear Base
XP
135
Country
After playing around with those annoying bits, my code is updated too (and like before, not tested and its gonna take several weeks untill someone tests it), I succesfully locked my sd cards with it, and the password is unique, and then I unlocked them and it worked.

Is there a way i can force brick my 7.x to try out?
 
D

Deleted User

Guest
or by using the diagnostic mode of gateway several times on 2.0b2. You can brick your device insanely fast that way
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Materia_tofu @ Materia_tofu: this is true! i learned how to make soundfont remixes from a friend back in 2021 +1