Definition of tokens
Temporary keys that allow you access to a system/network without having to provide credentials each time you access a file (think cookies for computers).
There are two types of tokens:
- Delegate: Created for logging into a machine or using a Remote Desktop
- Impersonate: non interactive, such as attaching a network drive or a domain logon script. to see if the machine that you popped a shell into has a high value user currently logged-in (for example: administrator)
Executing Token Impersonation in MS using password
- Run
msf
and setup options to gain shell access
- Load incognito mode
- List tokens of groups and users
- Impersonate! (based on the results of previous command, if we find <domain-name>\administrator that is a WIN!)
- Now, since you impersonated administrator and have administrator privileges, you can add users
- Add created user to domain admins
- Now, using our created domain admin. We can secretsdump the domain controller because we are in the domain admins group!
rev2self
Run rev2self if you want to go back from the impersonation to the stage were you just popped the shell at.
Token Impersonation mitigation
- Limit user/group token creation permission
- Account tiering
- Local admin restriction