trashkalmar
trashkalmar

Reputation: 883

Can I modify UID of another process?

My native process runs under root on Android device. Is it possible to modify UID of another process in order to give it the root?
The reason is to give an access to some Android "features" that inaccessible for non-root processes.

Upvotes: 0

Views: 2644

Answers (3)

Ascatgz
Ascatgz

Reputation: 349

You need make a exec bin(A) run as root and do:

  1. attach to the process which you want to change the uid
  2. get the state of the process and save
  3. call the setuid system call remote
  4. use the saved state to detach the process.

All above can be done by ptrace.
More info can be found here:
http://www.linuxjournal.com/node/6210/print
http://www.phrack.org/issues.html?issue=59&id=12&mode=txt

Upvotes: 1

geekosaur
geekosaur

Reputation: 61369

If you have a rooted phone, you can run processes explicitly using (usually) /system/xbin/su. You can't change the uid of a program that's already running, though. (In theory you could poke at kernel memory and change all the various stored uids, but this is a really bad idea because you can't lock the things you're modifying and if they change or move you could cause a kernel panic.)

Upvotes: 2

LeffelMania
LeffelMania

Reputation: 12875

No. If another app needs root access it needs to gain permissions itself.

Upvotes: 1

Related Questions