KpwnZ / Def1nit3lyN0tAJa1lbr3akTool

A jailbreak tool for all arm64 devices on iOS 16.0 to iOS 16.6.1
GNU General Public License v3.0
372 stars 46 forks source link

Workaround for "deep sleep" and "session ended" bugs #32

Closed HiSaCC99 closed 8 months ago

HiSaCC99 commented 8 months ago

USE AT YOUR OWN RISK! I am not responsible for any damage done to your phone.

DISCLAIMER: I'm aware that IT IS NOT the best/proper solution for fixing those bugs (specially the "session ended" bug, because there is a thread on Dopamine GitHub that explain this workaround make this error 10 time worse. Opa words!), so wait the developer to fix these, please!

Hi y'all! I was able to get past the "deep sleep" bug installing Fiona (julioverne repo) and "session ended" bug installing login (https://nt994.github.io/ repo). Fiona doesn't allow to enter in "deep sleep" the iPhone because it keeps Wi-Fi always connected when the iPhone is locked (I noticed a slightly battery drain), while the other package is able to get past to some error to use the terminal (you can't use "su" and "sudo" command). My iPhone didn't reboot for over 6 hours and counting!

PS: @KpwnZ if you think I should close/remove this post, please tell me! Thank you for your hard work as always!

KpwnZ commented 8 months ago

New version is available now. https://github.com/KpwnZ/Def1nit3lyN0tAJa1lbr3akTool/releases/tag/v0.999.10. Deep sleep panic should be fixed.

HiSaCC99 commented 8 months ago

New version is available now. https://github.com/KpwnZ/Def1nit3lyN0tAJa1lbr3akTool/releases/tag/v0.999.10. Deep sleep panic should be fixed.

Yep! Deep Sleep panic resolved! Thank you for continuing working on this project!

KpwnZ commented 8 months ago

For the "Session Ended" bug, I have already found the reason but I am a little bit busy with my own research now (and too lazy to fix). If there can be other developers who are interested in it feel free to open a PR or contact me if you need any help.

jthoward64 commented 8 months ago

For the "Session Ended" bug, I have already found the reason but I am a little bit busy with my own research now (and too lazy to fix). If there can be other developers who are interested in it feel free to open a PR or contact me if you need any help.

If you don't mind posting what you know about it I'd love to take a crack at it (I've been wanting to help out with this project but I've been unsure where to start)

KpwnZ commented 8 months ago

For the "Session Ended" bug, I have already found the reason but I am a little bit busy with my own research now (and too lazy to fix). If there can be other developers who are interested in it feel free to open a PR or contact me if you need any help.

If you don't mind posting what you know about it I'd love to take a crack at it (I've been wanting to help out with this project but I've been unsure where to start)

There is a todo in jailbreakd https://github.com/KpwnZ/Def1nit3lyN0tAJa1lbr3akTool/blob/0e208992c4621c585932714e6de1f5e417f0d8b4/basebin/jailbreakd/main.mm#L316

jthoward64 commented 8 months ago

For the "Session Ended" bug, I have already found the reason but I am a little bit busy with my own research now (and too lazy to fix). If there can be other developers who are interested in it feel free to open a PR or contact me if you need any help.

If you don't mind posting what you know about it I'd love to take a crack at it (I've been wanting to help out with this project but I've been unsure where to start)

There is a todo in jailbreakd

https://github.com/KpwnZ/Def1nit3lyN0tAJa1lbr3akTool/blob/0e208992c4621c585932714e6de1f5e417f0d8b4/basebin/jailbreakd/main.mm#L316

I'm having some trouble building the code in basebin, I extracted the deb.tar, binaries.tar, and ramdisk.dmg files from the ipa and extracted deb and binaries to the root folder but I'm getting these two errors depending on the folder I try to build:

clang -framework Foundation -framework CoreServices -framework Security -I../_shared -I./src -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -arch arm64 -miphoneos-version-min=15.0 -fobjc-arc  -o jbctl src/jailbreakd.m src/main.m
codesign -f -s - --timestamp=none --all-architectures --entitlements ./entitlements.plist --deep src/jailbreakd.m
mv jbctl ../../binaries
rm ../../binaries/jb.tc
rm: ../../binaries/jb.tc: No such file or directory
make: *** [jbctl] Error 1
clang -framework Foundation -framework CoreServices -framework Security -framework IOKit -I./src/_shared -I./src -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -arch arm64 -miphoneos-version-min=15.0 -fobjc-arc -O2 -dynamiclib -rpath @loader_path/fallback  -L./src/_shared -lbsm -lellekit -o launchdhook.dylib src/boot_info.m src/common.m src/daemon_hook.m src/envbuf.m src/ipc_hook.m src/jailbreakd.m src/main.m src/spawn_hook.m
ld: tapi error: malformed file
/Users/tagho/Source/Def1nit3lyN0tAJa1lbr3akTool/basebin/_shared/libellekit.tbd:3:26: error: unknown platform
targets:               [ arm64, arm64e ]
                         ^~~~~
 in '/Users/tagho/Source/Def1nit3lyN0tAJa1lbr3akTool/basebin/_shared/libellekit.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [launchdhook.dylib] Error 1

Is there something I'm missing, or am I just using the wrong compiler/command?

KpwnZ commented 8 months ago

For the "Session Ended" bug, I have already found the reason but I am a little bit busy with my own research now (and too lazy to fix). If there can be other developers who are interested in it feel free to open a PR or contact me if you need any help.

If you don't mind posting what you know about it I'd love to take a crack at it (I've been wanting to help out with this project but I've been unsure where to start)

There is a todo in jailbreakd https://github.com/KpwnZ/Def1nit3lyN0tAJa1lbr3akTool/blob/0e208992c4621c585932714e6de1f5e417f0d8b4/basebin/jailbreakd/main.mm#L316

I'm having some trouble building the code in basebin, I extracted the deb.tar, binaries.tar, and ramdisk.dmg files from the ipa and extracted deb and binaries to the root folder but I'm getting these two errors depending on the folder I try to build:

clang -framework Foundation -framework CoreServices -framework Security -I../_shared -I./src -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -arch arm64 -miphoneos-version-min=15.0 -fobjc-arc  -o jbctl src/jailbreakd.m src/main.m
codesign -f -s - --timestamp=none --all-architectures --entitlements ./entitlements.plist --deep src/jailbreakd.m
mv jbctl ../../binaries
rm ../../binaries/jb.tc
rm: ../../binaries/jb.tc: No such file or directory
make: *** [jbctl] Error 1
clang -framework Foundation -framework CoreServices -framework Security -framework IOKit -I./src/_shared -I./src -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -arch arm64 -miphoneos-version-min=15.0 -fobjc-arc -O2 -dynamiclib -rpath @loader_path/fallback  -L./src/_shared -lbsm -lellekit -o launchdhook.dylib src/boot_info.m src/common.m src/daemon_hook.m src/envbuf.m src/ipc_hook.m src/jailbreakd.m src/main.m src/spawn_hook.m
ld: tapi error: malformed file
/Users/tagho/Source/Def1nit3lyN0tAJa1lbr3akTool/basebin/_shared/libellekit.tbd:3:26: error: unknown platform
targets:               [ arm64, arm64e ]
                         ^~~~~
 in '/Users/tagho/Source/Def1nit3lyN0tAJa1lbr3akTool/basebin/_shared/libellekit.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [launchdhook.dylib] Error 1

Is there something I'm missing, or am I just using the wrong compiler/command?

You don't need to compile jbctl now. It's out of date.

jthoward64 commented 8 months ago

You don't need to compile jbctl now. It's out of date.

It's not just jbctl, I can't compile any of the makefiles; but if you're not familiar with the issue I can mess around with it and see if I can get it working. Thanks!

KpwnZ commented 8 months ago

You don't need to compile jbctl now. It's out of date.

It's not just jbctl, I can't compile any of the makefiles; but if you're not familiar with the issue I can mess around with it and see if I can get it working. Thanks!

idk if this can be related to the SDK version. Haven't encounter this previously.

nyathea commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

Su4o commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks!

(sorry for the dumb question…)

jthoward64 commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks!

(sorry for the dumb question…)

Click the i button, change mobile to root and change owner group and other to have execute enabled

Su4o commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks! (sorry for the dumb question…)

Click the i button, change mobile to root and change owner group and other to have execute enabled

Wait, I can't move it in anymore?? i get the following error on filza "Error The operation couldn't be completed. Permission denied"

nyathea commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks!

(sorry for the dumb question…)

Click the i button, change mobile to root and change owner group and other to have execute enabled

Wait, I can't move it in anymore?? i get the following error on filza "Error The operation couldn't be completed. Permission denied"

Try using the trollstore version of filza. And make sure you're putting it in the /var/jb/usr/bin directory.

Su4o commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks!

(sorry for the dumb question…)

Click the i button, change mobile to root and change owner group and other to have execute enabled

Wait, I can't move it in anymore?? i get the following error on filza "Error The operation couldn't be completed. Permission denied"

Try using the trollstore version of filza. And make sure you're putting it in the /var/jb/usr/bin directory.

Tried it, still doesn’t work. It gives me the same error. I’ve done the Trollstore ver instead too.

KpwnZ commented 8 months ago

If anyone is still interested in fixing the setuid problem, you need to update the struct ucred in struct proc_ro.

KpwnZ commented 8 months ago

You can use “pseudo” as an alternative for now. It’ll work like sudo and give you root privileges in newterm.

Use with caution as this runs without a password unlike sudo.

https://github.com/BomberFish/pseudo/releases/tag/v1.0.0

Download the file and put it in /var/jb/usr/bin using filza and change the permissions of it to root:wheel and make it executable.

I moved it but don’t know how to change perms to root:wheel? Can you give the step by step solution or a small video? Thanks!

(sorry for the dumb question…)

Click the i button, change mobile to root and change owner group and other to have execute enabled

Wait, I can't move it in anymore?? i get the following error on filza "Error The operation couldn't be completed. Permission denied"

Try using the trollstore version of filza. And make sure you're putting it in the /var/jb/usr/bin directory.

Tried it, still doesn’t work. It gives me the same error. I’ve done the Trollstore ver instead too.

It's fixed now, update will be released later.

jthoward64 commented 8 months ago

It's fixed now, update will be released later.

Awesome! Thank you so much, I tried to figure out a PR but got lost in the weeds of iOS

KpwnZ commented 8 months ago

v1.0.1 should fix all of bugs mentioned here.

Su4o commented 8 months ago

v1.0.1 should fix all of bugs mentioned here.

yessirr, thanks @KpwnZ

jthoward64 commented 8 months ago

Worth noting that it didn't work for me at first but after reinstalling system-cmds and sudo, re-jailbreaking, and reinstalling system-cmds and sudo again I got a prompt in newterm. The reason is probably that even though the setuid syscall works now, the original binaries didn't have the setuid bit and had to be reinstalled to set it.