Hacking Question Payload loader for iOS?

Lil_SpazJoekp

Well-Known Member
Newcomer
Joined
Apr 11, 2018
Messages
89
Trophies
0
Age
27
XP
373
Country
United States
In the Xcode project, scroll all the way down to Products in the navigator (the file/group tree on the left). Listed under Products are the different things you can build. Right click on libusb-1.0.0.dylib and select "Show in Finder". Then you can copy and paste the file wherever you need.
Yeah I was doing that but it would take me to the project root and not the derived folder. Could you post your dylib file please?

--------------------- MERGED ---------------------------

It's hilarious to me to see the posts at the beginning of the thread that basically say - no: impossible - then argue about stock vs jailbroken iOS while still claiming it will never happen.. to skipping to the last page, within seven pages, and seeing that there is a functional payload being run from iOS. This is why people who don't know what they're talking about should probably stop commenting in the first place. Fantastic work @JustBrandonT.
Never really worked with Xcode, wtf?? I'm simply trying to move some headers etc to be included in the project and am having issues, lots of stuff missing from IOKit that I find elsewhere on my mac.
Did you run the commands on page 5 or 6 I posted?
 

JustBrandonT

Well-Known Member
Newcomer
Joined
Mar 11, 2018
Messages
75
Trophies
0
Age
34
XP
518
Country
Canada
I was able to successfully build the latest copy of the project, but it seems the app can't detect the Switch is in APX mode. Taping "Reload" does nothing.

I have a breakpoint in NXLauncher.mm line 41 and the devices array is empty.

Maybe I have a bad build. @JustBrandonT can you post your ipa?


https://github.com/Brandon-T/iOUSB/releases/tag/v1.0


Compiled for iOS 10+.. I can compile it for lower as well if necessary. Basically to get everything to compile:

1. Get IOKit registered into your iOS SDK
2. Copy libkern/OSTypes.h to your iOS SDK
3. Change OSTypes.h to define UInt32 and SInt32 based on __LP64__ because of ARM 64 devices (THIS step is optional and only required if creating archives):


Code:
#if __LP64__
typedef unsigned int UInt32;
#else
typedef unsigned long UInt32;
#endif


#if __LP64__
typedef signed int SInt32;
#else
typedef signed long SInt32;
#endif

4. Download libUSB source code and open the Xcode folder + the libusb project. Change the "Build-Settings->BaseSDK" to: "Latest iOS (iOS ##.#)".
5. Change "BuildSettings->SkipInstall" to "YES".
6. Compile libUSB. It will generate a libusb-1.0.0.dylib
7. Copy that into NXLauncher and copy the libusb.h there as well.
8. Hit compile or archive product to generate an ipa and voila.
9. Get Nintendo switch into RCM (will show up on non-jailbroken AND jailbroken as APX).
10. Run the app (or the ipa via cydia-impactor).
11. It says "Ready whenever you are".
12. Press "Reload". It will print ALL the debug info such as your device ID/serial number, USB port information, device corporation (Nintendo Corp), device name (APX), etc..
13. Watch Fusee Reswitched splash screen on the switch..


I do not know the license of libusb or how it works with MIT license.. I mean I can change my project's license to use the same thing I guess and then distribute all the source? IANAL so.. but if that's the case, I can easily do that and everyone can run stuff themselves.


In any case, I uploaded an archive/ipa above and you just need to load it with cydia impactor. I just tested the same IPA myself on iOS 10.3 jailbroken.

Edit: Seems on non-jailbroken, it shows "0 devices" connected via libusb but via IOKit, it shows the switch (read only though so can't upload payload.. It can read your device info, but not upload the payload on non-jailbroken devices) :S
 
Last edited by JustBrandonT,

Lil_SpazJoekp

Well-Known Member
Newcomer
Joined
Apr 11, 2018
Messages
89
Trophies
0
Age
27
XP
373
Country
United States
https://github.com/Brandon-T/iOUSB/releases/tag/v1.0


Compiled for iOS 10+.. I can compile it for lower as well if necessary. Basically to get everything to compile:

1. Get IOKit registered into your iOS SDK
2. Copy libkern/OSTypes.h to your iOS SDK
3. Change OSTypes.h to define UInt32 and SInt32 based on __LP64__ because of ARM 64 devices (THIS step is optional and only required if creating archives):


Code:
#if __LP64__
typedef unsigned int UInt32;
#else
typedef unsigned long UInt32;
#endif


#if __LP64__
typedef signed int SInt32;
#else
typedef signed long SInt32;
#endif

4. Download libUSB source code and open the Xcode folder + the libusb project. Change the "Build-Settings->BaseSDK" to: "Latest iOS (iOS ##.#)".
5. Change "BuildSettings->SkipInstall" to "YES".
6. Compile libUSB. It will generate a libusb-1.0.0.dylib
7. Copy that into NXLauncher and copy the libusb.h there as well.
8. Hit compile or archive product to generate an ipa and voila.
9. Get Nintendo switch into RCM (will show up on non-jailbroken AND jailbroken as APX).
10. Run the app (or the ipa via cydia-impactor).
11. It says "Ready whenever you are".
12. Press "Reload". It will print ALL the debug info such as your device ID/serial number, USB port information, device corporation (Nintendo Corp), device name (APX), etc..
13. Watch Fusee Reswitched splash screen on the switch..


I do not know the license of libusb or how it works with MIT license.. I mean I can change my project's license to use the same thing I guess and then distribute all the source? IANAL so.. but if that's the case, I can easily do that and everyone can run stuff themselves.


In any case, I uploaded an archive/ipa above and you just need to load it with cydia impactor. I just tested the same IPA myself on iOS 10.3 jailbroken.
Thank you!!!!! and do you have paypal?
 
Last edited by Lil_SpazJoekp,

Dread_Pirate_PJ

Well-Known Member
Newcomer
Joined
Feb 24, 2018
Messages
64
Trophies
0
Age
53
XP
178
Country
United States
https://github.com/Brandon-T/iOUSB/releases/tag/v1.0

-- snip --

I do not know the license of libusb or how it works with MIT license.. I mean I can change my project's license to use the same thing I guess and then distribute all the source? IANAL so.. but if that's the case, I can easily do that and everyone can run stuff themselves.

As far as I know, since libusb is LGPL and you are using it only by linking to it, you don't have to change your license.

See https://softwareengineering.stackex...a-lgpl-gem-affect-my-mit-licensed-application
 

saneatsu

Well-Known Member
Newcomer
Joined
Apr 28, 2018
Messages
54
Trophies
0
Age
32
XP
209
Country
United States
Holy crap this is amazing. I go on vacation and saw this thread before I left. Forgot about it and come back to this.

Good work and kudos to all y’all.
 

Draxzelex

Well-Known Member
Member
Joined
Aug 6, 2017
Messages
19,012
Trophies
2
Age
29
Location
New York City
XP
13,391
Country
United States
Its just fascinating watching how this thread evolved from a simple suggestion towards an actual working program, despite the initial negativity. Its projects like these that represent the tenacity, ingenuity, and cooperation of GBATemp. I may not have an iPhone, but it was at least a privilege to see something positive created from scratch.
 

Riky_Xerez

Member
Newcomer
Joined
Nov 20, 2014
Messages
23
Trophies
0
Age
33
XP
145
Country
Can you put an option to select a bin file manually from the app like NXLoader for Android? Of corse, it only works with jailbreak
 

z10m

Well-Known Member
Newcomer
Joined
Oct 26, 2009
Messages
64
Trophies
1
XP
319
Country
Direct connection lightning to usb c doesn’t seem to work and lightning to usb a with usb a to c adapter doesn’t seem to work either.
External power is really necessary it appears.
 
  • Like
Reactions: rishard10212

JustBrandonT

Well-Known Member
Newcomer
Joined
Mar 11, 2018
Messages
75
Trophies
0
Age
34
XP
518
Country
Canada
Thank you but is there a guide shows how to inject payload on a 9.3.3 jailbroken iphone?
Sorry to bother

- Download Cydia Impactor.
- Download the ipa.
- Launch Cydia impactor.
- Connect the switch to the phone with the camera adaptor or on the go adapter (the lightning cable will plug into the USB charging power, and the other end into the phone - you can also ignore the power part and just spam the reload button later. You’ll see what I mean.).
- You should get a pop up twice saying that APX device is not supported.
- Both times close it.
- Drag the ipa onto Cydia impactor.
- It will ask you to login to any AppleId.
- Do that and the ipa will install (sometimes you’ll get an error, ignore it and check to see if it’s installed on your device)
- Run the app and voila.
 
Last edited by JustBrandonT,

Riky_Xerez

Member
Newcomer
Joined
Nov 20, 2014
Messages
23
Trophies
0
Age
33
XP
145
Country
Direct connection lightning to usb c doesn’t seem to work and lightning to usb a with usb a to c adapter doesn’t seem to work either.
External power is really necessary it appears.
It does not work with direct lightning usb c cable?
 

Lil_SpazJoekp

Well-Known Member
Newcomer
Joined
Apr 11, 2018
Messages
89
Trophies
0
Age
27
XP
373
Country
United States
- Download Cydia Impactor.
- Download the ipa.
- Launch Cydia impactor.
- Connect the switch to the phone with the camera adaptor or on the go adapter (the lightning cable will plug into the USB charging power, and the other end into the phone - you can also ignore the power part and just spam the reload button later. You’ll see what I mean.).
- You should get a pop up twice saying that APX device is not supported.
- Both times close it.
- Drag the ipa onto Cydia impactor.
- It will ask you to login to any AppleId.
- Do that and the ipa will install (sometimes you’ll get an error, ignore it and check to see if it’s installed on your device)
- Run the app and voila.
So, where does it get the payload from? I have a interface to grab a bin file from iCloud Drive and load it into the inbox.
 

Zonark

Zonark - Noun - A God
Member
Joined
Jul 11, 2010
Messages
410
Trophies
1
XP
2,314
Country
United States
You would have to be jailbroke and have a file manager on iOS in order to implement this. It is possible to do this but the system lacks the software to do this as well as having to have the expensive lighting to type c cable
 

Lil_SpazJoekp

Well-Known Member
Newcomer
Joined
Apr 11, 2018
Messages
89
Trophies
0
Age
27
XP
373
Country
United States
You would have to be jailbroke and have a file manager on iOS in order to implement this. It is possible to do this but the system lacks the software to do this as well as having to have the expensive lighting to type c cable
iOS 11 introduced a file manager. I already have a ui built for loading a file into the app’s inbox.
 
Last edited by Lil_SpazJoekp,

JustBrandonT

Well-Known Member
Newcomer
Joined
Mar 11, 2018
Messages
75
Trophies
0
Age
34
XP
518
Country
Canada
iOS 10-11 introduced a file manager. I already have a ui built for loading a file into the app’s inbox.

I just updated the code and uploaded lib-usb as well.. Now we can all compile it out of the box straight from the git. Also updated the readme for those that don't know about IOKit.framework.

Added ability to load your own payload and intermezzo: https://github.com/Brandon-T/iOUSB/blob/master/iOSNXLauncher/iOSNXLauncher/NXLauncher.mm#L20

It is C++ and I used `[[NSBundle mainBundle] pathForResource:ofType:]` to find the payload and intermezzo. You can use Objective-C or Swift.. doesn't matter.

You can always modify it to use iOS 11's stuff but if you do, don't forget to wrap it into `if @available(iOS, 11*)` blocks and fallback to default for iOS-9+.


Notes:
I also had a chance to test it WITHOUT the USB-3 OTG adapter that I have (IE: Without charging cable).. It works. I tested it with a cheap OTG adapter that just has the one port (I used USB-A to Lightning adapter).
All I had to do was keep spamming the "Reload" button until the exploit uploaded (about 5 seconds of spamming after plugging into my phone).
With the extra charging port, you never have to spam that's the only difference. Why? Because of the intermittent disconnecting I described when I first started the project (lack of power from phone to switch). It doesn't make a difference as long as the exploit gets uploaded :)
 
Last edited by JustBrandonT,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Nah we need a device where we can ask an assistant that can fit in our pockets too bad Samsung... +1