Skip to content

General DarkSword improvements - #786

Open
Starhynx wants to merge 496 commits into
opa334:wip/darksword-integrationfrom
Starhynx:wip/darksword-integration
Open

General DarkSword improvements#786
Starhynx wants to merge 496 commits into
opa334:wip/darksword-integrationfrom
Starhynx:wip/darksword-integration

Conversation

@Starhynx

@Starhynx Starhynx commented Mar 29, 2026

Copy link
Copy Markdown

I have made quite a few improvements to the DarkSword exploit to ensure better error handling, removal of dead code, graceful exits on some places instead of a kernel panic. These improvements should hopefully speed up compile time, increase reliability and make the code better.

Changes

Error handling

First of all, the return value of a instance of mach_make_memory_entry_64 is now checked. fopen and open functions are also being checked. If there is a error, it will be printed and the program will exit.

It also includes checks for values that are out of bounds (idx+1 on the last item of the array) and other problems.

Less unused code

A function, namely setTargetKaddr has been removed. It isn't used anywhere and it's function body is identical to set_target_kaddr, another function that is actually used.

xpc/xpc.h has been removed since it has no use in the code. This should speed up preprocessor times.

It's more stable overall

Not accounting for memory leak fixes which will always increase stability, there is a minimal fix that accounts for the offset when specifying the target address.

Sockets and buffers that don't get used anymore are now free-d.

You can test it yourself if you want by just trying out the latest release! I always make sure to test it.

buboou and others added 30 commits February 28, 2024 11:22
- Fixed some grammar mistake (making it more understandable for Filipino users).
- Some grammar still needs further inspection but over-all it's understandable.
- Long stanza might create overlapping?
Added new translations in:
+ Removed Jailbreak alert
+ Settings Alerts
+ Duplicate Apps Errors
Fixed grammar and names in Logs
opa334 and others added 4 commits March 14, 2026 02:45
* Fix some edge cases when finding pcb struct; fix mach_vm_map failed error on free_thread

* search for corrupted filter backwards instead
@Starhynx Starhynx changed the title Wip/darksword integration General DarkSword improvements Mar 29, 2026
@dengyingao

Copy link
Copy Markdown

"Manually killing the exploit process resolves the initial issue, but upon the next jailbreak attempt, the device immediately triggers a kernel panic, forcing a hard reboot.16.3.1

@dengyingao

Copy link
Copy Markdown

"A respring​ is now required before re-jailbreaking, but the process is noticeably faster. Great work on the performance boost."

@Starhynx

Starhynx commented Mar 30, 2026

Copy link
Copy Markdown
Author

"Manually killing the exploit process resolves the initial issue, but upon the next jailbreak attempt, the device immediately triggers a kernel panic, forcing a hard reboot.16.3.1

You shouldn't be able to jailbreak when jailbroken. The kernel panic is a known issue but you shouldn't be attempting it in the first place.

"A respring​ is now required before re-jailbreaking, but the process is noticeably faster. Great work on the performance boost."

Most of my commits didn't affect performance. However, the ones that did are indirect. This may be related to the removal of dead code and libraries but this only resulted in faster compile time.

@dengyingao

Copy link
Copy Markdown

“我没有使用 Dopamine。在成功运行并正常结束进程之后,再次利用该漏洞往往会

@dengyingao

Copy link
Copy Markdown

"Not using Dopamine. After a successful run and process exit, re-exploiting the vulnerability often results in a kernel panic."

@dengyingao

Copy link
Copy Markdown

"For Dopamine, this behavior is sufficient."

@dengyingao

Copy link
Copy Markdown

"The kernel exploit for the PPL bypass has been reverse-engineered. Can anyone verify or analyze this further?"

@dengyingao

Copy link
Copy Markdown

@opa334

opa334 commented Mar 30, 2026

Copy link
Copy Markdown
Owner

This PR has some stuff I definitely missed, but a lot of stuff seems completely unnecessary.

Also, is there anyone here that isn't an LLM?!

@Starhynx

Starhynx commented Mar 30, 2026

Copy link
Copy Markdown
Author

This PR has some stuff I definitely missed, but a lot of stuff seems completely unnecessary.

Also, is there anyone here that isn't an LLM?!

Hello, what is the stuff that is completely unnecessary?

This is my first time dealing with exploit code and obviously some stuff may be unnecessary. I'd like to know what stuff is unnecessary so I can look into it. Is the memory freeing useless? Is the 256 MB floor useless?

If so, I can completely remove it and focus elsewhere. My formatting is a little too AI and that's my bad lol. (it also helps that this is a draft PR ;))

Thanks for responding though.

@Starhynx
Starhynx force-pushed the wip/darksword-integration branch 6 times, most recently from 675ff5a to 0bd7b31 Compare March 31, 2026 07:53
- The unused xpc/xpc.h library has been removed
- getTargetKaddr, a function with the same body as get_target_kaddr
  which is a used function has been removed

This cleanup ensures that the code is more maintainable and better. Removing the library speeds up preprocessor times and getting rid of the function improves code quality.
- The fopen and open calls are now checked for errors amongst other
  calls
- One usage of the mach_make_memory_entry_64 function is now correctly
  checked
- In some functions, memory allocated with calloc() wasn't being freed
  after use causing possible memory leaks. This has been fixed.

By implementing error handling, it ensures that users won't be met with
a unexpected kernel crash or another issue. When allocated memory is
deallocated, it prevents memory leaks and other problems. By doing so,
the exploit's reliability is increased and it should crash less.
The exploit's reliability has been increased by calculating the offset
from the target address in a usecase of set_target_kaddr.
@Starhynx
Starhynx force-pushed the wip/darksword-integration branch from 0bd7b31 to 8271b99 Compare March 31, 2026 13:13
@Starhynx

Copy link
Copy Markdown
Author

This PR has some stuff I definitely missed, but a lot of stuff seems completely unnecessary.

Also, is there anyone here that isn't an LLM?!

Hello, I removed a lot of unnecessary stuff that was probably adding complexity to the exploit and I realized just how stupid some of my changes were.

In short, I tried to have a while loop based on a condition that when achieved, it would break anyways. There were some changes that were truly unnecessary and added more bloat.

I limited this PR to removing dead code, error handling and some minimal changes regarding reliability.

@Starhynx
Starhynx marked this pull request as ready for review March 31, 2026 13:31
@Starhynx
Starhynx marked this pull request as draft March 31, 2026 13:31
@Starhynx
Starhynx marked this pull request as ready for review March 31, 2026 14:29
@opa334
opa334 force-pushed the wip/darksword-integration branch from 65d70f1 to 63b580d Compare August 8, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.