Saturday, November 11, 2017

rooting - How does SuperSu provide root privilege?


Has a write-up ever been released on exactly how SuperSu works? After searching around for a while I found mostly guides on how to use the app, not the implementation details.


I did, however, find this resource that is mostly directed at explaining how to use the root privileges programmatically, but explained things fairly well. The article gives information about SELinux, but not so much how its enforcement is circumvented.


There appears to be a lot of context switching to allow execution of certain events (from the point of view of those using SuperSu) otherwise denied under SELinux, but how did SuperSu get to the point at which it was able to "legally", as far as SELinux is concerned, patch SELpolicies?


It seems that the objective is to force the init process to spawn a new shell that runs the su daemon, but there does not appear to be any patching of the init process, but from the article linked:




On firmwares that use SELinux, su is generally implemented as a proxy to a daemon started from init



and



You might wonder why - if we're already running as the init context, as the root user ..





tl;dr; How does SuperSu execute in the context of the init process?


Given as:


u:r:init:s0          - Highest init context

u:r:init_shell:s0 - Shell started from init


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...