簡體   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