Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How integrity level of a process is determined?

I want to launch a process with high integrity level. The parent process is running as a System service, LocalSystem account. In one Windows 2008 machine, the sub process is of high level while in another 2008 machine, the process is the "medium" level. It looks like CreateProcessAsUser get different level in different machine.

if (!WTSQueryUserToken(sessionID, &hToken)) 
{//The admin user logged in the rdp session of "sessionID".
    return;
}
BOOL fSuccess = CreateProcessAsUser(hToken, NULL, cmdLine, NULL, NULL,
TRUE,CREATE_NEW_CONSOLE,NULL, workDir, &si, &pi);

What bring about the difference? Is there a config or program way to solve it?

like image 280
Henry Avatar asked Dec 18 '25 15:12

Henry


2 Answers

Don't count on the ACL of a user. Sure, it's likely that a LocalSystem account contains a High Integrity Level ACL, but that's not the reliable way to get that IL ACL. The high IL SID is well-known (SID: S-1-16-12288). Put it in a security descriptor, and pass that to CreateProcess.

like image 65
MSalters Avatar answered Dec 21 '25 04:12

MSalters


You should be able to change the integrity level of the retrieved token before launching the new process by calling SetTokenInformation with the TOKEN_INFORMATION_CLASS parameter set to TokenIntegrityLevel.

like image 42
Harry Johnston Avatar answered Dec 21 '25 05:12

Harry Johnston