逆向修改MIUI(X64)内核,反制TracerPID反调试踩坑指南

本文是一篇关于如何在X64架构的MIUI系统上,通过逆向修改内核来规避TracerPID反调试的教程。涉及步骤包括boot.img的提取、解包、内核补丁应用以及重新打包和刷入。主要工具包括adb、Flashify、bootimg-tools、Android Image Kitchen等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0x00、前言

​ 刷CTF时经常能遇到TracerPID反调试,手动nop掉当然是一种好方法,但是每次都得重新打包难免会觉得烦躁。正好在逛吾爱时发现一篇patch内核绕过反调试的文章,果断尝试一番,于是有了这篇X64版本的patch内核踩坑指南。

本次踩坑环境Redmi Note2 ,MIUI 9 8.4.19 |开发版 ,Android 5.0.2 。

0x01、boot.img 提取

方案一、adb

adb shell
cd /dev/block/platform/mtk-msdc.0/by-name

mtk-msdc.0不同的机型是不一样的,但是platform下一般就只有一个文件夹,很容易就能找出。

dd if=/dev/block/mmcblk0p7 of=/data/local/boot.img
exit
adb pull /data/local/boot.img e:\boot.img

在E盘就能找到提取出来的boot.img。

方案二、Flashify

​ 什么?你说你是手残党,觉得手动提取boot.img太麻烦,那我们可以使用Flashify来提取。只需安装Flashify,在BACKUP/RESTORE下就可以一键备份内核。

备份后pull到电脑就可以操作了。

两种方式都必须拥有root权限。

0x02、解包boot.img提取zImage

方案一、bootimg-tools 、mkbootimg

​ 在Linux下可

My original intent was to have this package dependency-free, but as you can see, I did have to include Cygwin. Initially just for mkbootimg since the huaixzk standalone version wouldn't work (it wasn't loading the kernel as binary, thanks trevd); then I discovered that using the GNUWin32 cpio to unpack somehow didn't play nice with repacking the ramdisk in a usable state, so at that point I decided I might as well go Cygwin across the board. As it is, I've included the latest Cygwin-dependent executables and required libraries from their repos and built my own custom Cygwin image and ramdisk utilities built from the latest sources. Originally only for Google Pixel/Nexus/AOSP standard boot.img files, built-in support has now expanded to Android Verified Boot (AVBv1)/ChromeOS/SignBlob signed boot.img files, Barnes & Noble Nook "Green Loader" signed boot.img files, Samsung/Spreadtrum DHTB header signed boot.img files, the Samsung/Marvell PXA1088/1908 board boot.img variant (AOSP-PXA), Loki patched boot.img files, Sony SIN signed/packaged kernel.elf extraction, Sony ELF kernel.elf files, Intel OSIP Android image files, DENX U-Boot uImage files, Rockchip KRNL signed ramdisk image files, MTK headers for zImage/ramdisk, and LG Bump/Samsung SEAndroid footers for boot.img. The main advantage here is you don't need Cygwin shell or PERL scripts. Other guides exist but none of them are universal for target device, compression and/or developed for Windows, Android ARM/x86/MIPS + ARM64/x86_64/MIPS64, and now macOS. With this universality in mind I've automated the whole process with batch/shell scripts. My development work on my many projects comes out of my free time, so if you enjoy this project or anything else I've done on xda, please do hit the donate link from my profile. Thank you for your support!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值