首页
社区
课程
招聘
[原创]时代重大变化,用户态root被封杀
发表于: 8小时前 182

[原创]时代重大变化,用户态root被封杀

8小时前
182

检测原理

该检测无法在用户空间被绕过。
App Zygote是一个特定于应用程序的Zygote进程,它会预加载资源并为应用程序创建独立的子进程。 为了正常运行,App Zygote 必须转换到隔离服务的受限上下文中。因此,它必须拥有查询和检查 SELinux 访问规则的权限。 这种固有的设计使其成为查询 SELinux 的完美候选者,而不会受到普通不受信任应用程序限制的约束。

//安卓源码如下: app_zygote.te
# Get seapp_contexts
allow app_zygote seapp_contexts_file:file r_file_perms;
# Check validity of SELinux context before use.
selinux_check_context(app_zygote)
# Check SELinux permissions.
selinux_check_access(app_zygote)

检测示例

var sb = new StringBuilder();
if (SELinux.checkSELinuxAccess("u:r:system_server:s0", "u:r:system_server:s0", "process", "execmem")) {
    sb.append("system_server can execmem; ");
}
if (SELinux.checkSELinuxAccess("u:r:untrusted_app:s0", "u:r:magisk:s0", "binder", "call")) {
    sb.append("found Magisk; ");
}
if (SELinux.checkSELinuxAccess("u:r:untrusted_app:s0", "u:r:ksu:s0", "binder", "call")) {
    sb.append("found KernelSU; ");
}
if (SELinux.checkSELinuxAccess("u:r:untrusted_app:s0", "u:object_r:lsposed_file:s0", "file", "read")) {
    sb.append("found LSPosed; ");
}

传播安全知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 2
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回