Root the MSI App Player (BlueStacks 5, Android 9 "Pie64") by writing a setuid su
into the guest /system offline. No Magisk daemon and no boot hook. It persists
across reboots because it lives in /system.
Works on plain BlueStacks 5 too (MSI App Player is a rebranded BlueStacks 5).
Tested on MSI App Player = BlueStacks 5.11.100.6311, instance Pie64, Android 9
(API 28), x86_64, SELinux disabled. Other 5.x builds and instances (Rvc64,
Tiramisu64) should work when SELinux is Disabled or Permissive; adjust the
NDK API level for the Android version.
On BlueStacks 5.11 the built-in root path is dead:
bst.feature.rootingresets to0on every boot, soenable_root_accessalone gives nosu.adb rootis a no-op (patched out).- Kitsune Mask / Magisk Delta only offers "Select and Patch a File", never "Direct Install", because there is no root to bootstrap from.
The guest runs with SELinux disabled and mounts /system with suid, so a
setuid-root binary in /system is enough. /system is read-only at runtime, so
the write is done offline against the Root.vhd file.
- Windows 10/11 with WSL2 (a distro that can mount ext4, e.g. Ubuntu).
- Android NDK to build
su, or useprebuilt/su(x86_64, API 28). - BlueStacks 5 / MSI App Player. Default instance is
Pie64.
x86_64-linux-android28-clang -O2 su.c -o su
su.c elevates to uid/gid 0 and execs the request. It handles su,
su -c "cmd", su <uid> -c "cmd", and su <uid> prog args.
To verify the shipped binary against source, check it with SHA256SUMS:
sha256sum -c SHA256SUMS, or in PowerShell
Get-FileHash prebuilt/su -Algorithm SHA256.
- Enable ADB once: set
bst.enable_adb_access="1"inC:\ProgramData\BlueStacks_msi5\bluestacks.conf, with the app closed. - Run the injector:
powershell -ExecutionPolicy Bypass -File reroot.ps1
reroot.ps1 stops the instance, attaches Root.vhd to WSL2
(wsl --mount --vhd --bare), runs reinject.sh, detaches, and boots. Pass
-Instance Rvc64 (Android 11) or -Instance Tiramisu64 (Android 13) for other
images.
reinject.sh mounts the ext4 partition that contains android/system, copies
su to /system/xbin/su and /system/bin/su as root:root mode 6755, then
unmounts.
The instance ADB port is dynamic per boot. Read it from the config:
Select-String status.adb_port "C:\ProgramData\BlueStacks_msi5\bluestacks.conf"
adb connect 127.0.0.1:<port>
adb shell su -c id
Expected: uid=0(root) gid=0(root) groups=0(root). Port 5555 does not work; use
status.adb_port.
powershell -ExecutionPolicy Bypass -File unroot.ps1
Deletes both su copies from /system via the same offline mount, then boots.
Once su works you have uid 0 in the guest. Practical uses:
- adb automation as root:
adb shell su -c '...'for scripts, input events, screencap, packet capture. - Read and edit app private data under
/data/datato debug or reverse engineer your own apps. - App security testing: run frida-server, hook with Frida or objection, dump memory, bypass SSL pinning.
- HTTPS interception: drop a Burp or mitmproxy CA into the system trust store
(
/system/etc/security/cacerts) so apps trust it. System store writes use the same offline WSL step as the su inject, since runtime/systemis read-only. - Debloat, add system apps, swap fonts, edit
build.propand system props (offline). - System-wide adblock or firewall through the hosts file and
iptables. - Packet capture with
tcpdump, which already ships in the image. - Check how your own app behaves on a rooted device.
Needs full Magisk, not plain su:
- Zygisk modules and LSPosed.
- DenyList to hide root from apps that block rooted devices.
- Managed per-app su prompts.
Full Magisk (system mode) is available on top of the bootstrap su: persistent
magiskd, managed su, modules, and Zygisk + DenyList via ReZygisk. See
magisk/MAGISK.md.
su.csetuid su source.prebuilt/sucompiled x86_64 binary (NDK, API 28).reinject.shWSL2 mount and copy.reroot.ps1full stop/inject/boot cycle.uninstall.sh/unroot.ps1remove the injected su.SHA256SUMSchecksum forprebuilt/su.AgentSkill.mdstep-by-step runbook, including the enforcing-SELinux and other emulator instances (Rvc64, Tiramisu64) branches.magisk/full Magisk system-mode install (daemon, su, modules, Zygisk + DenyList via ReZygisk). Seemagisk/MAGISK.md.NOTES.mdfield notes: every problem hit during this build and its fix.
- This is a blanket
suwith no prompt. That is fine for a throwaway dev VM. Do not ship it to a real device. - After a factory reset the
Root.vhdis recreated, so rerunreroot.ps1. /datastays writable at runtime, so you can still set up a full Magisk on top if you want managed grants, Zygisk, or DenyList. That needs a boot hook and is out of scope here.
MIT. See LICENSE.