Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elevate privileges of running process

Is there a way for one process (such as an executable or bash script) to elevate the privileges of another, running, process? e.g. If I have a program running as normal user user, is it possible for another process, running as root to elevate the privileges of the first as if it had been run as root originally?

I have seen exploits modify the credential struct of a process to perform this, but I'm not sure if there's a way to do this more legitimately.

Looking further into this, it appears that there is no way to do this without installing a kernel module; essentially a rootkit. The kind of thing I want is demonstrated here.

like image 382
clubby789 Avatar asked Feb 05 '20 11:02

clubby789


People also ask

What are the ways to provide run with elevated access?

If you want to make a program always run with admin privileges, right-click on the program's executable file, select Properties. Here, select the Run this program as an administrator box. Click Apply > OK.

What is process privilege?

With the PROCESS privilege, a user has access to information about all threads, even those belonging to other users. Without the PROCESS privilege, nonanonymous users have access to information about their own threads but not threads for other users, and anonymous users have no access to thread information.


2 Answers

No, these properties of a process cannot be altered after it starts.

like image 138
tripleee Avatar answered Sep 22 '22 12:09

tripleee


No. The only way to elevate a process’s privileges is by execing a setuid binary (such as /usr/bin/sudo); you can’t do it to an already running process.

You can, however, ask sudo to copy a file to a temporary path, launch your editor with your own privileges on the temporary path, and then copy the result back in place as root:

sudo -e filename
like image 21
Zig Razor Avatar answered Sep 22 '22 12:09

Zig Razor