Skip to content

Instantly share code, notes, and snippets.

@rbmm
Created November 8, 2023 12:45
Show Gist options
  • Save rbmm/652d5d9015aadb9c600d7c60f7acecc3 to your computer and use it in GitHub Desktop.
Save rbmm/652d5d9015aadb9c600d7c60f7acecc3 to your computer and use it in GitHub Desktop.
OBJECT_ATTRIBUTES oa = { sizeof(oa) };
LSA_HANDLE PolicyHandle;
if (0 <= LsaOpenPolicy(0, &oa, POLICY_LOOKUP_NAMES, &PolicyHandle))
{
ULONG CountOfRights;
static SID EveryOne = { SID_REVISION, 1, SECURITY_WORLD_SID_AUTHORITY, { SECURITY_WORLD_RID } };
PLSA_UNICODE_STRING UserRights;
if (0 <= LsaEnumerateAccountRights(PolicyHandle, &EveryOne, &UserRights, &CountOfRights))
{
if (CountOfRights)
{
UserRights += CountOfRights;
do
{
DbgPrint("\"%wZ\"\n", --UserRights);
} while (--CountOfRights);
}
LsaFreeMemory(UserRights);
}
LsaClose(PolicyHandle);
}
//////////////////////////////////////////
"SeNetworkLogonRight"
"SeLockMemoryPrivilege"
"SeChangeNotifyPrivilege"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment