android - 保护应用程序免于绕过根检测(Frida Server)

标签 android cordova cookies webview

我看到一个post关于使用 frida 服务器绕过 android 应用程序的根检测。当我按照这些步骤操作时,根检测不起作用。任何人都有想法保护根检测不被使用 Frida 服务器/任何其他服务器绕过

最佳答案

Check对于共享库中的 root 和 launch一个 Activity 说,设备是 rooted 来自共享库本身清除返回堆栈。 native 二进制文件很难进行逆向工程(它们需要函数名称才能在 Frida 上进行操作)。

您还可以阻止 frida 访问 attaching到你的应用程序。 从frida docs我们可以看到frida使用了ptrace

Frida needs in a first step to inject an agent in the targeted >application so that it is in the memory space of the process.

On Android and Linux such injection is done with ptrace by attaching or spawning a process and then injecting the agent. Once the agent is injected, it communicates with its server through a pipe.

当使用 ptrace 系统调用附加到进程时,被调试进程的状态文件中的“TracerPid”字段显示附加进程的 PID。 “TracerPid”的默认值为 0(没有附加进程)。因此,在该字段中找到除 0 以外的任何内容都是调试或其他 ptrace 恶作剧的标志。 以下实现来自 Tim Strazzere 的 Anti-Emulator 项目:

#include <jni.h>
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <pthread.h>

static int child_pid;

void *monitor_pid() {

    int status;

    waitpid(child_pid, &status, 0);

    /* Child status should never change. */

    _exit(0); // Commit seppuku

}

void anti_debug() {

    child_pid = fork();

    if (child_pid == 0)
    {
        int ppid = getppid();
        int status;

        if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0)
        {
            waitpid(ppid, &status, 0);

            ptrace(PTRACE_CONT, ppid, NULL, NULL);

            while (waitpid(ppid, &status, 0)) {

                if (WIFSTOPPED(status)) {
                    ptrace(PTRACE_CONT, ppid, NULL, NULL);
                } else {
                    // Process has exited
                    _exit(0);
                }
            }
        }

    } else {
        pthread_t t;

        /* Start the monitoring thread */
        pthread_create(&t, NULL, monitor_pid, (void *)NULL);
    }
}

JNIEXPORT void JNICALL
Java_sg_vantagepoint_antidebug_MainActivity_antidebug(JNIEnv *env, jobject instance) {

    anti_debug();
}

请引用这个guide通过有利位置进行反调试技巧。 有一个特定的 section在本指南中介绍了 frida

还有 https://github.com/b-mueller/frida-detection-demo

否则,您可以使用Appdome(IPaaS)的服务来block frida 附加到您的应用

关于android - 保护应用程序免于绕过根检测(Frida Server),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59465880/

相关文章:

html - 使用 jquery mobile 在移动应用程序的 html5 Canvas 上绘制平滑线

javascript - 使用 cookie 切换主体类别

android - 如何隐藏系统栏并仅在android中的触摸屏上可见

java - TabHost.TabSpec 内容未出现

java - Android 中调整大小问题

java - 通过 JAX-RS Jersey 服务使用 Cookie 和 JSON

asp.net - 将 Request.ApplicationPath 用于 cookie 路径是否安全

java - JSONException : No value for photo

android - Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置

angularjs - 如何使过滤器在html中查看