Re: CreateProcessAsUser "loses" privileges, why?
- From: Stefan Kuhr <kustt110@xxxxxx>
- Date: Fri, 22 Apr 2005 11:17:17 +0200
Hi Pavel,
Pavel Lebedinsky wrote:
>
> What OS is this?
I tested on XP SP2, W2K SP4 and NT4 SP6. All these OS versions exhibit
the same behaviour. It seems like the process started via CPAU has only
those privileges that are enabled by default
(SE_PRIVILEGE_ENABLED_BY_DEFAULT) in the client token. All other
privileges are non-existent in the token of this process. I also tried
(on XP only) to enable the SE_DEBUG_NAME privilege in the client token
before connecting to the named pipe, but this didn't change anything.
> [..]] Do you also see missing privileges if you start a
> process with runas?
No, runas works lika charm.
My current solution to the problem is to pass as part of the named pipe
conversation the PID of the client process to the server. At the server
end, I then open the process handle and the access token of the client
process and also impersonate it. I then compare the access token I
opened and the impersonation token (see if their user and group SID are
the same) and if both match, start the process with CPAU, but not with
the (duplicated primary) token from impersonation as before, but instead
with the access token that I got from opening the process token via PID.
Comparing the token and doing the impersonation anyway seems overkill,
but this way I can prevent some malicious user from spoofing the server
by sending an arbitrary PID of a highly privileged process across the
named pipe which it would then blindly open and create a process in that
context.
Am I doing sth wrong or is there really no solution that is a bit more
elegant? Can anyone confirm that the token of a process created by CPAU
is always missing the privileges if it is created from a duplicated
impersonation token?
TIA,
--
Stefan
.
- Follow-Ups:
- Re: CreateProcessAsUser "loses" privileges, why?
- From: Ivan Brugiolo [MSFT]
- Re: CreateProcessAsUser "loses" privileges, why?
- References:
- CreateProcessAsUser "loses" privileges, why?
- From: Stefan Kuhr
- Re: CreateProcessAsUser "loses" privileges, why?
- From: Pavel Lebedinsky
- CreateProcessAsUser "loses" privileges, why?
- Prev by Date: Re: Creating a custom LDT under WinXP
- Next by Date: Re: Creating a custom LDT under WinXP
- Previous by thread: Re: CreateProcessAsUser "loses" privileges, why?
- Next by thread: Re: CreateProcessAsUser "loses" privileges, why?
- Index(es):
Relevant Pages
|