Xiaoxia[PG]

Linux下zergRush给Android2.3.6(ME865)获取root权限

Android、Linux14 条评论

昨天跟金华同学在大学城寻找新片景点,在路上,遇到一棵骨骼精奇的植物。掏出手机拍下以记之!

2012-02-12_15-25-09_273

按照我的个人习惯,使用Linux系统喜欢用root,主要是方便干活。所以,拿到了新手机,不用root权限,怎么去深入探究它系统的工作原理呢?

下面马上动手,使用国外大牛利用系统bug写的获取root权限的程序。

1. 下载工具

su,Superuser.apk,提权程序zerg

各程序的用途:

su:切换用户运行进程。
Superuser.apk:在Android上管理具有root权限的应用程序。
zerg:使用系统漏洞获取root权限,有兴趣的朋友可以研究github上的源代码 https://github.com/revolutionary/zergRush/blob/master/zergRush.c。

我尝试使用新版的zergRush,但是失败了 🙁 为了不误导后人,我这里只给出成功的方案。

2. 设置调试模式

打开在手机上的“设置->应用程序->开发->USB调试”,同时开启“设置->应用程序->未知源”。使用USB接入电脑,USB连接模式选择“仅充电”。

3. 复制文件

在终端里切换到工具目录下。首先,检查设备是否已连接。

root@xiaoxia-pc:/media/Data/moto/Exploit# adb devices
List of devices attached
0149BD1711001013        device

从PC上复制所需的3个文件到设备上,例如/data/local目录下。

root@xiaoxia-pc:/media/Data/moto/Exploit# ls
su  Superuser.apk  zerg
root@xiaoxia-pc:/media/Data/moto/Exploit# adb push zerg /data/local
505 KB/s (22776 bytes in 0.043s)
root@xiaoxia-pc:/media/Data/moto/Exploit# adb push su /data/local
561 KB/s (22228 bytes in 0.038s)
root@xiaoxia-pc:/media/Data/moto/Exploit# adb push Superuser.apk /data/local
3339 KB/s (754980 bytes in 0.220s)

4. 获取root权限

连接远程shell,设置文件为可执行。

root@xiaoxia-pc:/media/Data/moto/Exploit# adb shell
shell@edison:/$ cd /data/local
shell@edison:/data/local$ chmod 777 zerg

运行zerg,围观攻击结果。

shell@edison:/data/local$ ./zerg
[**] Zerg rush - Android 2.2/2.3 local root
[**] (C) 2011 Revolutionary. All rights reserved.
[**] Parts of code from Gingerbreak, (C) 2010-2011 The Android Exploid Crew.
[+] Found a GingerBread ! 0x00016118
[*] Scooting ...
[*] Sending 149 zerglings ...
[*] Sending 189 zerglings ...
[+] Zerglings found a way to enter ! 0x18
[*] Sending 189 zerglings ...
[*] Trying a new path ...
[*] Sending 189 zerglings ...
[*] Trying a new path ...
[*] Sending 189 zerglings ...
[*] Trying a new path ...
[*] Sending 189 zerglings ...
[+] Zerglings caused crash (good news): 0x40122c5c 0x0074
[*] Researching Metabolic Boost ...
[+] Speedlings on the go ! 0xafd25ac9 0xafd397f7
[*] Sending 185 zerglings ...
[+] Rush did it ! It's a GG, man !
[+] Killing ADB and restarting as root... enjoy!
root@xiaoxia-pc:/media/Data/moto/Exploit#

成功获取root权限并且切断了adb连接。重新运行adb shell,就应该变为root了。

root@xiaoxia-pc:/media/Data/moto/Exploit# adb shell
root@edison:/#

提示符从$变为#。(如果没有#,提权失败。)

5. 安装su,Superuser.apk

把文件系统挂载为可写入。

root@edison:/# mount -o rw,remount /dev/null /system

复制su,Superuser到安装目录。不知道为何,我这里复制文件不可以用cp,只能用cat?

root@edison:/# cat /data/local/su > /system/bin/su
root@edison:/# cat /data/local/Superuser.apk > /system/app/Superuser.apk
root@edison:/# chmod 4755 /system/bin/su
root@edison:/# chmod 4755 /system/app/Superuser.apk

重启手机。话说,用reboot命令重启很快,屏幕一下子就黑了。

root@edison:/# reboot

6. 效果

重启手机后,可以使用adb连接shell,然后测试su命令是否可以使用!

root@xiaoxia-pc:/media/Data/moto/Exploit# adb shell
shell@edison:/$ su

Superuser.apk提示

device-2012-02-13-020305

允许之后,shell得到root权限。可以做任何事情了!

root@edison:/#

此次root是为了下次我在Android2.3建立VPN(类似Android4.0的VpnService.Builder实现的功能)提供环境基础。

参考资料:

http://forum.xda-developers.com/showthread.php?t=1327741

#adb#android#me865#root#zerg

14 条评论

  1. @Xiaoxia,你用Android呀,我以为你会用Meego的

    1. 你觉得我为何会选择Meego呢?
      现在用Meego的手机多不?N9?

      1. meego看起来正统些,ui也不比android的ui差,java的界面感觉很慢呀。好像不多,目前能买的也就N9了

  2. ME865 ROOT这么麻烦啊?还是HTC好…
    说起来,N9的MeeGo才是纯正的Linux啊,安装QQ都可以用apt-get install QQ命令的,我好喜欢…

  3. 最近更新很频繁啊。看来新手机的兴趣还处于巅峰。

    1. 等写好了手机免费上网的应用程序,我就退出江湖了 😀

      1. 这个想法好啊,省的WINDOWS不支持,这样就不用移植来移植去了。嗯嗯,期待新作。

      2. 如果在手机上能实现免费上网,那我的Android2.3平板也应该可以喽。。。

  4. 刚刚在昨天放弃了买android板板的决定

    1. 嗯,打算买啥?推荐一下。
      我之前有打算买一个这个 http://item.taobao.com/item.htm?id=12953665117 来玩玩的。

        1. 刚买完手机,现在还没经济条件看别的东西~

  5. 这骨骼惊奇的植物好像是一年藤

    1. 路边的野草你不要采~

发表评论

评论会经过自动审核,链接请勿超过 3 个。