0

I was browsing su binary code by Chainsdd when I was browsing it i saw it using setuid(0) setgid(0) to give root permissions

so my question is : Can this method used in my own c library ?

if not then how does the su does it? is it because it is placed in /system partition with some chmod or other operations like that have been perfomed on it?

DevUt
  • 1,280
  • 11
  • 24

1 Answers1

1

su executable file should have suid flag set. This allows it to start with uid and gid of its owner which should both be root. From a normal application on Android it's impossible to call setuid(0) or setgid(0) because they're all started with arbitrary non-root uid and gid.

Ilya Polenov
  • 362
  • 3
  • 10