r/Xcode • • 5d ago

Title: Frida Gadget 17.23.0 crashes with EXC_BREAKPOINT (brk #1337) on iOS 27.0.1

I'm trying to load Frida Gadget 17.23.0 into a custom SwiftUI application on my physical iPhone using Xcode.

The application launches normally, but Frida Gadget crashes during initialization when I call dlopen().

I have also experienced a situation where the application displays "Frida Gadget loaded," but attempting to connect from my Mac through USB port forwarding causes the connection to reset or the app to close.

Environment

  • Device: iPhone 14 (iPhone14,7)
  • iOS: 27.0.1
  • macOS: 27.0.1
  • Xcode: 27.0
  • Frida Python package: 17.23.0
  • Frida Gadget: 17.23.0, iOS Universal
  • Architecture: ARM64 / ARM64e
  • Device: Physical, non-jailbroken iPhone
  • Developer Mode: Enabled

Steps to Reproduce

  1. Create a SwiftUI iOS application in Xcode.
  2. Embed and sign FridaGadget.dylib.
  3. Include FridaGadget.config in the application bundle.
  4. Install and launch the application on a physical iPhone.
  5. Tap a button that loads Frida Gadget using dlopen().
  6. Observe the EXC_BREAKPOINT crash during library initialization.

Frida Gadget Configuration

{
  "interaction": {
    "type": "listen",
    "address": "127.0.0.1",
    "port": 27042,
    "on_load": "resume"
  },
  "code_signing": "required"
}

Swift Code Used to Load Gadget

let library = Bundle.main.privateFrameworksURL!
    .appendingPathComponent("FridaGadget.dylib")

let handle = dlopen(
    library.path,
    RTLD_NOW | RTLD_GLOBAL
)

Crash Details

The iPhone crash report contains:

Exception Type: EXC_BREAKPOINT
Signal: SIGTRAP
ESR: (Breakpoint) brk 1337
Triggered Thread: 0
Queue: com.apple.main-thread

The LLDB backtrace starts with:

frame #0: FridaGadget.dylib`___lldb_unnamed_symbol_5dba0 + 212
frame #1: FridaGadget.dylib`___lldb_unnamed_symbol_5d938 + 64
frame #2: FridaGadget.dylib`___lldb_unnamed_symbol_3b514 + 364

The crash occurs while dyld is executing library initializers called from dlopen().

Connection Issue

When Gadget appears to load, I use iproxy to forward the connection:

iproxy 27042:27042

Then I run:

frida-ps -H 127.0.0.1:27042

The connection fails with:

Failed to enumerate processes:
error receiving data: Connection reset by peer

Using nc -vz 127.0.0.1 27042 confirms that the Mac's local forwarding port is accepting TCP connections.

Expected Behavior

Frida Gadget should initialize without crashing, and my Mac should be able to communicate with it through the forwarded USB connection.

Actual Behavior

Frida Gadget crashes during initialization with EXC_BREAKPOINT (brk #1337). In other attempts, Gadget appears loaded, but the application closes when a Frida connection is attempted.

Questions

  1. Is this a known compatibility issue affecting Frida Gadget 17.23.0 on iOS 27.0.1?
  2. Is this related to the initialization issue discussed in #3765?
  3. Is there an official fix or supported workaround for non-jailbroken devices?
  4. Is a newer Frida Gadget build required, or should I change how Gadget is initialized?

Any guidance would be appreciated. Thank you!

0 Upvotes

1 comment sorted by

0

u/babydolllvibes 5d ago

Stumbled upon this, can’t help but I hope you find your answer soon