如何使用ADB将文件推到根( /)目录中,以便我可以安装`su`二进制

发布于 2025-01-20 12:17:47 字数 444 浏览 4 评论 0原文

我刚刚将 adb shell 插入设备上的根目录,并且想要安装 su 二进制文件。请注意,我使用的是 macOS,并且想要手动执行此操作。

当我尝试将 su 二进制文件推送到根目录(不在 SDCard 上)时,出现此错误:

$ cp /sdcard/su /system/bin
cp: /system/su: Read-only file system

How do I Push the su binary to /system /bin

(我的平板电脑是 Acer Iconia Tab 10 A3-A30)

基本上,我只想对其进行 root,但我找不到有关解锁引导加载程序或与此平板电脑配合使用的任何应用程序的任何详细信息。

I've just adb shell'd into my root directory on my device and I want to install the su binary. Just to note, I'm on macOS and want to do this manually.

When I try to push the su binary to the root directory (not on SDCard), I get this error:

$ cp /sdcard/su /system/bin
cp: /system/su: Read-only file system

How do I push the su binary to /system/bin?

(My tablet is an Acer Iconia Tab 10 A3-A30)

Basically, I just want to root it but I can't find any details on unlocking the bootloader or any apps that work with this tablet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可可 2025-01-27 12:17:47

简短版本:不幸的是,仅按“su”的天真方法是行不通的。您可以验证这一点(除非您的“su”二进制文件正在使用漏洞),甚至“adb push su /data/local/tmp/”然后从那里执行它也不起作用。

详细版本:

Android 5.0带来了两个根本性的变化:第一个是根和其他文件系统的密封,使它们不仅以只读方式挂载,而且还通过DM-verity进行验证,这样如果它们挂载了则可以读取/write,更改将不被接受。

第二个是引入 SE-Linux(以及另一项更改,弃用 setuid 二进制文件),作为所谓的“强制访问控制”的额外级别。这(与 chmod/chown/etc“自由访问控制”相反)意味着存在一个总体的“安全策略”,一旦安装,就不能以任何方式覆盖。

因此,有两种方法可以获取您的设备的 root 权限:

A) 上传“su”样式的二进制文件,该二进制文件会以某种方式找到绕过 SE-Linux 的方法并授予您 root 权限。这就需要利用安全漏洞来实现内核内存访问和 shell 凭据的“修补”。这些漏洞非常罕见,可以打折,因为这些漏洞很快就会被修补(MediaTek 设备除外,mtk-su 对此效果很好)。

B)以“引导加载程序解锁”模式(您确实提到过)引导设备,其中预先修补的内核,具有修改的安全策略和带有预制 su 的根文件系统(技术上,Ramdisk)并且启用的守护进程可用于根据需要为您提供超级用户权限。这是由 ChainFire 的“supersu”开始的,现在是 Magisk 事实上的方法。

因此,你的问题基本上是一个死胡同。如果这是一个开发版本,您可以修改根文件系统并安装su的“旧”形式(如“getprop ro.debuggable”或“getprop ro.build.fingerprint”所示)但是,这不适用于发布(零售)设备。

您最好的选择是

  • A) 获取相关平板电脑的 OTA 或工厂映像。
  • B) 从中获取 boot.img
  • C) 使用 magisk 修补 boot.img(在设备上,
    通过/sdcard/Download)或imjtool
  • D)启用引导加载程序解锁
    (不保证可用)通过开发者选项
  • E) put
    设备处于快速启动模式(“adb restart bootloader”应该可以)
  • F)使用
    当设备连接时,主机上的“fastboot flashing解锁”。
    批准解锁
  • G) 使用“fastboot boot”或(当您
    确定它有效)“fastboot flash boot”
  • H)希望最好

Short version: Unfortunately, the naive approach of just pushing "su" won't work. You can verify that (unless your "su" binary is using an exploit), even "adb push su /data/local/tmp/" and then executing it from there won't work.

Detailed version:

Android 5.0 brought two fundamental changes: The first was the sealing of the root and other filesystems, so that they are not only mounted read-only, but they are also verified by DM-verity, such that if they ARE mounted read/write, changes will not be accepted.

The second was the introduction of SE-Linux (along with another change, deprecating setuid binaries), as an extra level of what is known as "Mandatory Access Control". This (as opposed to chmod/chown/etc "Discretionary Access Control") means that there is an overarching "security policy", which - once installed - cannot be overridden in any way.

There are thus two ways to root your device:

A) upload a "su" style binary which would somehow find a way around SE-Linux and grant you root privileges. This necessitates exploitation of a security vulnerability to achieve kernel memory access and "patching" of the shell credentials. These are rare enough to be discounted since these vulnerabilities are quickly patched (exceptions being MediaTek devices, for which mtk-su works well).

B) boot the device in a "boot loader unlocked" mode (which you've indeed referred to) in which a pre-patched kernel, with a modified security policy and a root filesystem (technically ,Ramdisk) with a pre-made su and an enabled daemon can be used to give you super user privileges on demand. This was started by ChainFire's 'supersu', and is now the de facto method of Magisk.

Therefore, your question is very much at a dead end. You could modify the root filesystem and install the "older" form of su if this were a development build (as would be shown by "getprop ro.debuggable" or "getprop ro.build.fingerprint" with "eng" it. But, this will not work on a release (retail) device.

Your best bet is to

  • A) get the OTA or factory image of your tablet in question.
  • B) get the boot.img from it
  • C) Patch the boot.img using magisk (on device,
    through /sdcard/Download) or imjtool
  • D) Enable boot loader unlocking
    (not guaranteed to be available) through Developer Options
  • E) put
    device in fastboot mode ("adb reboot bootloader" should do)
  • F) Use
    "fastboot flashing unlock" on host when device is thus connected.
    Approve unlocking
  • G) use "fastboot boot " or (when you
    are certain it works) "fastboot flash boot "
  • H) Hope for the best
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文