How Dirty Sepolicy detection works
masterDirty Sepolicy detection leverages the App Zygote process to identify Android SELinux access rules that have been modified (made "dirty") by root or hooking solutions.
Because an App Zygote must transition into restricted contexts for isolated services, it inherently possesses the permission to query SELinux access rules via selinux_check_access. This allows the detection to bypass the constraints typically applied to untrusted user applications.
Since App Zygote and the standard Zygote share code, SELinux permissions must be checked correctly; failing to do so causes the process to crash. This makes the detection extremely difficult to bypass in userspace, as the only way to circumvent it is by modifying the kernel itself.