Update token.c

This commit is contained in:
DavidXanatos 2024-06-24 17:08:56 +02:00
parent 481ddf723b
commit b6b97a88aa
1 changed files with 16 additions and 1 deletions

View File

@ -2193,6 +2193,12 @@ _FX void* Token_CreateToken(void* TokenObject, PROCESS* proc)
OBJECT_ATTRIBUTES ObjectAttributes;
SECURITY_QUALITY_OF_SERVICE SecurityQos;
TOKEN_PRIVILEGES AllowedPrivilege;
AllowedPrivilege.PrivilegeCount = 1;
AllowedPrivilege.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT;
AllowedPrivilege.Privileges[0].Luid.HighPart = 0;
AllowedPrivilege.Privileges[0].Luid.LowPart = SE_CHANGE_NOTIFY_PRIVILEGE;
//
// Gather information from the original token
//
@ -2290,6 +2296,15 @@ _FX void* Token_CreateToken(void* TokenObject, PROCESS* proc)
RtlCopyMemory(&LocalGroups->Groups[1], OldLocalGroups->Groups, OldLocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
LocalGroups->GroupCount = NewGroupCount;
}
/*for (ULONG i = 0; i < LocalPrivileges->PrivilegeCount; ++i) {
LUID_AND_ATTRIBUTES *entry_i = &LocalPrivileges->Privileges[i];
DbgPrint("Priv: %d-%d (0x%x)\n", entry_i->Luid.HighPart, entry_i->Luid.LowPart, entry_i->Attributes);
}*/
if (LocalPrivileges) ExFreePool((PVOID)LocalPrivileges);
LocalPrivileges = &AllowedPrivilege;
}
//
@ -2494,7 +2509,7 @@ finish:
if (LocalUser) ExFreePool((PVOID)LocalUser);
if (LocalGroups) ExFreePool((PVOID)LocalGroups);
if (OldLocalGroups) ExFreePool((PVOID)OldLocalGroups);
if (LocalPrivileges) ExFreePool((PVOID)LocalPrivileges);
if (LocalPrivileges && LocalPrivileges != &AllowedPrivilege) ExFreePool((PVOID)LocalPrivileges);
//if (UserAttributes) ExFreePool((PVOID)UserAttributes);
//if (DeviceAttributes) ExFreePool((PVOID)DeviceAttributes);