Skip to content

Instantly share code, notes, and snippets.

@R00tkitSMM
Last active April 24, 2025 09:23
Show Gist options
  • Save R00tkitSMM/accf619dc44db48c8ced79027ae618f6 to your computer and use it in GitHub Desktop.
Save R00tkitSMM/accf619dc44db48c8ced79027ae618f6 to your computer and use it in GitHub Desktop.
dylib to enable entitlement to be able to use GDB in VirtualApple
// export DYLD_SHARED_REGION=1
// ./library_injector /path/to/libentitlement_bypass.dylib /System/Library/Frameworks/Virtualization.framework/Versions/A/XPCServices/com.apple.Virtualization.VirtualMachine.xpc
#import <xpc/xpc.h>
xpc_object_t xpc_connection_copy_entitlement_value(xpc_connection_t, const char *);
xpc_object_t overridden_xpc_connection_copy_entitlement_value(xpc_connection_t connection, const char *entitlement) {
return xpc_bool_create(true);
}
__attribute__((used, section("__DATA,__interpose"))) static struct {
xpc_object_t (*overridden_xpc_connection_copy_entitlement_value)(xpc_connection_t, const char *);
xpc_object_t (*xpc_connection_copy_entitlement_value)(xpc_connection_t, const char *);
} xpc_connection_copy_entitlement_value_overrides[] = {
{overridden_xpc_connection_copy_entitlement_value, xpc_connection_copy_entitlement_value},
};
/*
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.endpoint-security.client</key>
<true/>
<key>com.apple.private.thread-set-state</key>
<true/>
<key>com.apple.private.cs.debugger</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment