Skip to main content

Module debug_privilege

Module debug_privilege 

Source
Expand description

Whether this process holds SeDebugPrivilege enabled.

On Windows a token with that privilege enabled opens any process and any thread whatever the target’s access-control list says, so the control in process_hardening cannot refuse it. An elevated administrator’s token has the privilege, usually disabled; a GitHub-hosted Windows runner’s runneradmin has it enabled. The tests that watch a hardened process being refused ask this first and skip where the refusal cannot be seen.

Functions§

debug_privilege_enabled
Whether this process’s own token has SeDebugPrivilege enabled (present but disabled does not count: only an enabled privilege bypasses the list). Always false off Windows.
refusal_cannot_be_observed
For a test that expects another process to be refused access to a hardened one: true, after printing why, when this process holds SeDebugPrivilege enabled and the refusal cannot be observed. The test returns early on true; on an ordinary token it runs in full.