Skip to content

mmap: Operation not permitted #5

@vergenzt

Description

@vergenzt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions