<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <generator uri="http://jekyllrb.com" version="3.10.0">Jekyll</generator>
  
  
  <link href="https://berkgoksel.com/feed.xml" rel="self" type="application/atom+xml" />
  <link href="https://berkgoksel.com/" rel="alternate" type="text/html" hreflang="en" />
  <updated>2026-01-22T06:29:28+00:00</updated>
  <id>https://berkgoksel.com//</id>

  
    <title type="html">Berk Cem Göksel</title>
  

  
    <subtitle>Software Security Engineer</subtitle>
  

  
    <author>
        <name>Berk Cem Göksel</name>
      
      
    </author>
  

  
  
    <entry>
      
      <title type="html">Setting Up Pixel 8/9 for Android App Reversing and Mobile Security Testing</title>
      
      
      <link href="https://berkgoksel.com/pixel-security-setup" rel="alternate" type="text/html" title="Setting Up Pixel 8/9 for Android App Reversing and Mobile Security Testing" />
      
      <published>2026-01-22T00:00:00+00:00</published>
      <updated>2026-01-22T00:00:00+00:00</updated>
      <id>https://berkgoksel.com/pixel-security-setup</id>
      <content type="html" xml:base="https://berkgoksel.com/pixel-security-setup">&lt;p&gt;This post aims to serve as a guide on how to set a Pixel device up for Android security testing. I’ve tested this on both the Pixel 8 and the Pixel 9. The steps are identical for both.&lt;/p&gt;

&lt;p&gt;This covers flashing stock Pixel OS, rooting with Magisk, and getting Burp Suite working for traffic interception.&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2&gt;Prerequisites&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Pixel 8 (codename: shiba) or Pixel 9 (codename: tokay)&lt;/li&gt;
  &lt;li&gt;Ubuntu 22.04 (or similar Linux distro)&lt;/li&gt;
  &lt;li&gt;USB cable&lt;/li&gt;
  &lt;li&gt;adb and fastboot installed: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo apt install android-tools-adb android-tools-fastboot&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Step 1: Download Factory Image&lt;/h2&gt;

&lt;p&gt;Get the latest factory image from https://developers.google.com/android/images&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Pixel 8: look for &lt;strong&gt;shiba&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Pixel 9: look for &lt;strong&gt;tokay&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Google factory images are named like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shiba-bp4a.251205.006-factory-*.zip&lt;/code&gt;. Don’t confuse with GrapheneOS images which use format &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shiba-install-*.zip&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;Step 2: Enable Developer Options and OEM Unlocking&lt;/h2&gt;

&lt;p&gt;On the phone:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Settings → About phone → tap “Build number” 7 times&lt;/strong&gt; to enable Developer Options&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Settings → System → Developer options → USB debugging → ON&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Settings → System → Developer options → OEM unlocking → ON&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: If OEM unlocking is greyed out, connect to WiFi/mobile data and wait ~24 hours (Google’s anti-theft measure).&lt;/p&gt;

&lt;h2&gt;Step 3: Extract Factory Image&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/Downloads
unzip shiba-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.zip  &lt;span class=&quot;c&quot;&gt;# or tokay-*.zip for Pixel 9&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;shiba-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;         &lt;span class=&quot;c&quot;&gt;# or tokay-* for Pixel 9&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For Pixel 8, extract the inner image zip:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;unzip image-shiba-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For Pixel 9, the images come extracted already.&lt;/p&gt;

&lt;p&gt;Make the flash script executable:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x flash-all.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;Step 4: Unlock Bootloader and Flash&lt;/h2&gt;

&lt;p&gt;Reboot into fastboot mode using the hardware buttons (Power + Volume Down), then:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;fastboot flashing unlock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Confirm on device with volume keys + power. This wipes everything.&lt;/p&gt;

&lt;p&gt;Once back at fastboot:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;fastboot devices
./flash-all.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Do not re-lock the bootloader&lt;/strong&gt; since we need it unlocked for Magisk.&lt;/p&gt;

&lt;h2&gt;Step 5: Post-Flash Setup&lt;/h2&gt;

&lt;p&gt;After the phone boots:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Skip through initial setup&lt;/li&gt;
  &lt;li&gt;Re-enable Developer Options (tap Build number 7 times)&lt;/li&gt;
  &lt;li&gt;Re-enable USB Debugging&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Step 6: Install Magisk&lt;/h2&gt;

&lt;p&gt;Magisk is a systemless root solution that modifies the boot image to provide root access while passing SafetyNet checks. It allows installing modules that modify the system without actually touching the system partition.&lt;/p&gt;

&lt;p&gt;Download the latest Magisk APK from https://github.com/topjohnwu/Magisk/releases&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Magisk-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.apk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Allow notifications when prompted. Useful for superuser prompts.&lt;/p&gt;

&lt;h2&gt;Step 7: Patch init_boot Image&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Pixel 8 on Android 13+ uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init_boot.img&lt;/code&gt; for the ramdisk, not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boot.img&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Push the init_boot image to the phone:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb push init_boot.img /sdcard/Download/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On the phone:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open Magisk app&lt;/li&gt;
  &lt;li&gt;Tap &lt;strong&gt;Install&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Select &lt;strong&gt;Select and Patch a File&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Navigate to Downloads and select &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init_boot.img&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: You can also extract boot.img from a rooted device using dd, but for fresh installs use the init_boot.img from the factory zip. Just make sure it matches your flashed version.&lt;/p&gt;

&lt;h2&gt;Step 8: Flash Patched Image&lt;/h2&gt;

&lt;p&gt;List the patched file:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /sdcard/Download/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pull it:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb pull /sdcard/Download/magisk_patched-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.img &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can test by booting the image directly without flashing:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb reboot bootloader
fastboot boot magisk_patched-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If Magisk shows as installed, flash it permanently:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb reboot bootloader
fastboot flash init_boot magisk_patched-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.img
fastboot reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;Step 9: Verify Root&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb shell
su
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should see a superuser prompt on the phone. Grant access and you’ll have a root shell.&lt;/p&gt;

&lt;h2&gt;Step 10: Configure Magisk&lt;/h2&gt;

&lt;p&gt;In Magisk app, go to &lt;strong&gt;Settings&lt;/strong&gt; and configure:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Zygisk → ON&lt;/strong&gt; (enables code injection into apps, needed for DenyList)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Enable Zygisk DenyList&lt;/strong&gt; (hide root from specific apps)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Enable DNS over HTTPS&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Hide the Magisk app&lt;/strong&gt; → enter a custom name → add shortcut icon when prompted&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Reboot the phone. After reboot, verify Zygisk shows &lt;strong&gt;Yes&lt;/strong&gt; in Magisk home screen.&lt;/p&gt;

&lt;h2&gt;Step 11: Install Burp CA Certificate&lt;/h2&gt;

&lt;p&gt;Android 14+ has read-only system partitions protected by dm-verity. We’ll use a Magisk module to install the CA cert as a system certificate.&lt;/p&gt;

&lt;h3&gt;Export Burp Certificate&lt;/h3&gt;

&lt;p&gt;In Burp Suite: &lt;strong&gt;Proxy → Proxy settings → Import/Export CA Certificate → Export → Certificate in DER format&lt;/strong&gt; → save as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cacert.der&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;Convert and Hash the Certificate&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;openssl x509 &lt;span class=&quot;nt&quot;&gt;-inform&lt;/span&gt; DER &lt;span class=&quot;nt&quot;&gt;-in&lt;/span&gt; cacert.der &lt;span class=&quot;nt&quot;&gt;-out&lt;/span&gt; cacert.pem
&lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;openssl x509 &lt;span class=&quot;nt&quot;&gt;-inform&lt;/span&gt; PEM &lt;span class=&quot;nt&quot;&gt;-subject_hash_old&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-in&lt;/span&gt; cacert.pem | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;cacert.pem &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3&gt;Install MagiskTrustUserCerts Module&lt;/h3&gt;

&lt;p&gt;Download from https://github.com/NVISOsecurity/MagiskTrustUserCerts/releases&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb push MagiskTrustUserCerts.zip /sdcard/Download/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In Magisk app: &lt;strong&gt;Modules → Install from storage → select the zip → reboot&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;Install Certificate as User Cert&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb push &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;.0 /sdcard/Download/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On phone: &lt;strong&gt;Settings → Security &amp;amp; Privacy → More security settings → Encryption &amp;amp; credentials → Install a certificate → CA certificate → Install anyway&lt;/strong&gt; → select your .0 file from Downloads&lt;/p&gt;

&lt;p&gt;Reboot the phone. The MagiskTrustUserCerts module will promote the user certificate to system trust.&lt;/p&gt;

&lt;h2&gt;Step 12: Configure Proxy&lt;/h2&gt;

&lt;h3&gt;Option A: WiFi Proxy&lt;/h3&gt;

&lt;p&gt;On phone: &lt;strong&gt;Settings → Network &amp;amp; internet → Internet → tap your WiFi network → Edit → Advanced options → Proxy → Manual&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set proxy hostname to your Burp machine’s IP and port 8080.&lt;/p&gt;

&lt;h3&gt;Option B: ADB Reverse (for VM setups)&lt;/h3&gt;

&lt;p&gt;If Burp is running in a VM, redirect USB to the VM first:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;QEMU/virt-manager:&lt;/strong&gt; Virtual Machine → Redirect USB device → select Pixel&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;VirtualBox/VMware:&lt;/strong&gt; Configure USB passthrough in VM settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stop adb on host first if running:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb kill-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In the VM:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;adb devices
adb reverse tcp:8080 tcp:8080
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On phone, set proxy to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;127.0.0.1:8080&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Disable any VPN on the phone. VPN overrides proxy settings.&lt;/p&gt;

&lt;h2&gt;Step 13: Test&lt;/h2&gt;

&lt;p&gt;Open browser on phone. Traffic should appear in Burp’s HTTP history.&lt;/p&gt;

&lt;h2&gt;Troubleshooting&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Magisk shows “N/A” after flashing:&lt;/strong&gt; Make sure you’re flashing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init_boot&lt;/code&gt; not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boot&lt;/code&gt; on Pixel 8&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Can’t remount system:&lt;/strong&gt; Android 14+ uses dm-verity, use Magisk modules instead&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;No traffic in Burp:&lt;/strong&gt; Check VPN is disabled, proxy settings are correct, and Burp is bound to all interfaces (0.0.0.0)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Certificate not trusted:&lt;/strong&gt; Ensure MagiskTrustUserCerts module is installed and phone was rebooted&lt;/li&gt;
&lt;/ul&gt;</content>

      
      
      
      
      

      
        <author>
            <name>Berk Cem Göksel</name>
          
          
        </author>
      

      
        <category term="mobile-security" />
      

      

      
        <summary type="html">This post aims to serve as a guide on how to set a Pixel device up for Android security testing. I’ve tested this on both the Pixel 8 and the Pixel 9. The steps are identical for both. This covers flashing stock Pixel OS, rooting with Magisk, and getting Burp Suite working for traffic interception.</summary>
      

      
      
    </entry>
  
  
</feed>
