r/jailbreakdevelopers • • Jun 27 '20

[Tutorial] How To Hook Swift Method With Frida

Hello,

In this blog post, I explaine how to hook swift anti-jailbreak methods using Frida. Hope it will be useful !

50 Upvotes

4 comments sorted by

1

u/noise_pro Jun 28 '20

Is there a way to hook swift properties and modify its values?

3

u/syrion89 Jun 28 '20 edited Jun 28 '20

properties

Hi, yes!!! It's what I did in the "Change the “Jailed” string" part.

In that case, I found the instruction that was "working" with the address of the string "Jailed":

addrp x0, #0x10000600

add x0,x0, #0x550

after the add instruction, I knew the address of the string "Jailed" was in the x0 register, so, I put the address of my new string in the x0 register.

There are cases where, you don't have an address but the value itself, for istance, let assume you have a properties with a hardcoded value:

a = 9;

at some point, when reversing, you will find something like this:

mov x1, 0x9

you can change its value by changing the x1 register value, in Frida you can do it with the following instruction:

this.context.x1 = 0x01

at this point, the application will use the 0x1 value and not the 0x9.

Hope It is clear, let me know if you have some doubts!