You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WINLOGON][HACK] Allow network services access to default window station
HHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCCCCCCCCCCCCCCCCCCCCCCKKKKKKKKKKKKKKKKKK!!!
There are two problems concerning with network services. First, a window station should be created for every network service process that gets started although this doesn't happen. Instead, network services like RPCSS and DNS service host process (svchost.exe) attempt to access the default window station (Winsta0).
This is because the access token of these two network service processes have an authentication ID that is uniquely generated. This is incorrect, because NetworkService is a special account with its own designed authentication ID for it. As a matter of fact, no window station is created for a network service and as such
both RPCSS and DNS svchost.exe attempt to access Winsta0 which they cannot.
The second problem, albeit not quite relevant to the first one but still worth mentioning nevertheless, is that network services have an access token that is primary which it should be an impersonation token. These problems all come from LSASS as LSA infrastructure is responsible for creating access tokens with security
context for objects.
For the moment being, add a hack on Winlogon that gives allow access to the default window station to network services. When LSASS and involved components are fixed, this hack must be removed.
PSIDWinlogonSid=NULL, AdminsSid=NULL, NetworkServiceSid=NULL; /* NetworkServiceSid is a HACK, see the comment in CreateWinstaSecurity for information */
PSIDWinlogonSid=NULL, AdminsSid=NULL, InteractiveSid=NULL, NetworkServiceSid=NULL; /* NetworkServiceSid is a HACK, see the comment in CreateWinstaSecurity for information */
779
882
SECURITY_INFORMATIONSecurityInformation;
780
883
DWORDDaclSize;
781
884
PACLDacl;
@@ -814,6 +917,17 @@ AllowWinstaAccessToUser(
814
917
goto Quit;
815
918
}
816
919
920
+
/* HACK: Create the network service SID */
921
+
if (!AllocateAndInitializeSid(&NtAuthority,
922
+
1,
923
+
SECURITY_NETWORK_SERVICE_RID,
924
+
0, 0, 0, 0, 0, 0, 0,
925
+
&NetworkServiceSid))
926
+
{
927
+
ERR("AllowWinstaAccessToUser(): Failed to create the network service SID (error code %lu)\n", GetLastError());
928
+
goto Quit;
929
+
}
930
+
817
931
/*
818
932
* Build up the DACL size. This includes a number
819
933
* of eight ACEs of four different SIDs. The first ACE
PSIDWinlogonSid=NULL, AdminsSid=NULL, InteractiveSid=NULL, NetworkServiceSid=NULL; /* NetworkServiceSid is a HACK, see the comment in CreateWinstaSecurity for information */
1028
1173
SECURITY_INFORMATIONSecurityInformation;
1029
1174
DWORDDaclSize;
1030
1175
PACLDacl;
@@ -1063,6 +1208,17 @@ AllowDesktopAccessToUser(
1063
1208
goto Quit;
1064
1209
}
1065
1210
1211
+
/* HACK: Create the network service SID */
1212
+
if (!AllocateAndInitializeSid(&NtAuthority,
1213
+
1,
1214
+
SECURITY_NETWORK_SERVICE_RID,
1215
+
0, 0, 0, 0, 0, 0, 0,
1216
+
&NetworkServiceSid))
1217
+
{
1218
+
ERR("AllowDesktopAccessToUser(): Failed to create the network service SID (error code %lu)\n", GetLastError());
1219
+
goto Quit;
1220
+
}
1221
+
1066
1222
/*
1067
1223
* Build up the DACL size. This includes a number
1068
1224
* of four ACEs of four different SIDs. The first ACE
0 commit comments