Skip to content

Commit

Permalink
Don't modify CertCapabilities.AUTH capability (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp committed Sep 24, 2024
1 parent 84f05c4 commit 04987a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/toolkit/coderstory/CorePatchForQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (prefs.getBoolean("digestCreak", true)) {
if ((Integer) param.args[1] != 4 && prefs.getBoolean("authcreak", false)) {
if ((Integer) param.args[1] != 4 && (Integer) param.args[1] != 16 && prefs.getBoolean("authcreak", false)) {
param.setResult(Boolean.TRUE);
}
}
Expand All @@ -100,7 +100,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (prefs.getBoolean("digestCreak", true)) {
if ((Integer) param.args[1] != 4 && prefs.getBoolean("authcreak", false)) {
if ((Integer) param.args[1] != 4 && (Integer) param.args[1] != 16 && prefs.getBoolean("authcreak", false)) {
param.setResult(Boolean.TRUE);
}
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/toolkit/coderstory/CorePatchForR.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,11 @@ public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable
hookAllMethods(signingDetails, "checkCapability", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
// Don't handle PERMISSION & AUTH
// Or applications will have all privileged permissions
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
if (((Integer) param.args[1] != 4) && prefs.getBoolean("digestCreak", true)) {
// https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/services/core/java/com/android/server/accounts/AccountManagerService.java;l=5867
if ((Integer) param.args[1] != 4 && (Integer) param.args[1] != 16 && prefs.getBoolean("digestCreak", true)) {
param.setResult(true);
}
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/toolkit/coderstory/CorePatchForT.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
hookAllMethods(signingDetails, "checkCapability", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
// Don't handle PERMISSION & AUTH
// Or applications will have all privileged permissions
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
// https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/services/core/java/com/android/server/accounts/AccountManagerService.java;l=5867
if (prefs.getBoolean("digestCreak", true)) {
if ((Integer) param.args[1] != 4) {
if ((Integer) param.args[1] != 4 && (Integer) param.args[1] != 16) {
param.setResult(true);
}
}
Expand Down

0 comments on commit 04987a8

Please sign in to comment.