Hacking Misc Getting the MIG Switch to load an XCI dump without its original Initial Data

cavv

New Member
OP
Newbie
Joined
Apr 5, 2024
Messages
1
Trophies
0
XP
29
Country
Italy
Hello guys, this is my first post here! I just got a MIG Switch card out of curiosity and I was tinkering with it.
For those who don't know, it's used by placing XCI dumps as well as other game specific bin files in the sd card of the MIG Switch, and are obtained from the original cartridge by using an app like nxdumptool.
Two of these bin files are mandatory to get the game to boot: Initial Data.bin and Certificate.bin. They stay the same for every cartridge of a specific game.
Now, if you want to use an XCI dump from a shady website it's impossible to get it to work without those files. By using the Certificate.bin from another game it has no problem, but this does not count for the Initial Data.bin. So I looked for a way to obtain this Initial Data from an XCI file and read a bit of the XCI file documentation from switchbrew dot org.

Here's what I understood so far:
The Switch checks if the cartridge is valid by doing a challenge–response authentication on the Initial Data.

The Package ID is contained both on the XCI and the Initial Data, on positions 0x110 and 0x0 respectively.
2024-04-05 17_43_53-HxD.png


The Initial Data hash is on the XCI at position 0x160. It is calculated by doing a SHA-256 hash on the full Initial Data content.
2024-04-05 17_48_24-HxD.png


So I was wondering, is there a way to to construct a functional Initial Data file starting from an XCI dump?
I also tried a reverse approach by editing the Package ID in the Initial Data from another game, generating the Initial Data hash and putting it in the XCI file but is not enough to get the Switch believe it's a real game.

Sorry if this may seem stupid but let me know what you think.
 

pharrowking

New Member
Newbie
Joined
Mar 30, 2024
Messages
4
Trophies
0
Age
33
XP
22
Country
Canada
i spent alot of time. about 3-4 days testing what you're asking with a partner, and it does not work. the data from initial data thats found within the xci is signed.

according to this structure the signature of signed data is stored in 0x0 to 0x100 of the xci cardheader,
the signed data is everything after: 0x100 to 0x200

CardHeader​


OffsetSizeDescription
0x00x100RSA-2048 PKCS #1 signature over the header (data from 0x100 to 0x200)
0x1000x4Magic ("HEAD")
0x1040x4RomAreaStartPageAddress (in Gamecard page units, which are 0x200 bytes)
0x1080x4BackupAreaStartPageAddress (always 0xFFFFFFFF)
0x10C0x1TitleKeyDecIndex (high nibble) and KekIndex (low nibble)
0x10D0x1#RomSize
0x10E0x1CardHeaderVersion
0x10F0x1#Flags
0x1100x8PackageId (used for challenge–response authentication)
0x1180x4ValidDataEndAddress (in Gamecard page units, which are 0x200 bytes)
0x11C0x4Reserved
0x1200x10Iv (reversed)
0x1300x8PartitionFsHeaderAddress
0x1380x8PartitionFsHeaderSize
0x1400x20PartitionFsHeaderHash (SHA-256 hash of the #PartitionFsHeader)
0x1600x20InitialDataHash (SHA-256 hash of the #InitialData)
0x1800x4#SelSec
0x1840x4SelT1Key (always 2)
0x1880x4SelKey (always 0)
0x18C0x4LimArea (in Gamecard page units, which are 0x200 bytes)
0x1900x70#CardHeaderEncryptedData



changing the data at any point will result in the switch unable to read gamecard.

including using a loaner xci and cloning its entire header to a different xci dump. without the signing keys that was used to sign the cardheader, your out of luck. unless those keys can be found on the switch....im not sure.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • AncientBoi
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • Psionic Roshambo @ Psionic Roshambo:
    Pokemon Black I played that one a lot
  • K3Nv2 @ K3Nv2:
    Honestly never messed with Pokémon on ds much
  • mthrnite @ mthrnite:
    I played pokemon once, was bored, never tried again
  • Psionic Roshambo @ Psionic Roshambo:
    Oh Dragon Quest IX
  • K3Nv2 @ K3Nv2:
    Spent like 5 hours on switch one never touched it again
  • Psionic Roshambo @ Psionic Roshambo:
    Sentinel of the stary skies
  • K3Nv2 @ K3Nv2:
    Ds is 20 years old this year
  • Psionic Roshambo @ Psionic Roshambo:
    So MJ no longer wants to play with it?
  • K3Nv2 @ K3Nv2:
    He put it down when the 3ds came out
  • SylverReZ @ SylverReZ:
    @K3Nv2, RIP Felix does great videos on the PS3 yellow-light-of-death.
  • Jayro @ Jayro:
    Eventhough the New 3DS XL is more powerful, I still feel like the DS Lite was a more polished system. It's a real shame that it never got an XL variant keeping the GBA slot. You'd have to go on AliExpress and buy an ML shell to give a DS phat the unofficial "DS Lite" treatment, and that's the best we'll ever get I'm afraid.
    +1
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
  • BakerMan @ BakerMan:
    imagine not having hands, cringe
    +1
  • AncientBoi @ AncientBoi:
    ESPECIALLY for things I do to myself :sad:.. :shy::blush::evil:.... :tpi::rofl2:
    AncientBoi @ AncientBoi: ESPECIALLY for things I do to myself :sad:.. :shy::blush::evil:.... :tpi::rofl2: