Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global hook for customized AOSP #1139

Open
zhifeng-wang opened this issue Dec 30, 2019 · 3 comments
Open

Global hook for customized AOSP #1139

zhifeng-wang opened this issue Dec 30, 2019 · 3 comments

Comments

@zhifeng-wang
Copy link

It would be fantastic if the Android rom customizer can make frida a build-in feature, so that one can inject frida into every apk laterly installed without repacking them.

I tried following steps without luck:

  1. put libfrida-gadget.so and libfrida-gadget.config.so(the config json file) in to system/lib and system/lib64;
  2. register libfrida-gadget.so in /system/etc/public.libraries.txt;
  3. call System.loadLibrary('frida-gadget') in newApplication in [Aosp souce code]\frameworks\base\core\java\android\app\Instrumentation.java.

related log: frida-gadget: type=1400 audit(0.0:8): avc: denied { read } for name="primary" dev="tmpfs" ino=19137 scontext=u:r:zygote:s0 tcontext=u:object_r:storage_file:s0 tclass=lnk_file permissive=0

@tacesrever
Copy link

tacesrever commented Jan 2, 2020

by errorlog, frida-gadget is injected into zygote, so it use this sepolicy:
https://android.googlesource.com/platform/system/sepolicy/+/master/private/zygote.te

this happened when frida-gadget try to read somefile at storage_file, which not allowed by zygote.te.

as reference, there may be two way to solve:

  1. if use script-directory, set path to where zygote and all apps can read,
    or modify zygote.te, allow zygote to read storage_file or other filesystem frida-gadget should use.
  2. don't load frida-gadget in zygote process. may can be done by do not register libfrida-gadget, and setenforce 0, then put dlopen at somewhere zygote don't use but in real app's start routine.

@zhifeng-wang
Copy link
Author

@tacesrever Very intuitive. Thanks so much!

@gitWK86
Copy link

gitWK86 commented Oct 12, 2021

@tacesrever Very intuitive. Thanks so much!

hello, I have the same problem. use script-directory, set path to where can work?

frida-gadget: type=1400 audit(0.0:11): avc: denied { read } for name="primary" dev="tmpfs" ino=30102 scontext=u:r:mediaprovider_app:s0:c100,c256,c512,c768 tcontext=u:object_r:mnt_pass_through_file:s0 tclass=lnk_file permissive=0 app=com.android.providers.media.module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants