frida-server Unable to preload error message on start

Created on 2 Apr 2019  路  6Comments  路  Source: frida/frida

Just trying to launch latest frida-server 12.4.7 on android 9 AOSP v6.4 3.4.113-xren Magisk
getenforce Permissive

# /system/xbin/frida-server -l 0.0.0.0

gives me
Unable to preload: Unable to access process with pid 614 (zygote) due to system restrictions; try sudo sysctl kernel.yama.ptrace_scope=0, or run Frida as root

logcat output:

04-02 15:38:32.509 224 224 I SELinux : SELinux: Loaded service_contexts from: 04-02 15:38:32.509 224 224 I SELinux : /plat_service_contexts 04-02 15:38:32.509 224 224 I SELinux : /vendor_service_contexts 04-02 15:38:32.509 224 224 I SELinux : avc: received policyload notice (seqno=6)
Any tips how to troubleshoot this issue. Thanks

Most helpful comment

Problem was the latest Magisk 19.0, whose MagiskHide module attaches to zygote process with the ptrace

All 6 comments

strace -f -s 128 frida-server output:

23714 readlinkat(AT_FDCWD, "/proc/614/exe", "/system/bin/app_process32", 256) = 25
23714 mknodat(AT_FDCWD, "/data/local/tmp/re.frida.server/linjector-3", S_IFIFO|0666) = 0
23714 fchmodat(AT_FDCWD, "/data/local/tmp/re.frida.server/linjector-3", 0666) = 0
23714 setxattr("/data/local/tmp/re.frida.server/linjector-3", "security.selinux", "u:object_r:frida_file:s0", 25, 0) = 0
23714 openat(AT_FDCWD, "/data/local/tmp/re.frida.server/linjector-3", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 8
-23714 **ptrace(PTRACE_SEIZE, 614, NULL, PTRACE_O_TRACEEXEC) = -1 EPERM (Operation not permitted)**
-23714 ptrace(PTRACE_GETREGS, 614, NULL, 0xbe844584) = -1 ESRCH (No such process)
23714 futex(0xb6eb0d6c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
23714 close(8)                          = 0
23714 unlinkat(AT_FDCWD, "/data/local/tmp/re.frida.server/linjector-3", 0) = 0
23714 ppoll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 2, {tv_sec=0, tv_nsec=0}, NULL, 0) = 0 (Timeout)
23714 write(6, "\1\0\0\0\0\0\0\0", 8 <unfinished ...>
23719 <... ppoll resumed> )             = 1 ([{fd=6, revents=POLLIN}])
23719 futex(0xb65ec3f0, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
23714 <... write resumed> )             = 8
23714 futex(0xb65ec3f0, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
23719 <... futex resumed> )             = 0
23719 read(6, "\1\0\0\0\0\0\0\0", 16)   = 8
23719 futex(0xb65ec3f0, FUTEX_WAKE_PRIVATE, 1) = 0
23719 futex(0xb65f6930, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
23714 <... futex resumed> )             = 1
23714 futex(0xb65f6930, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
23719 <... futex resumed> )             = 0
23719 futex(0xb65f6930, FUTEX_WAKE_PRIVATE, 1) = 0
23719 futex(0xb65b3064, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
23714 <... futex resumed> )             = 1
23714 futex(0xb65b3064, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
23719 <... futex resumed> )             = 0
23719 futex(0xb65b3064, FUTEX_WAKE_PRIVATE, 1) = 0
23719 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=934666747}) = 0
23719 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=934762997}) = 0
23719 sendmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\3\1\1\211\0\0\0\3\0\0\0008\0\0\0\10\1g\0\1s\0\0\4\1s\0\37\0\0\0re.frida.Error.PermissionDenied\0\5\1u\0\3\0\0\0\204\0\0\0Unable to access process with pid 614 due to system "..., iov_len=209}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 209
23718 <... ppoll resumed> )             = 1 ([{fd=9, revents=POLLIN}])
23719 ppoll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}], 2, {tv_sec=0, tv_nsec=0}, NULL, 0 <unfinished ...>
23718 write(10, "\1\0\0\0\0\0\0\0", 8 <unfinished ...>
23719 <... ppoll resumed> )             = 0 (Timeout)
23718 <... write resumed> )             = 8
23719 ppoll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}], 2, NULL, NULL, 0 <unfinished ...>
23718 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=935375706}) = 0
23718 recvmsg(9, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\3\1\1\211\0\0\0\3\0\0\0008\0\0\0", iov_len=16}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 16
23718 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=935650290}) = 0
23718 ppoll([{fd=9, events=POLLIN}], 1, {tv_sec=0, tv_nsec=0}, NULL, 0) = 1 ([{fd=9, revents=POLLIN}], left {tv_sec=0, tv_nsec=0})
23718 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=935888779}) = 0
23718 recvmsg(9, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\1g\0\1s\0\0\4\1s\0\37\0\0\0re.frida.Error.PermissionDenied\0\5\1u\0\3\0\0\0\204\0\0\0Unable to access process with pid 614 due to system restrictions; tr"..., iov_len=193}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 193
23718 write(10, "\1\0\0\0\0\0\0\0", 8)  = 8
23718 write(10, "\1\0\0\0\0\0\0\0", 8)  = 8
23718 ppoll([{fd=8, events=POLLIN}, {fd=10, events=POLLIN}], 2, {tv_sec=0, tv_nsec=0}, NULL, 0) = 1 ([{fd=10, revents=POLLIN}], left {tv_sec=0, tv_nsec=0})
23718 read(10, "\3\0\0\0\0\0\0\0", 16)  = 8
23718 write(5, "\1\0\0\0\0\0\0\0", 8)   = 8
23718 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=936774040}) = 0
23718 ppoll([{fd=9, events=POLLIN}], 1, {tv_sec=0, tv_nsec=0}, NULL, 0) = 0 (Timeout)
23718 write(10, "\1\0\0\0\0\0\0\0", 8)  = 8
23718 ppoll([{fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 3, NULL, NULL, 0) = 1 ([{fd=10, revents=POLLIN}])
23718 read(10, "\1\0\0\0\0\0\0\0", 16)  = 8
23718 ppoll([{fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}], 3, NULL, NULL, 0 <unfinished ...>
23709 <... ppoll resumed> )             = 1 ([{fd=5, revents=POLLIN}], left {tv_sec=24, tv_nsec=551554857})
23709 read(5, "\1\0\0\0\0\0\0\0", 16)   = 8
23709 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=937558831}) = 0
23709 futex(0xa773ed60, FUTEX_WAKE_PRIVATE, 2147483647) = 0
23709 unlinkat(AT_FDCWD, "/data/local/tmp/re.frida.server/pipe-dede671847ad5d455439d54f9d5229cd", 0) = 0
23709 ppoll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}], 4, {tv_sec=0, tv_nsec=0}, NULL, 0) = 0 (Timeout)
23709 futex(0xa773ed18, FUTEX_WAKE_PRIVATE, 2147483647) = 0
23709 clock_gettime(CLOCK_MONOTONIC, {tv_sec=12309, tv_nsec=938252529}) = 0
23709 futex(0xa773ec88, FUTEX_WAKE_PRIVATE, 2147483647) = 0
23709 write(2, "Unable to preload: Unable to access process with pid 614 due to system restrictions; try `sudo sysctl kernel.yama.ptrace_scope=0"..., 152) = 152
23709 futex(0xa773ecd0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
23709 ppoll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}], 4, NULL, NULL, 0 <unfinished ...>
23714 <... futex resumed> )             = 1
23714 ppoll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 2, NULL, NULL, 0 <unfinished ...>
23716 <... futex resumed> )             = -1 ETIMEDOUT (Connection timed out)

>> Full strace log here <<

Problem was the latest Magisk 19.0, whose MagiskHide module attaches to zygote process with the ptrace

Same problem like you. This really help me. Thank you!

Fuck! This really help me.

magiskhide  disable
MagiskHide is not enabled

i am disable magiskhide but still fail run frida-server .

./fridas -v
Unable to preload: Unable to access zygote while preparing for app launch; try disabling Magisk Hide in case it is active

how to resolve

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spacex97 picture spacex97  路  3Comments

PerilousTheGreat picture PerilousTheGreat  路  3Comments

asad0x01 picture asad0x01  路  4Comments

packmad picture packmad  路  4Comments

mabin004 picture mabin004  路  3Comments