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

fix(android): set DexFile to read-only in Java.registerClass() #318

Merged
merged 1 commit into from
May 21, 2024

Conversation

pandasauce
Copy link
Contributor

As of Android 14, apps with targetSdk >= 34 are not allowed to have writable permissions on dynamically loaded Dex files.

https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading

Attempting to call Java.registerClass() with such apps results in an exception being thrown:

java.lang.SecurityException: Writable dex file '/data/data/my.ebin.app/frida4706282976511766825.dex' is not allowed.

This removes writable permissions from the temporary DexFile created by Java.registerClass() after writing to it and before it gets loaded.

As of Android 14, apps with targetSdk >= 34 are not allowed to have
writable permissions on dynamically loaded Dex files.

https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading

This removes writable permissions from the temporary DexFile created by
Java.registerClass() after writing to it and before it gets loaded.
@pandasauce pandasauce force-pushed the feature/android-14-ro-dex branch from f6f146b to 42c6836 Compare May 21, 2024 08:52
@oleavr oleavr merged commit 37c1ec5 into frida:main May 21, 2024
11 checks passed
@oleavr
Copy link
Member

oleavr commented May 21, 2024

Nice!! Thanks! 🙌

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

Successfully merging this pull request may close these issues.

2 participants