Skip to content

borntohonk/Switch-Ghidra-Guides

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains reverse engineering notes and guides for educational purposes, using open source tools such as ghidra to pry into binaries for the Nintendo Switch. It also contains basic methodology on how to operate ghidra with the intent to inspect "ARM" binaries that run on the Nintendo Switch.

This repository does not host, nor contain guides that assist with circumventing security measures that safeguard digital assets.

All material exist purely for research reference.

  • Ghidra/Patch making tutorial:

    These scripts work independent of hactool, libhac, hactoolnet, or other third-party binaries.

  • Here's a list of scripts following the example Part 2 of the guide above teaches you how to do, and that this repository contains.

    • Python script to process firmware files, decrypting, extracting, decompressing and outputting files of interest, and cryptographic keys derived.

      • All cryptographic functions rely on root keys to be filled into the keys.py file, root keys such as: mariko_bek, mariko_kek, tsec_root_key_02, tsec_root_key_02_dev
      • Zero cryptographic functions can be performed without the root keys.
      • bare minimum requirement is mariko bek and mariko kek, which must be obtained and filled in, using tools such as lockpick_rcm, or sourcing them elsewhere, such as from the scene release .nfo from "Marvels.SpiderMan.Miles.Morales.PS5-BigBlueBox"
      • requires the following keys: mariko_bek (to open mariko package1), mariko_kek (to be able to derive the latest key revision in provided firmware files)
      • put firmware nca files in folder named firmware
      • example usage: "python scripts/process_firmware.py process_firmware.py
      • requires pycryptodome/pycryptodomex (or python3-pycryptodome from apt if debian/ubuntu which is pycryptodomex, python-pycryptodome from arch linux pacman repositories which is pycryptodome)
      • updating scripts/key_sources.py will benefit key generation for aes_sample.py
    • Python script to derive entire keyset. aes_sample.py

      • The cryptographic logic described can be sampled with this python script, the default output keyfile is "prod.keys". aes_sample.py
      • requires pycryptodome/pycryptodomex (or python3-pycryptodome from apt if debian/ubuntu which is pycryptodomex, python-pycryptodome from arch linux pacman repositories which is pycryptodome)
    • Python script to check known patterns for sys-patch.

      • Usage: run process_firmware.py first, then the files for check_patches should be populated.
      • example usage: "python scripts/check_patches.py"
      • check_patches.py
      • requires pycryptodome/pycryptodomex (or python3-pycryptodome from apt if debian/ubuntu which is pycryptodomex, python-pycryptodome from arch linux pacman repositories which is pycryptodome)
    • Python script to generate the "disable_ca_verification patch", (link) - no longer maintained as of firmware version 19.0.0, due to lack of interest. (this patch also exists in sys-patch as of version 1.5.5 and higher, though requirin to manually enable)

    • Python script to generate the "disable_browser_ca_verification patch", (link) - no longer maintained as of firmware version 19.0.0, due to lack of interest.

  • TODO:

    • extract every section of input nca (completed, but currently static assigned to section 0 of desired input ncas - not needed for firmware files of interest)
  • Credits:

About

Various patches for the Nintendo Switch, and how to make them.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published