Hacking 3DS Injector

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
This is a nice new CFW-ish thing from our good friend @yifan_lu (GW ultra reversing, spider3dstools). Obviously, don't install this unsigned module to sysnand or you'll likely brick.

Update: Here is a Writeup from the author's blog that explains how things work things nicely. It's in a conversation tone, so even novices might want to give it a read!
Update2: It appears 3ds injector now is part of a larger plan for yifanlu's new cfw!
https://github.com/yifanlu/Cosmo3DS/releases (a fork of reinand!)
http://yifan.lu/2016/03/28/cosmo3ds-the-cfw-nobody-wanted/ (another writeup!)
readme said:
3DS Loader Replacement

This is an open source implementation of 3DS loader system module--with additional features. The current aim of the project is to provide a nice entry point for patching 3DS modules.

Roadmap
Right now, this can serve as an open-source replacement for the built in loader. There is additional support for patching any executable after it's loaded but before it starts. For example, you can patch menu to skip region checks and have region free game launching directly from the home menu. There is also support for SDMC reading (not found in original loader implementation) which means that patches can be loaded from the SD card. Ultimately, there would be a patch system that supports easy loading of patches from the SD card.

Build
You need a working 3DS build environment with a fairly recent copy of devkitARM, ctrulib, and makerom. If you see any errors in the build process, it's likely that you're using an older version.

Currently, there is no support for FIRM building, so you need to do some steps manually. First, you have to add padding to make sure the NCCH is of the right size to drop in as a replacement. A hacky way is this patch which adds junk data. Play around with the size value to get the NCCH to be the exact same size as the one found in your decrypted FIRM dump.

Once you have a NCCH of the right size, just replace it in your decrypted FIRM and find a way to launch it (for example with ReiNAND).
Note: installation instructions under the "Build" heading in the above readme
https://github.com/yifanlu/3ds_injector
Latest release
https://github.com/yifanlu/3ds_injector/releases
 

Attachments

  • 3ds_injector.zip
    5.9 KB · Views: 289
  • 3ds_injector_padded.zip
    6.3 KB · Views: 248
Last edited by zoogie,

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
I've updated the OP with the padded version of the loader.
Turns out the patch made by yifanlu is exectly what's needed (9K -> 12K)

You simply overwrite this file where the loader ncch begins in the decrypted firm. (cntl-F "loader" then back up 0x200)
If you used phailect's a9lh guide and aureinand, then the file offsets should be:
old 0x26400
new 0x26600

MD5
firmware.bin old
clean 180d297732415d27ca49e69967eb68b6
patched 5d99ccb9db1a9325b4eadd10d2036df1

firmware.bin new
clean 7512abc6bdfddb2fcf10732888ff81e5
patched d58bf5ce02f1cb4fd631f4bc1adb8bd6

Interestingly new 3ds worked for region free, but old3ds did not. The loader moduledid function at least though. Tested with EUR mario 3d land legit on US consoles.
 
Last edited by zoogie,
  • Like
Reactions: peteruk

yifan_lu

@yifanlu
Member
Joined
Apr 28, 2007
Messages
663
Trophies
0
XP
1,671
Country
United States
Yeah, I was planning to make a post when it's in a more presentable fashion. It's pretty useless right now--it duplicates Nintendo's code exactly. Also, you need to manually pull the latest version of ctrulib, Project_CTR (makerom), and devkitARM (specifically this patch https://github.com/devkitPro/buildscripts/pull/9) manually to get it to compile. Hopefully by the time everything is done, all the tools will be updated to support it.

The goal of this is to provide a basic framework for creating patches for more than just Kernel11. You can patch processes after the .code is loaded to memory but BEFORE the process runs. So you can, for example, patch home menu to skip region checks or NIM to skip update checks and so on without any hacky linear scan of physical memory or the need to query kernel objects every so often to find new processes and so on. I've tested it on 7.4, 9.2, and 9.6 but it should work on any firmware > 2.x (provided you run it with the right CFW that supports it in emunand). If you have patches, make sure they're for the right FW version.

If you have patches you want to write, please tell me what kind of features you want from such a framework. For example, I will provide a simple search and replace system to load patches like the ones you find in freemultipatcher. I'll also provide support for absolute addresses (you must specify one for each fw version).
 
Last edited by yifan_lu,

yifan_lu

@yifanlu
Member
Joined
Apr 28, 2007
Messages
663
Trophies
0
XP
1,671
Country
United States
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.

EDIT: Got it thanks.
 
Last edited by yifan_lu,

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.
n3ds or o3ds?
 

Shadowtrance

Well-Known Member
Member
Joined
May 9, 2014
Messages
2,493
Trophies
0
Location
Hervey Bay, Queensland
XP
1,807
Country
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.
Anything us "E" system users can do to help? :)
Also, with the example patch you added to test, what would need to be changed to work/test on EUR systems? besides the titleID obviously.
As always, great work. :)
 
  • Like
Reactions: peteruk

TVL

#|
Member
Joined
Feb 17, 2004
Messages
577
Trophies
2
Location
World -1
XP
2,301
Country
Sweden
  • Like
Reactions: peteruk

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Hello @realtimesave.