繁体   English   中英

SELinux拒绝Android读取文件

[英]Android Read file denied by SELinux

我最近尝试在Android中读取文件/system/bin/debuggerd 。我可以安装应用程序或使用adb命令,但是出现此错误:

不幸的是我被SELinux拒绝了

 [105336.331813] type=1400 audit(8732769.717:226): avc: denied { read } for pid=17773 comm="ServiceHandlerB" name="debuggerd" dev="dm-0" ino=279 scontext
 =u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debuggerd_exec:s0 tclass=file permissive=0

我不能按此根目录启动该设备,因此可以读取此文件吗? 这困扰了我整整一天,需要帮助。

如果您无法“ root”该设备,则否。

详情如下所示。 debuggerd_exec文件声明为:

type debuggerd_exec, exec_type, file_type;

这意味着尝试读取文件的进程将需要对debuggerd_exec类型或对exec_type或file_type属性的读取权限。

使用此回复时的AOSP主服务器的当前提示和午餐目标aosp_x86_64-eng,我们可以使用以下sesearch命令查看哪些“源域”实际上可以读取此文件:

$ sesearch -A -t debuggerd_exec -c file -p read $OUT/root/sepolicy 
allow debuggerd debuggerd_exec:file { read open getattr entrypoint execute };
allow debuggerd exec_type:file { read lock ioctl open getattr };
allow init debuggerd_exec:file { read getattr open execute };
allow perfprofd exec_type:file { read lock ioctl open getattr };

如果您注意到源域(允许之后的第一件事),则它们都不是shell或untrusted_app。 在没有root权限的用户构建中,如果没有漏洞利用,则只能在untrusted_app或shell域中运行代码(虽然不完全正确,但细节并不重要)。

此外,即使untrusted_app确实具有访问权限,您也需要注意,即使sesearch显示您具有访问权限,MLS有时也会阻止访问。 Android上的SE Linux使用Type Enforcement(允许规则)和MLS(mls_constrain规则)来提供隔离和沙箱增强。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM