Mobile Security · Root Access

Rooting a Pixel with Magisk

This guide shows how to unlock the bootloader, install Magisk, and root a Google Pixel device.

The flow is the usual Pixel/Magisk route: unlock the bootloader, download the factory image that matches the device build, patch the boot image with Magisk, flash it back, and verify su.

Warning: Unlocking the bootloader wipes the phone. Do this only on a device you own and can afford to reset.

Prerequisites

# macOS
brew install android-platform-tools

# Debian/Ubuntu
sudo apt install adb fastboot

# Verify
adb version
fastboot --version

Rooting the Pixel

1

Enable Developer Options

  1. Open Settings → About phone.
  2. Note the current Build number, for example BD3A.251105.010.E1. You need this later for the factory image.
  3. Tap Build number seven times.
  4. Go back to Settings → System → Developer options.
About phone screen showing the Android build number
2

Enable OEM Unlocking and USB Debugging

  1. In Developer options, enable OEM unlocking.
  2. Confirm the warning dialog.
  3. Enable USB debugging.
  4. Connect the phone to your machine and accept the RSA debugging prompt.
adb devices

You should see the device listed as device, not unauthorized.

OEM unlocking enabled in Android Developer Options
3

Unlock the Bootloader

Reboot into the bootloader:

adb reboot bootloader

Check that Fastboot can see the phone:

fastboot devices

Unlock the bootloader:

fastboot flashing unlock
  1. Use the volume keys to select Unlock the bootloader.
  2. Press the power button to confirm.
  3. The phone wipes itself and reboots.
  4. Go through minimal Android setup.
After setup: check the Build number again. If the phone updated during setup, download the factory image for the new build, not the old one.
4

Download the Matching Factory Image

  1. Go to Google Factory Images for Nexus and Pixel Devices.
  2. Find your exact Pixel model.
  3. Download the image that matches the device Build number.
  4. Extract the downloaded archive.
  5. Inside it, extract the nested image-*.zip.

For modern Pixels, the file you normally want is:

init_boot.img

Older Pixels may use boot.img instead. If both exist, follow the current Magisk install guidance for your device/Android version.

unzip image-*.zip
ls -lh init_boot.img boot.img
Google Factory Images page showing Pixel factory image builds
5

Install Magisk and Patch the Image

  1. Download the latest Magisk-v*.apk from the official Magisk GitHub release.
  2. Install it with ADB:
adb install Magisk-v*.apk
  1. Push the stock image to the device:
adb push init_boot.img /sdcard/Download/
  1. Open Magisk.
  2. Tap Install.
  3. Select Select and Patch a File.
  4. Choose /sdcard/Download/init_boot.img.
  5. Tap LET'S GO and wait for Magisk to write magisk_patched_*.img.

Pull the patched image back to your machine:

adb pull /sdcard/Download/magisk_patched*.img
Magisk patching workflow: install, select and patch a file, choose boot image, and output magisk_patched image

Magisk patching flow: Install → Select and Patch a File → choose the stock image → pull the generated magisk_patched_*.img.

6

Flash the Patched Image

Reboot back into the bootloader:

adb reboot bootloader

Flash the patched image:

fastboot flash init_boot magisk_patched_*.img

If your device uses boot.img instead of init_boot.img, flash the matching partition:

fastboot flash boot magisk_patched_*.img

Reboot:

fastboot reboot
7

Verify Root

Once Android boots, open Magisk and confirm that it shows as installed. Then verify from a shell:

adb shell
su
id

Expected result:

uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0
Magisk granting superuser rights to adb shell

After Root: Frida Server

Once root is working, a common next step is to run frida-server from /data/local/tmp.

adb push frida-server /data/local/tmp/frida-server
adb shell
su
chmod +x /data/local/tmp/frida-server
/data/local/tmp/frida-server &

From your machine:

frida-ps -U

If the process list comes back, the device is ready for runtime instrumentation.

Useful Paths

PathUse
/data/local/tmpTemporary binaries, Frida server, PoCs, native tools.
/data/appInstalled APK locations.
/data/data/<package>App-private data. Access normally requires root.
/data/anrANR traces.
/data/tombstonesNative crash dumps.

Capture Logs and Crashes

# Live logs
adb logcat -v time

# Dump current logs
adb logcat -d > logcat.txt

# List tombstones
adb shell su -c "ls -lah /data/tombstones"

# Pull a tombstone
adb shell su -c "cp /data/tombstones/tombstone_00 /sdcard/"
adb pull /sdcard/tombstone_00

Common Fixes

Magisk Shows N/A After Flashing

Bootloop After Flashing

fastboot flash init_boot init_boot.img
fastboot reboot

adb Works but fastboot Does Not


References

Practice on Real Bugs

Take It Into the Labs

Once the Pixel is rooted, use it against real Android targets. Mobile Hacking Lab has hands-on labs for Android application security, runtime instrumentation, and vulnerability research workflows.