Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impersonate SYSTEM (or equivalent) from Administrator Account

This question is a follow up and continuation of this question about a Privilege problem I'm dealing with currently.



Problem Summary:
I'm running a program under a Domain Administrator account that does not have Debug programs (SeDebugPrivilege) privilege, but I need it on the local machine.


Klugey Solution:
The program can install itself as a service on the local machine, and start the service. Said service now runs under the SYSTEM account, which enables us to use our SeTCBPrivilege privilege to create a new access token which does have SeDebugPrivilege. We can then use the newly created token to re-launch the initial program with the elevated rights.


I personally do not like this solution. I feel it should be possible to acquire the necessary privileges as an Administrator without having to make system modifications such as installing a service (even if it is only temporary).

I am hoping that there is a solution that minimizes system modifications and can preferably be done on the fly (ie: Not require restarting itself). I have unsuccessfully tried to LogonUser as SYSTEM and tried to OpenProcessToken on a known SYSTEM process (such as csrss.exe) (which fails, because you cannot OpenProcess with PROCESS_QUERY_INFORMATION to get a handle to the process without the privileges I'm trying to acquire).

I'm just at my wit's end trying to come up with an alternative solution to this problem. I was hoping there was an easy way to grab a privileged token on the host machine and impersonate it for this program, but I haven't found a way.



If anyone knows of a way around this, or even has suggestions on things that might work, please let me know. I really appreciate the help, thanks!

like image 779
KevenK Avatar asked Jun 07 '10 18:06

KevenK


People also ask

What is impersonate account?

User impersonation allows you to temporarily sign in as a different user in your network. Users with full impersonation permissions can impersonate all other users in their network and take any action, regardless of the impersonating user's own permission level.

What is impersonation in authentication?

Impersonation is the process of assigning a user account to an unknown user.

Where would you go to see if an admin impersonate another user?

When impersonating another user, the admin user can see and do exactly what the impersonated user can see and do. Impersonate a user from the main ServiceNow browser window (not Studio). Open the User menu by clicking your user name in the ServiceNow banner. Select the Impersonate User menu item.

What is the Selected to impersonate another user?

To impersonate another user, the impersonator selects the Impersonate icon on the far right of the Tab Bar and selects the user from the Impersonate drop-down list. To stop impersonating a user, the impersonator clicks the Impersonate icon and selects Stop Impersonate from the Impersonate drop-down list.


1 Answers

By design, no process is allowed to achieve NT AUTHORITY\SYSTEM rights, unless it is started by another process with NT AUTHORITY\SYSTEM rights. The service is a workaround because the Service Control Manager itself is started by the Kernel at system start.

Unfortunately, the operating system is designed to prevent exactly what you're trying to do. If you want to be able to remove your service afterwards, simply grant the user in question SeDebugPrivilege for the local machine and then have the service uninstall itself.

Better yet, have the program whose memory is to be modified change DACLs to allow your administrator access to it's memory without SeDebugPrivilege. Then you don't need to take privilege at all.

EDIT2: And even better yet, just use shared memory in the first place. That's what it's for.

like image 55
Billy ONeal Avatar answered Nov 12 '22 16:11

Billy ONeal