Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

[Bug] getPackageResourcePath not spoofed #174

Open
1 task done
heqyoufree opened this issue Jan 30, 2023 · 3 comments
Open
1 task done

[Bug] getPackageResourcePath not spoofed #174

heqyoufree opened this issue Jan 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@heqyoufree
Copy link

Steps to reproduce/复现步骤

LSPatch detected with following code

val apkPath = getApplicationContext().getPackageResourcePath().toString()
if (!apkPath.endsWith("base.apk") || !apkPath.startsWith("/data/app")) {
    Toast.makeText(getApplicationContext(), "LSPatch!!!", Toast.LENGTH_LONG).show();
} else {
    Toast.makeText(getApplicationContext(), "Safe", Toast.LENGTH_LONG).show();
}

Expected behaviour/预期行为

getPackageResourcePath() should return /data/app/<package-name>/base.apk and operations on apk should be redirected to the original apk.

Actual behaviour/实际行为

getPackageResourcePath() returns /data/user/0/<package-name>/cache/lspatch/origin/<crc>.apk

Xposed Module List/Xposed 模块列表

none

LSPatch version/LSPatch 版本

0.5.1 (368)

Android version/Android 版本

13

Shizuku version/Shizuku 版本

N/A

Version requirement/版本要求

  • I am using latest debug CI version of LSPatch and enable verbose log/我正在使用最新 CI 调试版本且启用详细日志

Apk file/Apk 文件

No response

Logs/日志

No logs needed

@heqyoufree heqyoufree added the bug Something isn't working label Jan 30, 2023
@heqyoufree
Copy link
Author

The modules need to be read from the apk, so simple redirection might break them. It might be better to unpack them first and then load.

@suqiernb
Copy link

suqiernb commented Jun 23, 2023

我遇到了相同的问题,实际上大多数的路径都会指向 /data/data/<package>/cache/lspatch/origin/<crc32>.apk

@heqyoufree
Copy link
Author

heqyoufree commented Jun 30, 2023

/data/data/<package-name> is the same as /data/user/0/<package-name> for user 0. A workaround can be done by hooking the method and returning the normal path.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants