Hacking Questions about cartridge game crash on SX OS and dlc/update nsp crash on ofw

Richard E

Member
OP
Newcomer
Joined
Jul 4, 2016
Messages
16
Trophies
0
Age
26
XP
183
Country
United States
Hello! I am running SX Beta 2.5 on my 6.2.0 Nintendo Switch.

First question: When on SX OS, when I put a game card in. I get a game cart read error. When I put it out, then back in, it reads the cartridge just fine. Is SX OS designed to do that? It happens with each cartridge that I put in. I gotta put it in twice for it to read. When on ofw, I can swap games in and out no problem.

Second question: I use game update and DLC nsp's for my games. (all which I purchased legit copies of, and all based off physical game cartridges). Since I use physical cartridges, is it possible to patch the Nsp's certificate to match that of the game cartridge? Since the certificate conflict, atleast from my understanding, is what causes the game to immediately crash on ofw.
 

Attachments

  • 20190102_101213.jpg
    20190102_101213.jpg
    1.6 MB · Views: 396

iriez

Well-Known Member
Member
Joined
Oct 27, 2016
Messages
549
Trophies
0
Age
49
Website
www.xbins.org
XP
1,867
Country
United States
The short answer is that no you cannot use the cert from your xci for your nsp because the format is completely different.

As for the behavior I'm unsure but that sucks.
 

Richard E

Member
OP
Newcomer
Joined
Jul 4, 2016
Messages
16
Trophies
0
Age
26
XP
183
Country
United States
The short answer is that no you cannot use the cert from your xci for your nsp because the format is completely different.

As for the behavior I'm unsure but that sucks.

Well, surely the certificate (in whatever format it is stored in), is used for verification in ofw. I knew the certificate format would differ from that of the cartridge. But is there any way to write a new certificate to match the certificate of the game cartridge, allowing for play on ofw?

Yeah, it's incredibly frustrating. I wish it didn't do that. Maybe its because of qlaunch title ID? I'll have to play with that to see what's causing it.
 

iriez

Well-Known Member
Member
Joined
Oct 27, 2016
Messages
549
Trophies
0
Age
49
Website
www.xbins.org
XP
1,867
Country
United States
Well, surely the certificate (in whatever format it is stored in), is used for verification in ofw. I knew the certificate format would differ from that of the cartridge. But is there any way to write a new certificate to match the certificate of the game cartridge, allowing for play on ofw?

Yeah, it's incredibly frustrating. I wish it didn't do that. Maybe its because of qlaunch title ID? I'll have to play with that to see what's causing it.

Haha, I gave you the short answer because I was on mobile. Now that im on desktop I'll give you the long explanation. Read the link for a full break down, but here is the relevant section -

Gamecards
  • If you are playing a gamecard, your certification is your gamecard's unique certificate. This is signed by Nintendo using RSA-2048-PCKS#1 at the time your gamecard is written, and contains encrypted information about your gamecard (this includes what game is on the gamecard, among other, unknown details).

  • In the gamecard case, the data uploaded to aauth is "application_id=%016llx&application_version=%08x&device_auth_token=%.*s&media_type=GAMECARD&cert=%.*s", formatted with the title ID for the game being played, the version of the game being played, the token retrieved from dauth, and the gamecard's certificate (retrieved from FS via the "GetGameCardDeviceCertificate" command), formatted as url-safe base64.

  • This code lives at .text+0x7DE1C for 5.0.0 account.
Digital games
  • Your certification for a digital title is your console's ticket. For more technical details on what's inside a ticket, see my previous post on the eShop/CDN (linked up above). The important details are that tickets contain the Title ID of the game they certify, the Device ID of the console they authorize, the Nintendo Account ID used to purchase them, and are signed by Nintendo using RSA-2048 (cannot be forged).

  • In this case, your console talks to the "es" service, and sends a command to retrieve an encrypted copy of the relevant ticket along with the encryption key. This encryption is AES-128 CBC, using a key randomly generated via cryptographically-secure random number generation. The key itself is encrypted using RSA-OAEP 2048. To skip over some technical details, this is a one-way encryption which only Nintendo can reverse, so even if you obtained the output of the es command you would not be able to determine the encryption key being used (and thus couldn't decrypt the ticket).

  • The data uploaded to aauth in this case is "application_id=%016llx&application_version=%08x&device_auth_token=%.*s&media_type=DIGITAL&cert=%.*s&cert_key=%.*s", formatted with the title ID for the game being played, the version of the game being played, the token retrieved from dauth, the encrypted ticket encoded with url-safe base64, and the encrypted key encoded with url-safe base64.

  • This code lives at .text+0x7DE98 for 5.0.0 account.
And that's that (with the additional case where if the console fails to find a certificate, a special "NO_CERT" request is sent, but this is pretty irrelevant because sending a NO_CERT request gets your console banned). In both relevant cases, aauth validates the certification, and returns a token only if the certification is valid.

Practical Impact
These are extremely strong anti-piracy measures -- Nintendo did a great job, here.

In the gamecard case, Nintendo can detect whether or not the user connecting has data from a Nintendo-authorized gamecard for the correct title. This solves the 3ds-era issue of gamecard header data being shared between games. Additionally, there's a fair amount of other, unknown (encrypted) data in a certificate being uploaded -- and certificates are also linked to Nintendo Accounts when gold points are redeemed. Sharing of certificates should be fairly detectable, for Nintendo.

In the digital game case, Nintendo actually perfectly prevents online piracy here. Tickets cannot be forged, and Nintendo can verify that the device ID in the ticket matches the device ID for the client cert connecting (banning on a mismatch), as well as that the account ID for the ticket matches the Nintendo Account authorizing to log in. Users who pirate games definitionally cannot have well-signed tickets for their consoles, and thus cannot connect online without getting an immediate ban -- this is exactly how I would have implemented authorization for digital games, if I were them.

So, gamecart uses RSA-2048-PCKS#1 and nsp uses RSA-2048. The problem is since this is high-grade encryption, we cannot crack/fake it. I do not think its possible to "repackage" a PCKS#1 certificate as a RSA-2048. I am reasonably confident that you would need the private key used to encrypt/sign these certs in order to "re-create" the RSA-2048-PCKS#1 cert as a RSA-2048 cert.

Note - I am not a cryptographer, and my math generally sucks. I have a general education on this technology/science and i will leave it to more accredited individuals to go into the deeper explanation of why this may or may not be possible. But I believe my statements are accurate.
 
Last edited by iriez,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: It's okay you can go out with rez all you want