whoami and why does it matter for security?whoami returns the domain and username of the current process. It seems simple, but in administration and pentesting it is essential to confirm the execution context before launching privileged commands.
whoami
whoami /fqdn
The /priv parameter shows all privileges of the security token: which are enabled, disabled or removed. Essential for detecting processes with excessive privileges.
whoami /priv
whoami /groups
whoami /all
| Privilege | Risk | Description |
|---|---|---|
SeDebugPrivilege | High | Allows debugging any process, including LSASS |
SeImpersonatePrivilege | High | Can be used for privilege escalation |
SeBackupPrivilege | Medium | Allows reading any file bypassing ACLs |
SeShutdownPrivilege | Low | Can shut down the system |
whoami /all, analyzes the privileges and warns you if any high-risk privilege is enabled.