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

[BUG]Preserve original signature scheme v2, v3, v4 in modded APK #3779

Open
TechnoIndian opened this issue Jan 23, 2025 · 2 comments
Open

[BUG]Preserve original signature scheme v2, v3, v4 in modded APK #3779

TechnoIndian opened this issue Jan 23, 2025 · 2 comments

Comments

@TechnoIndian
Copy link

Is it possible the original signature scheme (APK Sig Block 42PK) hidden in the APK can be extracted for later use and put it back in APK again? just to make a modded APK with original signature (Modders usually call it an unsigned APK), in order to be able to login with Google for rooted devices with CorePatch module?

This is how it looks like in hex editor, it's at near the bottom, but I don't understand much how it works in hex
image

For example with preserving original signature:

  1. Extract APK Sig Block 42PK as a file using Apktool
  2. Modify files in APK without decompiling. Some tools require APK modification, so just decompiling apk wouldn't work
  3. Put back APK Sig Block 42PK block in APK using Apktool

The problem with unsigned APK:
When making changes in an APK using ordinary zip utility like Winrar, it removes the (APK Sig Block 42PK) completely, breaking Google login on Android 9 and above because Android 9 expect signature scheme v2, v3, v4 (APK Sig Block 42PK). Android 8 and below ignores it and read signature scheme v1 (RSA, SF and MF files in META-INF). Also signature scheme v1 is getting deprecated, some APK doesn't come with v1 anymore

To install unsigned APK:
Install Xposed and CorePatch https://github.com/LSPosed/CorePatch

@iBotPeaches
Copy link
Owner

Maybe technically you could, but I would guess that invalidates the signature if any of those versions do a full-byte verify or at least more than the v1 iteration did.

https://source.android.com/docs/security/features/apksigning

However, I haven't dug into it.

@IgorEisberg
Copy link
Contributor

Fetching the APK Sig Block 42 block is unlikely to be feasible without some low-level APK/JAR ZIP pre-parsing.
https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/fastdeploy/deployagent/src/com/android/fastdeploy/ApkArchive.java#162

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

3 participants