T1134.003 - Make and Impersonate Token#
Adversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. For example, if an adversary has a username and password but the user is not logged onto the system the adversary can then create a logon session for the user using the LogonUser
function. The function will return a copy of the new session’s access token and the adversary can use SetThreadToken
to assign the token to a thread.
This behavior is distinct from Token Impersonation/Theft in that this refers to creating a new user token instead of stealing or duplicating an existing one.
Atomic Tests:#
Currently, no tests are available for this technique.
Detection#
If an adversary is using a standard command-line shell, analysts can detect token manipulation by auditing command-line activity. Specifically, analysts should look for use of the runas
command. Detailed command-line logging is not enabled by default in Windows.(Citation: Microsoft Command-line Logging)
If an adversary is using a payload that calls the Windows token APIs directly, analysts can detect token manipulation only through careful analysis of user network activity, examination of running processes, and correlation with other endpoint and network behavior.
Analysts can also monitor for use of Windows APIs such as LogonUser
and SetThreadToken
and correlate activity with other suspicious behavior to reduce false positives that may be due to normal benign use by users and administrators.