Dear ntfsd,
I am able to determine if IO is local or from CIFS/SMB by assuming the
I/O is
remote CIFS I/O based on the following check, then attempting my CIFS
I/O
SID retrieval, then reverting to local I/O SID retrieval upon failure.
if ( (Data->Iopb->Parameters.Create.SecurityContext)
&& (Data->Iopb->Parameters.Create.SecurityContext->AccessState)
&&
(Data->Iopb->Parameters.Create.SecurityContext->AccessState->SubjectSecu
rityContext.ClientToken) )
{ /* assume remote I/O until SID retrieval failure then revert
to Local I/O SID retrieval */ }
The scheme has proven pretty much 100% successful over 300+ GB of test
access in that
I am always able to get a SID corresponding to a DOMAINUSER/DOMAIN
account.
Since I have tried CIFS access to the minifilter attached to KMDF sample
ramdisk volume,
I have been getting SIDs belonging to the Local Machine belonging to
Administrator/BUILTIN
Which is definitely not what I want.
With a minifilter attached to a “Normal” volume (e.g. C:)
able to get SID for CIFS I/O using:
ObOpenObjectByPointer on
Data->Iopb->Parameters.Create.SecurityContext->
AccessState->SubjectSecurityContext.ClientToken
ZwQueryInformationToken on returned access token
RtlCopySid on returned SID
done.
able to get SID for Local I/O using:
ObGetObjectSecurity on Data->Thread
RtlGetOwnerSecurityDescriptor on security descriptor
RtlCopySid on returned SID
done.
with minifilter attached to KMDF sample ramdisk volume (X:)
This breaks because the test (next lines) fails and we automatically
revert to local I/O SID retrieval.
if ( (Data->Iopb->Parameters.Create.SecurityContext)
&& (Data->Iopb->Parameters.Create.SecurityContext->AccessState)
&&
(Data->Iopb->Parameters.Create.SecurityContext->AccessState->SubjectSecu
rityContext.ClientToken) )
{ /* assume remote I/O until SID retrieval failure then revert
to Local I/O SID retrieval */ }
The result is that some SIDs gathered are for the Local
Administrator/BUILTIN, which is what I don’t want,
And other SIDs are for DOMAINUSER/DOMAIN, which is what I want.
able to get SID for Local I/O using:
ObGetObjectSecurity on Data->Thread
RtlGetOwnerSecurityDescriptor on security descriptor
RtlCopySid on returned SID
done.
NOT able to get SID for CIFS I/O using: (Because It never gets
attempted!)
ObOpenObjectByPointer on
Data->Iopb->Parameters.Create.SecurityContext->
AccessState->SubjectSecurityContext.ClientToken
ZwQueryInformationToken on returned access token
RtlCopySid on returned SID
The volumes are not being shared as “C$” and “X$” but rather as “C” and
“X” in the “normal” way.
So What is going on here?
Is my local/remote test inadequate for volume root shares for remote I/O
via CIFS?
If the remote I/O test fails, then there is no impersonating thread
doing access in place
for a CIFS call to the Samba redirector, or rather there is no thread
security impersonation
at all; and I am forever unable to get the true originating caller’s SID
for certain I/O operations?
I don’t like that, so again, What is really going on here?
Sincerely,
Stefan Kozak,
www.LRS.com