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

ABI override with IActivityManager.startInstrumentation no longer works on Android 13 #1522

Open
cinit opened this issue Oct 17, 2023 · 3 comments

Comments

@cinit
Copy link

cinit commented Oct 17, 2023

ABI override with IActivityManager.startInstrumentation(..., abiOverride = ...) will no longer work since Android 13 because of the following check in ActivityManagerService.java.

            if (!Build.IS_DEBUGGABLE && callingUid != ROOT_UID && callingUid != SHELL_UID
                    && callingUid != SYSTEM_UID && !hasActiveInstrumentationLocked(callingPid)) {
                // If it's not debug build and not called from root/shell/system uid, reject it.
                final String msg = "Permission Denial: instrumentation test "
                        + className + " from pid=" + callingPid + ", uid=" + callingUid
                        + ", pkgName=" + mInternal.getPackageNameByPid(callingPid)
                        + " not allowed because it's not started from SHELL";
                Slog.wtfQuiet(TAG, msg);
                reportStartInstrumentationFailureLocked(watcher, className, msg);
                throw new SecurityException(msg);
            }

Attempts to call startInstrumentation will fail with the following exception.

java.lang.SecurityException: Permission Denial: instrumentation test ComponentInfo{net.zhuoweizhang.mcpelauncher/net.zhuoweizhang.mcpelauncher.RelaunchInstrumentation} from pid=15401, uid=10591, pkgName=net.zhuoweizhang.mcpelauncher not allowed because it's not started from SHELL
	at android.os.Parcel.createExceptionOrNull(Parcel.java:3040)
	at android.os.Parcel.createException(Parcel.java:3024)
	at android.os.Parcel.readException(Parcel.java:3007)
	at android.os.Parcel.readException(Parcel.java:2949)
	at android.app.IActivityManager$Stub$Proxy.startInstrumentation(IActivityManager.java:5500)

This disables any attempt to run Instrumentation without a shell/system/root uid on a production device.

Any possible solutions/alternative for that?

@nikolayKeniston
Copy link

the blocklauncher does not work not only on android 13, but on all its versions above the eighth for a variety of different problems, and obviously no one is going to fix it. if you need scripting functionality so much, then it's easier to write your own launcher from scratch using a relay system and android capabilities.

@nikolayKeniston
Copy link

Blocklauncher is very outdated and it is not possible to use it now

@cinit
Copy link
Author

cinit commented Oct 18, 2023

Frankly, I'm not going to run Minecraft or load scripts. I'm just looking for an approach about dynamically switching ABI in my own app, and that is not much related with Minecraft. The only implementation I have ever seen is MCPELauncher and sadly the method it uses doesn't work on Android 13. I hadn't ever seen any other applications being able to archive this.

For your information, this is a bug fix for CVE-2023-21089. This bug fix may be backported to Android 11 and 12 so that older versions may be also affected.

@cinit cinit changed the title ABI override no longer works on Android 13 ABI override with IActivityManager.startInstrumentation no longer works on Android 13 Jul 31, 2024
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

2 participants