Rooting a Google Pixel 8 for Mobile App Penetration Testing

The Exploit Blog

Penetration Testing Blog

Rooting a Google Pixel 8 for Mobile App Penetration Testing
Published on August 25, 2026
Written by Andrew Trexler

Previously Jason went over the how to jailbreak an iOS device for mobile app testing. There’s more than one mobile platform, and the other big one is Android. “Jailbreaking” an Android device is commonly referred to as “rooting” and is another important skill set for mobile application penetration testing

Some device manufactures make rooting devices difficult, requiring exploits to get the job done. Google, the creator of Android and the Pixel line of devices, makes it easy. Instead of searching for exploits and chaining them together to get root, you can essentially ask nicely, and the device will just give it to you. In this post I’ll go over the process of rooting a Google Pixel 8. 

Note: Going through this process will wipe the all the data from the device.

Step 1: Download the things 

First the SDK Platform Tools for your device (laptop/computer): https://developer.android.com/tools/releases/platform-tools

Then the factory image for your mobile device: https://developers.google.com/android/images

If you’re not using a Pixel device, you may need to get the image from elsewhere.

And the latest version of Magisk from their GitHub: https://github.com/topjohnwu/Magisk

Personally, I just download the newest version. No sense in being on an old version since it’s easy to root. Make sure to get the whole download by using the link. The version should match the one on the phone, so, if you don’t fully update the phone, make sure to match the version.

Pixel Version
Pixel Version

Step 2: Prep the Phone

The first thing you need to do is to enable developer options and turn on OEM unlocking and USB debugging. In the Settings app go to About phone and find the Build number. Now just start tapping the Build number option. 

Build Number in Settings > About phone
Build Number in Settings > About Phone

For those eagle-eyed readers, yes, the build number here is different than the one I downloaded. I did update the phone to the latest version after unlocking the bootloader.

Eventually you’ll see a message about only needing to tap it X number more times.

Message Saying You Need to Tap 4 More Times
Message Saying You Need to Tap 4 More Times

After enough times tapping Build number, you’ll enable Developer Mode.

Developer Mode Enabled
Developer Mode Enabled

Once developer mode is enabled, you’ll have a new Developer options item in the System menu.

Developer Options Menu Item
Developer Options Menu Item

Next, you’ll enable OEM unlocking:

Enabling OEM Unlocking
Enabling OEM Unlocking

And you’ll enable USB debugging:

Enabling USB Debugging
Enabling USB Debugging

Now, if you plug in the phone and run the adb devices command from the platform tools downloaded earlier, you’ll get a prompt on the phone to allow USB debugging.

Confirm to Allow USB Debugging
Confirm to Allow USB Debugging

Make sure to approve the debugging. 

Now you can unlock the bootloader. First enter fastboot mode by running:

./adb reboot bootloader
Enter Fastboot Mode
Enter Fastboot Mode

You should see a screen which looks like this.

Fastboot Mode Result Screen
Fastboot Mode Result Screen

Now run:

 fastboot flashing unlock
Fastboot Flashing Unlock Command
Fastboot Flashing Unlock Command

You should be greeted by a screen saying this is potentially dangerous.

Warning that the Setting is Potentially Dangerous
Warning that the Setting is Potentially Dangerous

It will show you a security waring and require you to confirm your intent. Now unlocking the bootloader could expose your phone to additional vulnerabilities which could leak your data if the phone is stolen. But since we’re rooting the device to make mobile app testing more powerful we need to take this step. There are many things you can do with a rooted device. And data is still encrypted, but make sure you understand potential risks, especially if it’s going to be your daily driver and not just a testing device like mine is here.

If the plan is to root and unlock, continue following along as we go through the messages and select the option to unlock the bootloader. After you unlock the bootloader, you will return to the Fastboot menu where it should say the device is unlocked.

Device Is Unlocked
Device Is Unlocked

You can now reboot the device. You’ll find that the device has been reset, so you’ll need to setup the device again and re-enable developer mode and USB debugging.

Rooting the Device

After getting the device ready again, you’ll start by installing Magisk. You should have downloaded the APK already, as noted earlier.

./adb install ../Magisk-v30.7.apk
Installing Magisk
Installing Magisk

Next, you can unzip the device image you downloaded earlier. Locate the init_boot.img file and upload it to the device. There are several ways of doing this, but I prefer adb.

./adb push ../shiba-bp4a.260205.001/init_boot.img /sdcard/Download
Uploading the init_boot.img File to the Device Using adb
Uploading the init_boot.img File to the Device Using adb

Now open the Magisk app on the device and select install.

Selecting Install in the Magisk Menu
Selecting Install in the Magisk Menu

Choose the Select and patch a file option.

Choosing the Select and Patch a File Option
Choosing the Select and Patch a File Option

That should bring you to a file browser. Find the init_boot.img file you uploaded earlier and select it. You should be brought back to the same screen as before. Now click Let’s Go.

It will bring you to a new screen. Eventually it will output the filepath where it wrote the file and show a message All done!

Message When Complete
Message When Complete

Download the modified file back to the computer. Again, there are several ways of accomplishing this.

Now put the device back into Fastboot mode as before and flash the patched image.

./fastboot flash init_boot [Magisk File]
Flashing the Patched Image
Flashing the Patched Image

After it finishes flashing, you can reboot the device.

Rebooting the Device
Rebooting the Device

After the phone boots up, open the Magisk app. It should now say that Magisk is installed.

Magisk Is Installed
Magisk Is Installed

This means the phone is rooted, but let’s confirm with adb. First let’s open a shell with adb shell.

Then switch to the root user with su. You should get a confirmation pop-up message on the phone

./adb shell
su
Opening a Shell with ADB
Opening a Shell with ADB
Confirmation Pop-Up on the Phone
Confirmation Pop-Up on the Phone

Go ahead and grant the request. You should now have a root shell. Use the id command to confirm.

Confirming the Root Shell with the ID Command
Confirming the Root Shell with the ID Command

And That’s It

The process with Pixel devices should be similar with different models, potentially differing in which file you patch. Some require you to patch boot.img and others, like this one, init_boot.img.

Whether you’re a penetration tester or a pentest customer looking to understand how mobile application pentests work, I hope this tutorial has been useful. Pentesting mobile applications  is an important part of the DevSecOps process to protect mobile app users from security risks. If you enjoyed this walk-through, please check out others in our How To series.

Andrew Trexler

Andrew Trexler

Andrew graduated from the University of Pittsburgh with a degree in Information Science where he focused on networking and security. He continued his education by obtaining the Offensive Security Certified Professional (OSCP) and the eLearnSecurity Junior Penetration Tester (eJPT) certifications. When not participating in capture the flag events, Andrew works as a pyrotechnic operator setting up and shooting firework shows in the Pittsburgh area.
Search The Exploit Blog

About The Exploit

The Exploit is written by Raxis penetration testers. Every post is a technical writeup from someone who runs engagements for a living, with code, command output, and the reasoning behind each step. Topics include exploit research, vulnerability disclosure, tool development, and the offensive techniques showing up in current client work.

Raxis Discovered Vulnerabilities

View the CVEs and bugs that Raxis pentesters have uncovered and submitted.

Work With the Pentesters Who Wrote This Blog

The engineers behind these posts run real engagements every week. Put them on your network, web apps, APIs, or cloud and see what an attacker would find first.

Join Our Newsletter

Name(Required)
Newsletter(Required)
Do you wish to join our newsletter? We send out emails once a month that cover the latest in cybersecurity news. We do not sell your information to other parties.