nowsecure / r2frida

Radare2 and Frida better together.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android: `wa ret` is not allowed in R2Frida session. `error: expected a pointer`

enovella opened this issue · comments

More info & sample at: #556

Problem

We cannot perform in-memory patching

image

Old slides with right inmem patching

image

More info

[0x751067cad4]> wa ret
ERROR: error: expected a pointer
ERROR: Cannot write. Use `omf`, `io.cache` or reopen the file in rw with `oo+`
[0x751067cad4]> wx c0035fd6
ERROR: error: expected a pointer
ERROR: Cannot write. Use `omf`, `io.cache` or reopen the file in rw with `oo+`
[0x751067cad4]> wx 0xc0035fd6
ERROR: error: expected a pointer
ERROR: Cannot write. Use `omf`, `io.cache` or reopen the file in rw with `oo+`
[0x751067cad4]>

Memory permissions: :dmp failing

image

@trufae was io.cache set to false by default before?

image

if io.cache is enabled then you are not patching anything. on linux, mac and ios all these commands works fine, , wa, wx and dmp work as it should

It worked running Android 12 and Frida 16.1.10: (with io.cache=false)

image

:dmp working on Android 12 running Frida 16.1.11:

image

It doesnt work on a region that it doesnt already have rwx:

Screenshot 2024-02-04 at 11 50 04

It worked running Android 12 and Frida 16.1.10: (with io.cache=false)

image

Where is your ret written into? I cannot see the successful message as well as the opcode ret in the current offset.

[0x7b5aecbad4]> wa ret
INFO: Written 4 byte(s) (ret) = wx c0035fd6 @ 0x7b5aecbad4

image

It works on a cleaned installation, tested with @as0ler