gum-graft

Purpose

gum-graft pre-patches Mach-O binaries so that Frida’s Interceptor can instrument them in environments where runtime code modification is blocked by strict code-signing enforcement.

Primary use case: Jailed Apple mobile devices (iOS/iPadOS) running an app without a debugger attached.

Prerequisites

When to Use

ConditionUse gum-graft?
Jailed iOS device, no debugger attached, strict code-signingYes
Jailed iOS device with debugger attachedNo (runtime patching works)
Jailbroken deviceNo (runtime patching works)
macOS / Linux / WindowsNo (runtime patching works)

CLI Reference

Usage: gum-graft [OPTION?] BINARY - graft instrumentation into Mach-O binaries

Help Options

FlagDescription
-h, --helpShow help options

Application Options

FlagArgumentDescription
-i, --instrument0x1234Include instrumentation for a specific code offset
-s, --ingest-function-startsInclude instrumentation for all offsets from LC_FUNCTION_STARTS load command
-m, --ingest-importsInclude instrumentation for all imported symbols
-z, --transform-lazy-bindsTransform lazy binds into regular binds (experimental)

Usage Notes

Workflow

  1. Build and sign the target binary with Frida Gadget embedded.
  2. Set Gadget code_signing to required in its JSON config.
  3. Run gum-graft against the binary with the desired instrumentation options.
  4. Re-sign the patched binary with your provisioning profile.
  5. Deploy to the jailed device — Interceptor hooks will fire at the pre-patched sites.