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

frida注入不了zygote #1

Open
axhlzy opened this issue Jul 28, 2020 · 6 comments
Open

frida注入不了zygote #1

axhlzy opened this issue Jul 28, 2020 · 6 comments

Comments

@axhlzy
Copy link

axhlzy commented Jul 28, 2020

注入不了zygote,
也就是实现不了dbopener这样的xp插件
这种问题有没有没办法解决

@monkeylord
Copy link
Owner

zygote比较复杂,我也没有搞清楚怎么注入

但是开启调试这件事相对简单一些,可以在android.os.Debug,或者dalvik.system.VMDebug上做手脚,手工开启调试
以及,DDMS能够达到的功能,理论上应该都能达到

@monkeylord
Copy link
Owner

ActivityThread是这么干的

        if (data.debugMode != IApplicationThread.DEBUG_OFF) {
            // XXX should have option to change the port.
            Debug.changeDebugPort(8100);
            if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
                Slog.w(TAG, "Application " + data.info.getPackageName()
                      + " is waiting for the debugger on port 8100...");

                IActivityManager mgr = ActivityManagerNative.getDefault();
                try {
                    mgr.showWaitingForDebugger(mAppThread, true);
                } catch (RemoteException ex) {
                }

                Debug.waitForDebugger();

                try {
                    mgr.showWaitingForDebugger(mAppThread, false);
                } catch (RemoteException ex) {
                }

            } else {
                Slog.w(TAG, "Application " + data.info.getPackageName()
                      + " can be debugged on port 8100...");
            }
        }

我们照着干应该就行

@axhlzy
Copy link
Author

axhlzy commented Jul 28, 2020

嗯 谢谢大佬的解释
开启调试这件事相对简单一些,但是可以研究一下zygote怎么注入,能用frida注入那就完美了

@monkeylord
Copy link
Owner

查了一下,做frida-java-bridge的大佬在某个issue表示,zygote fork时所有的线程都会停止。导致被hook的方法会调用一个状态未初始化的线程。
反正没太看懂,大概就是frida处理java hook时依赖的JS引擎会在zygote fork时停止工作。

如果要hook zygote,可能需要结合C层和Java层,做一些hack。

@axhlzy
Copy link
Author

axhlzy commented Jul 30, 2020

诶 frida虽然比Xpoed用起来方便的多,但是那也只是应用级别的Hook,无法Hook Zygote就不能替换Xposed的地位

@monkeylord
Copy link
Owner

诶 frida虽然比Xpoed用起来方便的多,但是那也只是应用级别的Hook,无法Hook Zygote就不能替换Xposed的地位

嗯,这么说也不错。
但是Xposed也有局限,比如IoT设备就不能用,因为Xposed要刷机。

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

2 participants