LSPatch icon indicating copy to clipboard operation
LSPatch copied to clipboard

[Bug] getPackageResourcePath not spoofed

Open heqyoufree opened this issue 3 years ago • 3 comments

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/版本要求

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

Apk file/Apk 文件

No response

Logs/日志

No logs needed

heqyoufree avatar Jan 30 '23 16:01 heqyoufree

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.

heqyoufree avatar Jan 30 '23 16:01 heqyoufree

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

suqiernb avatar Jun 23 '23 04:06 suqiernb

/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.

heqyoufree avatar Jun 30 '23 05:06 heqyoufree