Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Default Security Context of Thread

1 view
Skip to first unread message

Samar Abbas Lotia

unread,
Aug 29, 2000, 3:00:00 AM8/29/00
to

We have run into a problem in our ISAPI application and we THINK we have
traced it to how NT assigns default thread security.

The essentials of the problem:

1. Inetinfo.exe is a service which runs under the security privileges of the
"System" account

2. When a client connects to our ISAPI application, Inetinfo.exe spawns off
a thread to handle the request and the thread appears to be running under
the user specified for the ISAPI application (usually IUSR_XXX).

3. If this thread creates a new thread using a NULL/default security
descriptor, the new thread seems to be running under the "System" account
rather than under the account of the thread which created it.

In each of the cases we are identifying which user the thread is running
under by calling GetUserName.

How can this behaviour be altered, i.e. what is necessary to ensure that
"child" threads run under the same security context as the thread which
created them rather than the default security context of the process?

Thanks.

Samar Lotia

Richard Ward

unread,
Aug 31, 2000, 3:00:00 AM8/31/00
to
Don't try creating a thread while you're impersonating, it will just
lead to really non-intuitive behavior. If you are about to create
a thread, do the following:

OpenThreadToken( GetCurrentThread(),
TOKEN_IMPERSONATE | TOKEN_QUERY,
TRUE,
&hToken )

RevertToSelf()

hThread = CreateThread( NULL, 0,
function, parameter,
CREATE_SUSPENDED, &tid )

SetThreadToken( &hThread, hToken )

ResumeThread( hThread )

SetThreadToken( NULL, hToken )

CloseHandle( hToken )

"Samar Abbas Lotia" <sal...@nquire.mail.com> wrote in message
news:eUB2zahEAHA.271@cppssbbsa05...

0 new messages