ReactOS 0.4.16-dev-424-ge4748fe
|
#include <ntoskrnl.h>
#include <debug.h>
Go to the source code of this file.
Macros | |
#define | NDEBUG |
#define | SE_MAXIMUM_PRIVILEGE_LIMIT 0x3C |
#define | CONST_LUID(x1, x2) {x1, x2} |
Functions | |
VOID NTAPI | SepInitPrivileges (VOID) |
Initializes the privileges during the startup phase of the security manager module. This function serves as a placeholder as it currently does nothing. | |
BOOLEAN NTAPI | SepPrivilegeCheck (_In_ PTOKEN Token, _In_ PLUID_AND_ATTRIBUTES Privileges, _In_ ULONG PrivilegeCount, _In_ ULONG PrivilegeControl, _In_ KPROCESSOR_MODE PreviousMode) |
Checks the privileges pointed by Privileges array argument if they exist and match with the privileges from an access token. | |
BOOLEAN NTAPI | SepSinglePrivilegeCheck (_In_ LUID PrivilegeValue, _In_ PTOKEN Token, _In_ KPROCESSOR_MODE PreviousMode) |
Checks only single privilege based upon the privilege pointed by a LUID and if it matches with the one from an access token. | |
NTSTATUS NTAPI | SePrivilegePolicyCheck (_Inout_ PACCESS_MASK DesiredAccess, _Inout_ PACCESS_MASK GrantedAccess, _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, _In_ PTOKEN Token, _Out_opt_ PPRIVILEGE_SET *OutPrivilegeSet, _In_ KPROCESSOR_MODE PreviousMode) |
Checks the security policy and returns a set of privileges based upon the said security policy context. | |
BOOLEAN NTAPI | SeCheckAuditPrivilege (_In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, _In_ KPROCESSOR_MODE PreviousMode) |
Checks a single privilege and performs an audit against a privileged service based on a security subject context. | |
NTSTATUS NTAPI | SeCaptureLuidAndAttributesArray (_In_ PLUID_AND_ATTRIBUTES Src, _In_ ULONG PrivilegeCount, _In_ KPROCESSOR_MODE PreviousMode, _In_opt_ PLUID_AND_ATTRIBUTES AllocatedMem, _In_opt_ ULONG AllocatedLength, _In_ POOL_TYPE PoolType, _In_ BOOLEAN CaptureIfKernel, _Out_ PLUID_AND_ATTRIBUTES *Dest, _Inout_ PULONG Length) |
Captures a LUID with attributes structure. This function is mainly tied in the context of privileges. | |
VOID NTAPI | SeReleaseLuidAndAttributesArray (_In_ PLUID_AND_ATTRIBUTES Privilege, _In_ KPROCESSOR_MODE PreviousMode, _In_ BOOLEAN CaptureIfKernel) |
Releases a LUID with attributes structure. | |
NTSTATUS NTAPI | SeAppendPrivileges (_Inout_ PACCESS_STATE AccessState, _In_ PPRIVILEGE_SET Privileges) |
Appends additional privileges. | |
VOID NTAPI | SeFreePrivileges (_In_ PPRIVILEGE_SET Privileges) |
Frees a set of privileges. | |
BOOLEAN NTAPI | SePrivilegeCheck (_In_ PPRIVILEGE_SET Privileges, _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, _In_ KPROCESSOR_MODE PreviousMode) |
Checks if a set of privileges exist and match within a security subject context. | |
BOOLEAN NTAPI | SeSinglePrivilegeCheck (_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode) |
Checks if a single privilege is present in the context of the calling thread. | |
BOOLEAN NTAPI | SeCheckPrivilegedObject (_In_ LUID PrivilegeValue, _In_ HANDLE ObjectHandle, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE PreviousMode) |
Checks a privileged object if such object has the specific privilege submitted by the caller. | |
NTSTATUS NTAPI | NtPrivilegeCheck (_In_ HANDLE ClientToken, _In_ PPRIVILEGE_SET RequiredPrivileges, _Out_ PBOOLEAN Result) |
Checks a client access token if it has the required set of privileges. | |
NTSTATUS NTAPI NtPrivilegeCheck | ( | _In_ HANDLE | ClientToken, |
_In_ PPRIVILEGE_SET | RequiredPrivileges, | ||
_Out_ PBOOLEAN | Result | ||
) |
Checks a client access token if it has the required set of privileges.
[in] | ClientToken | A handle to an access client token. |
[in] | RequiredPrivileges | A set of required privileges to be checked against the privileges of the access token. |
[out] | Result | The result, as a boolean value. If TRUE, the token has all the required privileges, FALSE otherwise. |
Definition at line 868 of file priv.c.
Referenced by PrivilegeCheck().
NTSTATUS NTAPI SeAppendPrivileges | ( | _Inout_ PACCESS_STATE | AccessState, |
_In_ PPRIVILEGE_SET | Privileges | ||
) |
Appends additional privileges.
[in] | AccessState | Access request to append. |
[in] | Privileges | Set of new privileges to append. |
Definition at line 588 of file priv.c.
Referenced by IopCheckBackupRestorePrivilege(), IopParseDevice(), NpCreateClientEnd(), NpCreateExistingNamedPipe(), ObCheckCreateObjectAccess(), ObCheckObjectAccess(), ObpCheckTraverseAccess(), and START_TEST().
NTSTATUS NTAPI SeCaptureLuidAndAttributesArray | ( | _In_ PLUID_AND_ATTRIBUTES | Src, |
_In_ ULONG | PrivilegeCount, | ||
_In_ KPROCESSOR_MODE | PreviousMode, | ||
_In_opt_ PLUID_AND_ATTRIBUTES | AllocatedMem, | ||
_In_opt_ ULONG | AllocatedLength, | ||
_In_ POOL_TYPE | PoolType, | ||
_In_ BOOLEAN | CaptureIfKernel, | ||
_Out_ PLUID_AND_ATTRIBUTES * | Dest, | ||
_Inout_ PULONG | Length | ||
) |
Captures a LUID with attributes structure. This function is mainly tied in the context of privileges.
[in] | Src | Source of a valid LUID with attributes structure. |
[in] | PrivilegeCount | Count number of privileges to be captured. |
[in] | PreviousMode | Processor level access mode. |
[in] | AllocatedMem | If specified, the function will use this allocated block memory buffer for the captured LUID and attributes structure. Otherwise the function will automatically allocate some buffer for it. |
[in] | AllocatedLength | The length of the buffer, pointed by AllocatedMem. |
[in] | PoolType | Pool type of the memory allocation. |
[in] | CaptureIfKernel | If set to TRUE, the capturing is done in the kernel itself. FALSE if the capturing is done in a kernel mode driver instead. |
[out] | Dest | The captured LUID with attributes buffer. |
[in,out] | Length | The length of the captured privileges count. |
Definition at line 438 of file priv.c.
Referenced by NtPrivilegeCheck().
BOOLEAN NTAPI SeCheckAuditPrivilege | ( | _In_ PSECURITY_SUBJECT_CONTEXT | SubjectContext, |
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks a single privilege and performs an audit against a privileged service based on a security subject context.
[in] | DesiredAccess | Security subject context used for privileged service auditing. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 360 of file priv.c.
Referenced by NtCloseObjectAuditAlarm(), NtOpenObjectAuditAlarm(), NtPrivilegedServiceAuditAlarm(), and SepAccessCheckAndAuditAlarm().
BOOLEAN NTAPI SeCheckPrivilegedObject | ( | _In_ LUID | PrivilegeValue, |
_In_ HANDLE | ObjectHandle, | ||
_In_ ACCESS_MASK | DesiredAccess, | ||
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks a privileged object if such object has the specific privilege submitted by the caller.
[in] | PrivilegeValue | A privilege to be checked against the one from the object. |
[in] | ObjectHandle | A handle to any kind of object. |
[in] | DesiredAccess | Desired access right mask requested by the caller. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 803 of file priv.c.
Referenced by NtSetInformationProcess(), and NtSetInformationThread().
VOID NTAPI SeFreePrivileges | ( | _In_ PPRIVILEGE_SET | Privileges | ) |
Frees a set of privileges.
[in] | Privileges | Set of privileges array to be freed. |
Definition at line 669 of file priv.c.
Referenced by IopParseDevice(), NpCreateClientEnd(), NpCreateExistingNamedPipe(), ObCheckCreateObjectAccess(), ObCheckObjectAccess(), ObpCheckTraverseAccess(), SepAccessCheck(), and START_TEST().
Initializes the privileges during the startup phase of the security manager module. This function serves as a placeholder as it currently does nothing.
Definition at line 71 of file priv.c.
Referenced by SepInitializationPhase0().
BOOLEAN NTAPI SepPrivilegeCheck | ( | _In_ PTOKEN | Token, |
_In_ PLUID_AND_ATTRIBUTES | Privileges, | ||
_In_ ULONG | PrivilegeCount, | ||
_In_ ULONG | PrivilegeControl, | ||
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks the privileges pointed by Privileges array argument if they exist and match with the privileges from an access token.
[in] | Token | An access token where privileges are to be checked. |
[in] | Privileges | An array of privileges with attributes used as checking indicator for the function. |
[in] | PrivilegeCount | The total number count of privileges in the array. |
[in] | PrivilegeControl | Privilege control bit mask to determine if we should check all the privileges based on the number count of privileges or not. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 104 of file priv.c.
Referenced by NtPrivilegeCheck(), SeCheckAuditPrivilege(), SePrivilegeCheck(), and SepSinglePrivilegeCheck().
BOOLEAN NTAPI SePrivilegeCheck | ( | _In_ PPRIVILEGE_SET | Privileges, |
_In_ PSECURITY_SUBJECT_CONTEXT | SubjectContext, | ||
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks if a set of privileges exist and match within a security subject context.
[in] | Privileges | A set of privileges where the check must be performed against the subject context. |
[in] | SubjectContext | A subject security context. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 698 of file priv.c.
Referenced by FatCheckManageVolumeAccess(), has_manage_volume_privilege(), HasPrivilege(), IopCheckBackupRestorePrivilege(), SeCheckPrivilegedObject(), SeSinglePrivilegeCheck(), and START_TEST().
NTSTATUS NTAPI SePrivilegePolicyCheck | ( | _Inout_ PACCESS_MASK | DesiredAccess, |
_Inout_ PACCESS_MASK | GrantedAccess, | ||
_In_ PSECURITY_SUBJECT_CONTEXT | SubjectContext, | ||
_In_ PTOKEN | Token, | ||
_Out_opt_ PPRIVILEGE_SET * | OutPrivilegeSet, | ||
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks the security policy and returns a set of privileges based upon the said security policy context.
[in,out] | DesiredAccess | The desired access right mask. |
[in,out] | GrantedAccess | The granted access rights masks. The rights are granted depending on the desired access rights requested by the calling thread. |
[in] | SubjectContext | Security subject context. If the caller supplies one, the access token supplied by the caller will be assigned to one of client or primary tokens of the subject context in question. |
[in] | Token | An access token. |
[out] | OutPrivilegeSet | An array set of privileges to be reported to the caller, if the actual calling thread wants such set of privileges in the first place. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 244 of file priv.c.
Referenced by SepAccessCheck(), and SepAccessCheckWorker().
BOOLEAN NTAPI SepSinglePrivilegeCheck | ( | _In_ LUID | PrivilegeValue, |
_In_ PTOKEN | Token, | ||
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks only single privilege based upon the privilege pointed by a LUID and if it matches with the one from an access token.
[in] | PrivilegeValue | The privilege to be checked. |
[in] | Token | An access token where its privilege is to be checked against the one provided by the caller. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 190 of file priv.c.
Referenced by SePrivilegePolicyCheck().
VOID NTAPI SeReleaseLuidAndAttributesArray | ( | _In_ PLUID_AND_ATTRIBUTES | Privilege, |
_In_ KPROCESSOR_MODE | PreviousMode, | ||
_In_ BOOLEAN | CaptureIfKernel | ||
) |
Releases a LUID with attributes structure.
[in] | Privilege | Array of a LUID and attributes that represents a privilege. |
[in] | PreviousMode | Processor level access mode. |
[in] | CaptureIfKernel | If set to TRUE, the releasing is done in the kernel itself. FALSE if the releasing is done in a kernel mode driver instead. |
Definition at line 554 of file priv.c.
Referenced by NtAdjustPrivilegesToken(), NtCreateToken(), NtFilterToken(), and NtPrivilegeCheck().
BOOLEAN NTAPI SeSinglePrivilegeCheck | ( | _In_ LUID | PrivilegeValue, |
_In_ KPROCESSOR_MODE | PreviousMode | ||
) |
Checks if a single privilege is present in the context of the calling thread.
[in] | PrivilegeValue | The specific privilege to be checked. |
[in] | PreviousMode | Processor level access mode. |
Definition at line 744 of file priv.c.
Referenced by add_device(), ApphelpCacheAccessCheck(), ExpRaiseHardError(), Ext2InvalidateVolumes(), FatCheckSystemSecurityAccess(), find_subvol(), fsctl_set_xattr(), invalidate_volumes(), ioctl_unload(), IopUnloadDriver(), KsInstallBusEnumInterface(), KsRemoveBusEnumInterface(), mknod(), NtAllocateVirtualMemory(), NtCreatePagingFile(), NtCreateProfile(), NtCreateToken(), NtDisplayString(), NtGetPlugPlayEvent(), NtLoadDriver(), NtLoadKeyEx(), NtLockVirtualMemory(), NtMakePermanentObject(), NtOpenProcess(), NtOpenThread(), NtPlugPlayControl(), NtQuerySystemEnvironmentValue(), NtSaveKeyEx(), NtSaveMergedKeys(), NtSetDebugFilterState(), NtSetDefaultHardErrorPort(), NtSetInformationObject(), NtSetInformationProcess(), NtSetInformationThread(), NtSetInformationToken(), NtSetSystemEnvironmentValue(), NtSetSystemPowerState(), NtSetSystemTime(), NtUnloadKey2(), NtUnlockVirtualMemory(), ObCreateObject(), ObpLookupObjectName(), pause_balance(), pause_scrub(), probe_volume(), PspSetPrimaryToken(), PspSetQuotaLimits(), query_scrub(), read_send_buffer(), recvd_subvol(), remove_device(), reserve_subvol(), reset_stats(), resize_device(), resume_balance(), resume_scrub(), send_subvol(), SSI_DEF(), start_balance(), start_scrub(), stop_balance(), stop_scrub(), UDFCheckAccessRights(), UDFCommonCreate(), and UDFInvalidateVolumes().
const LUID SeAssignPrimaryTokenPrivilege = CONST_LUID(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, 0) |
Definition at line 22 of file priv.c.
Referenced by PspSetPrimaryToken(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeAuditPrivilege = CONST_LUID(SE_AUDIT_PRIVILEGE, 0) |
Definition at line 40 of file priv.c.
Referenced by SeCheckAuditPrivilege(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeBackupPrivilege = CONST_LUID(SE_BACKUP_PRIVILEGE, 0) |
Definition at line 36 of file priv.c.
Referenced by IopCheckBackupRestorePrivilege(), NtSaveKeyEx(), NtSaveMergedKeys(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeChangeNotifyPrivilege = CONST_LUID(SE_CHANGE_NOTIFY_PRIVILEGE, 0) |
const LUID SeCreateGlobalPrivilege = CONST_LUID(SE_CREATE_GLOBAL_PRIVILEGE, 0) |
const LUID SeCreatePagefilePrivilege = CONST_LUID(SE_CREATE_PAGEFILE_PRIVILEGE, 0) |
Definition at line 34 of file priv.c.
Referenced by NtCreatePagingFile(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeCreatePermanentPrivilege = CONST_LUID(SE_CREATE_PERMANENT_PRIVILEGE, 0) |
Definition at line 35 of file priv.c.
Referenced by NtMakePermanentObject(), ObCreateObject(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeCreateSymbolicLinkPrivilege = CONST_LUID(SE_CREATE_SYMBOLIC_LINK_PRIVILEGE, 0) |
const LUID SeCreateTokenPrivilege = CONST_LUID(SE_CREATE_TOKEN_PRIVILEGE, 0) |
Definition at line 21 of file priv.c.
Referenced by NtCreateToken(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeDebugPrivilege = CONST_LUID(SE_DEBUG_PRIVILEGE, 0) |
Definition at line 39 of file priv.c.
Referenced by NtOpenProcess(), NtOpenThread(), NtSetDebugFilterState(), NtSetInformationProcess(), NtSetInformationThread(), SepCreateSystemProcessToken(), SepInitExports(), and SSI_DEF().
const LUID SeEnableDelegationPrivilege = CONST_LUID(SE_ENABLE_DELEGATION_PRIVILEGE, 0) |
Definition at line 46 of file priv.c.
Referenced by SepInitExports().
const LUID SeImpersonatePrivilege = CONST_LUID(SE_IMPERSONATE_PRIVILEGE, 0) |
const LUID SeIncreaseBasePriorityPrivilege = CONST_LUID(SE_INC_BASE_PRIORITY_PRIVILEGE, 0) |
Definition at line 33 of file priv.c.
Referenced by NtSetInformationProcess(), NtSetInformationThread(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeIncreaseQuotaPrivilege = CONST_LUID(SE_INCREASE_QUOTA_PRIVILEGE, 0) |
Definition at line 24 of file priv.c.
Referenced by PspSetQuotaLimits(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeIncreaseWorkingSetPrivilege = CONST_LUID(SE_INC_WORKING_SET_PRIVILEGE, 0) |
const LUID SeLoadDriverPrivilege = CONST_LUID(SE_LOAD_DRIVER_PRIVILEGE, 0) |
Definition at line 29 of file priv.c.
Referenced by IopUnloadDriver(), NtLoadDriver(), SepCreateSystemProcessToken(), SepInitExports(), and SSI_DEF().
const LUID SeLockMemoryPrivilege = CONST_LUID(SE_LOCK_MEMORY_PRIVILEGE, 0) |
Definition at line 23 of file priv.c.
Referenced by NtAllocateVirtualMemory(), NtLockVirtualMemory(), NtUnlockVirtualMemory(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeManageVolumePrivilege = CONST_LUID(SE_MANAGE_VOLUME_PRIVILEGE, 0) |
Definition at line 47 of file priv.c.
Referenced by SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeProfileSingleProcessPrivilege = CONST_LUID(SE_PROF_SINGLE_PROCESS_PRIVILEGE, 0) |
Definition at line 32 of file priv.c.
Referenced by SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeRelabelPrivilege = CONST_LUID(SE_RELABEL_PRIVILEGE, 0) |
const LUID SeRemoteShutdownPrivilege = CONST_LUID(SE_REMOTE_SHUTDOWN_PRIVILEGE, 0) |
Definition at line 43 of file priv.c.
Referenced by SepInitExports().
const LUID SeRestorePrivilege = CONST_LUID(SE_RESTORE_PRIVILEGE, 0) |
Definition at line 37 of file priv.c.
Referenced by IopCheckBackupRestorePrivilege(), NtLoadKeyEx(), NtUnloadKey2(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeSecurityPrivilege = CONST_LUID(SE_SECURITY_PRIVILEGE, 0) |
Definition at line 27 of file priv.c.
Referenced by SepCreateSystemProcessToken(), SepInitExports(), and SePrivilegePolicyCheck().
const LUID SeShutdownPrivilege = CONST_LUID(SE_SHUTDOWN_PRIVILEGE, 0) |
Definition at line 38 of file priv.c.
Referenced by ExpRaiseHardError(), NtSetSystemPowerState(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeSyncAgentPrivilege = CONST_LUID(SE_SYNC_AGENT_PRIVILEGE, 0) |
Definition at line 45 of file priv.c.
Referenced by SepInitExports().
const LUID SeSystemEnvironmentPrivilege = CONST_LUID(SE_SYSTEM_ENVIRONMENT_PRIVILEGE, 0) |
Definition at line 41 of file priv.c.
Referenced by NtQuerySystemEnvironmentValue(), NtSetSystemEnvironmentValue(), SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeSystemProfilePrivilege = CONST_LUID(SE_SYSTEM_PROFILE_PRIVILEGE, 0) |
Definition at line 30 of file priv.c.
Referenced by NtCreateProfile(), and SepInitExports().
const LUID SeSystemtimePrivilege = CONST_LUID(SE_SYSTEMTIME_PRIVILEGE, 0) |
Definition at line 31 of file priv.c.
Referenced by NtSetSystemTime(), SepCreateSystemProcessToken(), SepInitExports(), and SSI_DEF().
const LUID SeTakeOwnershipPrivilege = CONST_LUID(SE_TAKE_OWNERSHIP_PRIVILEGE, 0) |
Definition at line 28 of file priv.c.
Referenced by SepCreateSystemProcessToken(), SepInitExports(), and SePrivilegePolicyCheck().
const LUID SeTcbPrivilege = CONST_LUID(SE_TCB_PRIVILEGE, 0) |
Definition at line 26 of file priv.c.
Referenced by ApphelpCacheAccessCheck(), ExpRaiseHardError(), NtDisplayString(), NtGetPlugPlayEvent(), NtPlugPlayControl(), NtSetDefaultHardErrorPort(), NtSetInformationObject(), NtSetInformationProcess(), NtSetInformationToken(), SepCreateSystemProcessToken(), SepInitExports(), SepSinglePrivilegeCheck(), and SSI_DEF().
const LUID SeTimeZonePrivilege = CONST_LUID(SE_TIME_ZONE_PRIVILEGE, 0) |
const LUID SeTrustedCredmanPrivilege = CONST_LUID(SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE, 0) |
const LUID SeUndockPrivilege = CONST_LUID(SE_UNDOCK_PRIVILEGE, 0) |
Definition at line 44 of file priv.c.
Referenced by SepCreateSystemProcessToken(), and SepInitExports().
const LUID SeUnsolicitedInputPrivilege = CONST_LUID(6, 0) |
Definition at line 25 of file priv.c.
Referenced by SepInitExports().