Skip to content

Commit c9780d9

Browse files
MuerteSeguraZGeoB99
authored andcommitted
[NTOS:OB] Validate ACCESS_SYSTEM_SECURITY in ObpIncrementHandleCount
Validate ACCESS_SYSTEM_SECURITY access requests when creating a new handle in ObpIncrementHandleCount. - Check for SeSecurityPrivilege (with SeSinglePrivilegeCheck) when a caller requests ACCESS_SYSTEM_SECURITY on handle creation. - Take away ACCESS_SYSTEM_SECURITY from RemainingDesiredAccess / PreviouslyGrantedAccess if the privilege isn't held.
1 parent 8dc41c6 commit c9780d9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎ntoskrnl/ob/obhandle.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,17 @@ ObpIncrementHandleCount(IN PVOID Object,
954954
/* Check if the caller is trying to access system security */
955955
if (AccessState->RemainingDesiredAccess & ACCESS_SYSTEM_SECURITY)
956956
{
957-
/* FIXME: TODO */
958-
DPRINT1("ACCESS_SYSTEM_SECURITY not validated!\n");
957+
/* Client must be warranted SeSecurityPrivilege to touch SACLs */
958+
if (!SeSinglePrivilegeCheck(SeSecurityPrivilege, ProbeMode))
959+
{
960+
/* FIXME: Generate an audit alarm, security manager must be alerted */
961+
Status = STATUS_PRIVILEGE_NOT_HELD;
962+
goto Quickie;
963+
}
964+
965+
/* Privilege held, grant it so the access state reflects reality */
966+
AccessState->PreviouslyGrantedAccess |= ACCESS_SYSTEM_SECURITY;
967+
AccessState->RemainingDesiredAccess &= ~ACCESS_SYSTEM_SECURITY;
959968
}
960969
}
961970

0 commit comments

Comments
 (0)