bmax121 / APatch

The patching of Android kernel and Android system
GNU General Public License v3.0
4.73k stars 356 forks source link

Root Detected By App #707

Closed hopez13 closed 1 month ago

hopez13 commented 1 month ago

Please check before submitting an issue/在提交 issue 前请检查

Version requirement/版本要求

Describe the bug/描述 bug

Root Is Being Detected By App Which Using Following Smali Logic:

.method public static a()Z
    .registers 3

    sget-object v0, Landroid/os/Build;->TAGS:Ljava/lang/String;

    const/4 v1, 0x1

    if-eqz v0, :cond_f

    const-string/jumbo v2, "test-keys"

    invoke-virtual {v0, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_f

    return v1

    :cond_f
    :try_start_f
    new-instance v0, Ljava/io/File;

    const-string v2, "/system/app/Superuser.apk"

    invoke-direct {v0, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0
    :try_end_1a
    .catch Ljava/lang/Exception; {:try_start_f .. :try_end_1a} :catch_1d

    if-eqz v0, :cond_1d

    return v1

    :catch_1d
    :cond_1d
    const-string v0, "/system/xbin/which su"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/sbin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/system/sd/xbin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/system/bin/failsafe/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/system/bin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/system/xbin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/data/local/xbin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_5f

    const-string v0, "/data/local/bin/"

    invoke-static {v0}, La/a/i/u;->a(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_5e

    goto :goto_5f

    :cond_5e
    const/4 v1, 0x0

    :cond_5f
    :goto_5f
    return v1
.end method

Following Is La/a/i/u;->a(Ljava/lang/String;)Z

.method public static a(Ljava/lang/String;)Z
    .registers 2

    :try_start_0
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
    :try_end_7
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_7} :catch_9

    const/4 p0, 0x1

    goto :goto_a

    :catch_9
    const/4 p0, 0x0

    :goto_a
    return p0
.end method

Reproduce method/复现方法

..

Expected behavior/预期行为

Should Not Detect Root

Actual behaviour /实际行为

The App Should Not Be Able To Detect Root By Using Such Very Basic Method

Screenshots/截图

No response

Logs/日志

No response

Device Name/设备名称

Mi

OS Version/系统版本

Hyper Os

APatch Version/APatch 版本

10946

Kernel Version/内核版本

5.10

KernelPatch Version/KernelPatch 版本

0.11.1

Additional context/其他信息

App Uses Above Logic To Detect Root