From what I can tell you can only change a parent processes uid by messing with the kernel's address space, is there a better way? If I can only change the kernel's memory, how should I go about this?
Note: Child process has root, parent does not.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You cannot change another process's UID.
Actually, you could make it drop privileges with a debugger, but you couldn't elevate privileges this way (a debugger can make a program do what it normally wouldn't do, but not what it isn't authorized to do).
Yes, you can do whatever you want by loading some code into the kernel, or by accessing kernel data structures directly through
/dev/kmem. But finding the right address is difficult, and getting the modification right even more so. It isn't a reasonable way to do anything except a security exploit.
If you absolutely must have a non-privileged process and a privileged child process, make the child process listen to requests from the unprivileged process and perform them on its behalf. Be very careful with what the child process is willing to do: remember that you can't really tell whether the requests are coming from the process that you expect or from a fake one. Any security check must be performed inside the privileged process, without trusting data that comes from the unprivileged process.