`mmap: Operation not permitted`
I keep getting the following output, and the binary does not successfully decrypt:
mmap: Operation not permitted
Succeeded in decrypting the binary.
Seems to be related to https://stackoverflow.com/questions/76089523/why-mmap-fails-to-allocate-executable-page-on-macos:
This Apple document states:
When memory protection is enabled, a thread cannot write to a memory region and execute instructions in that region at the same time. Apple silicon enables memory protection for all apps, regardless of whether they adopt the Hardened Runtime. Intel-based Mac computers enable memory protection only for apps that adopt the Hardened Runtime.
It goes on to explain what you need to do. It’s a bit long to quote, but it boils down to using pthread_jit_write_protect_np to disable memory protection before writing, and to enable it again before executing.
Looks like same ish as https://github.com/NyaMisty/fouldecrypt/issues/15?