Arbitrary Code Execution in Unity Runtime(CVE-2025-59489)
The Unity Runtime on Android parses an intent extra named 'unity' as command line arguments, allowing any installed app to pass the -xrsdk-pre-init-library argument and load an arbitrary shared library. This lets a malicious app execute code with the Unity application's permissions, and in specific cases remote exploitation via a browser is possible.
flatt.tech
Published on flatt.tech
Hello, I’m RyotaK (@ryotkak ), a security engineer at GMO Flatt Security Inc.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the UnityPlayerActivity exported intent handler accepts the 'unity' extra and passes it as command line arguments without validating or restricting the -xrsdk-pre-init-library option, which is then used in dlopen to load an arbitrary library.
Impact
A malicious app installed on the same device could execute arbitrary code with the Unity application's permissions; remote exploitation via a browser is possible only if the app exports the activity with the BROWSABLE category and writes attacker-controlled files to private storage, and SELinux restrictions block loading libraries from the downloads directory.
What the attacker needed
Malicious app installed on same device; Unity app built with Unity 2017.1 or later; for remote: exported activity with BROWSABLE; for remote: app writes attacker files to private storage
The fix
Unity released patches for Unity 2019.1 and later, as well as a Unity Binary Patch tool, and developers should update, recompile, and republish their games.
How it was found
- A malicious app extracts a native library with android:extractNativeLibs set to true.
- The malicious app launches the Unity application with the -xrsdk-pre-init-library argument pointing to the malicious library.
- The Unity application loads and executes the malicious code with its own permissions.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Unity is a game engine used to build many Android games. On Android, apps can send messages called intents to other apps. Unity games listen for a special intent that lets you pass extra settings, but any app can send that intent. The settings are treated like command line options, and one option tells Unity to load a library file from a path you choose. A malicious app can use this to make the game load the attacker's code and run it with the game's permissions.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.