Манипуляции с токенами доступа
Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.
An adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. Token Impersonation/Theft) or used to spawn a new process (i.e. Create Process with Token). An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.(Citation: Pentestlab Token Manipulation)
Any standard user can use the runas
command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.
Примеры процедур |
|
Название | Описание |
---|---|
HermeticWiper |
HermeticWiper can use `AdjustTokenPrivileges` to grant itself privileges for debugging with `SeDebugPrivilege`, creating backups with `SeBackupPrivilege`, loading drivers with `SeLoadDriverPrivilege`, and shutting down a local system with `SeShutdownPrivilege`.(Citation: Qualys Hermetic Wiper March 2022)(Citation: Crowdstrike DriveSlayer February 2022) |
SUNSPOT |
SUNSPOT modified its security token to grants itself debugging privileges by adding |
PowerSploit |
PowerSploit's |
AppleSeed |
AppleSeed can gain system level privilege by passing |
Sliver |
Sliver has the ability to manipulate user tokens on targeted Windows systems.(Citation: Bishop Fox Sliver Framework August 2019)(Citation: GitHub Sliver C2) |
FIN6 |
FIN6 has used has used Metasploit’s named-pipe impersonation technique to escalate privileges.(Citation: FireEye FIN6 Apr 2019) |
Blue Mockingbird |
Blue Mockingbird has used JuicyPotato to abuse the |
SslMM |
SslMM contains a feature to manipulate process privileges and tokens.(Citation: Baumgartner Naikon 2015) |
Duqu |
Duqu examines running system processes for tokens that have specific system privileges. If it finds one, it will copy the token and store it for later use. Eventually it will start new processes with the stored token attached. It can also steal tokens to acquire administrative privileges.(Citation: Kaspersky Duqu 2.0) |
Empire |
Empire can use PowerSploit's |
Gelsemium |
Gelsemium can use token manipulation to bypass UAC on Windows7 systems.(Citation: ESET Gelsemium June 2021) |
Cuba |
Cuba has used |
Mafalda |
Mafalda can use `AdjustTokenPrivileges()` to elevate privileges.(Citation: SentinelLabs Metador Technical Appendix Sept 2022) |
During C0017, APT41 used a ConfuserEx obfuscated BADPOTATO exploit to abuse named-pipe impersonation for local `NT AUTHORITY\SYSTEM` privilege escalation.(Citation: Mandiant APT41) |
|
PoshC2 |
PoshC2 can use Invoke-TokenManipulation for manipulating tokens.(Citation: GitHub PoshC2) |
Hydraq |
Hydraq creates a backdoor through which remote attackers can adjust token privileges.(Citation: Symantec Hydraq Jan 2010) |
KillDisk |
KillDisk has attempted to get the access token of a process by calling |
Ryuk |
Ryuk has attempted to adjust its token privileges to have the |
MegaCortex |
MegaCortex can enable |
BlackCat |
BlackCat has the ability modify access tokens.(Citation: Microsoft BlackCat Jun 2022)(Citation: Sophos BlackCat Jul 2022) |
Контрмеры |
|
Контрмера | Описание |
---|---|
User Account Management |
Manage the creation, modification, use, and permissions associated to user accounts. |
Privileged Account Management |
Manage the creation, modification, use, and permissions associated to privileged accounts, including SYSTEM and root. |
Access Token Manipulation Mitigation |
Access tokens are an integral part of the security system within Windows and cannot be turned off. However, an attacker must already have administrator level access on the local system to make full use of this technique; be sure to restrict users and accounts to the least privileges they require to do their job. Any user can also spoof access tokens if they have legitimate credentials. Follow mitigation guidelines for preventing adversary use of Valid Accounts. Limit permissions so that users and user groups cannot create tokens. This setting should be defined for the local system account only. GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > User Rights Assignment: Create a token object. (Citation: Microsoft Create Token) Also define who can create a process level token to only the local and network service through GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > User Rights Assignment: Replace a process level token. (Citation: Microsoft Replace Process Token) Also limit opportunities for adversaries to increase privileges by limiting Privilege Escalation opportunities. |
Обнаружение
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.
There are many Windows API calls a payload can take advantage of to manipulate access tokens (e.g., LogonUser
(Citation: Microsoft LogonUser), DuplicateTokenEx
(Citation: Microsoft DuplicateTokenEx), and ImpersonateLoggedOnUser
(Citation: Microsoft ImpersonateLoggedOnUser)). Please see the referenced Windows API pages for more information.
Query systems for process and thread token information and look for inconsistencies such as user owns processes impersonating the local SYSTEM account.(Citation: BlackHat Atkinson Winchester Token Manipulation)
Look for inconsistencies between the various fields that store PPID information, such as the EventHeader ProcessId from data collected via Event Tracing for Windows (ETW), Creator Process ID/Name from Windows event logs, and the ProcessID and ParentProcessID (which are also produced from ETW and other utilities such as Task Manager and Process Explorer). The ETW provided EventHeader ProcessId identifies the actual parent process.
Ссылки
- netbiosX. (2017, April 3). Token Manipulation. Retrieved April 21, 2017.
- Microsoft TechNet. (n.d.). Retrieved April 25, 2017.
- Microsoft TechNet. (n.d.). Retrieved April 25, 2017.
- Microsoft TechNet. (n.d.). Retrieved April 25, 2017.
- Mathers, B. (2017, March 7). Command line process auditing. Retrieved April 21, 2017.
- Atkinson, J., Winchester, R. (2017, December 7). A Process is No One: Hunting for Token Manipulation. Retrieved December 21, 2017.
- Thomas, W. et al. (2022, February 25). CrowdStrike Falcon Protects from New Wiper Malware Used in Ukraine Cyberattacks. Retrieved March 25, 2022.
- Dani, M. (2022, March 1). Ukrainian Targets Hit by HermeticWiper, New Datawiper Malware. Retrieved March 25, 2022.
- CrowdStrike Intelligence Team. (2021, January 11). SUNSPOT: An Implant in the Build Process. Retrieved January 11, 2021.
- PowerSploit. (n.d.). PowerSploit. Retrieved February 6, 2018.
- PowerShellMafia. (2012, May 26). PowerSploit - A PowerShell Post-Exploitation Framework. Retrieved February 6, 2018.
- Jazi, H. (2021, June 1). Kimsuky APT continues to target South Korean government using AppleSeed backdoor. Retrieved June 10, 2021.
- BishopFox. (n.d.). Sliver. Retrieved September 15, 2021.
- Kervella, R. (2019, August 4). Cross-platform General Purpose Implant Framework Written in Golang. Retrieved July 30, 2021.
- McKeague, B. et al. (2019, April 5). Pick-Six: Intercepting a FIN6 Intrusion, an Actor Recently Tied to Ryuk and LockerGoga Ransomware. Retrieved April 17, 2019.
- Lambert, T. (2020, May 7). Introducing Blue Mockingbird. Retrieved May 26, 2020.
- Baumgartner, K., Golovkin, M.. (2015, May). The MsnMM Campaigns: The Earliest Naikon APT Campaigns. Retrieved April 10, 2019.
- Kaspersky Lab. (2015, June 11). The Duqu 2.0. Retrieved April 21, 2017.
- Schroeder, W., Warner, J., Nelson, M. (n.d.). Github PowerShellEmpire. Retrieved April 28, 2016.
- Microsoft TechNet. (n.d.). Runas. Retrieved April 21, 2017.
- Brower, N., Lich, B. (2017, April 19). Replace a process level token. Retrieved December 19, 2017.
- Brower, N., Lich, B. (2017, April 19). Create a token object. Retrieved December 19, 2017.
- Dupuy, T. and Faou, M. (2021, June). Gelsemium. Retrieved November 30, 2021.
- Roccio, T., et al. (2021, April). Technical Analysis of Cuba Ransomware. Retrieved June 18, 2021.
- SentinelLabs. (2022, September 22). Metador Technical Appendix. Retrieved April 4, 2023.
- Rufus Brown, Van Ta, Douglas Bienstock, Geoff Ackerman, John Wolfram. (2022, March 8). Does This Look Infected? A Summary of APT41 Targeting U.S. State Governments. Retrieved July 8, 2022.
- Nettitude. (2018, July 23). Python Server for PoshC2. Retrieved April 23, 2019.
- Lelli, A. (2010, January 11). Trojan.Hydraq. Retrieved February 20, 2018.
- Gilbert Sison, Rheniel Ramos, Jay Yaneza, Alfredo Oliveira. (2018, January 15). KillDisk Variant Hits Latin American Financial Groups. Retrieved January 12, 2021.
- Hanel, A. (2019, January 10). Big Game Hunting with Ryuk: Another Lucrative Targeted Ransomware. Retrieved May 12, 2020.
- Del Fierro, C. Kessem, L.. (2020, January 8). From Mega to Giga: Cross-Version Comparison of Top MegaCortex Modifications. Retrieved February 15, 2021.
- Microsoft Defender Threat Intelligence. (2022, June 13). The many lives of BlackCat ransomware. Retrieved December 20, 2022.
- Brandt, Andrew. (2022, July 14). BlackCat ransomware attacks not merely a byproduct of bad luck. Retrieved December 20, 2022.
Связанные риски
Каталоги
Мы используем cookie-файлы, чтобы получить статистику, которая помогает нам улучшить сервис для вас с целью персонализации сервисов и предложений. Вы может прочитать подробнее о cookie-файлах или изменить настройки браузера. Продолжая пользоваться сайтом, вы даёте согласие на использование ваших cookie-файлов и соглашаетесь с Политикой обработки персональных данных.