Technique.View on attack.mitre.org
Adversaries can steal application access tokens as a means of acquiring credentials to access remote systems and resources.
Application access tokens are used to make authorized API requests on behalf of a user or service and are commonly used as a way to access resources in cloud and container-based applications and software-as-a-service (SaaS). Adversaries who steal account API tokens in cloud and containerized environments may be able to access data and perform actions with the permissions of these accounts, which can lead to privilege escalation and further compromise of the environment.
For example, in Kubernetes environments, processes running inside a container may communicate with the Kubernetes API server using service account tokens. If a container is compromised, an adversary may be able to steal the container’s token and thereby gain access to Kubernetes API commands.
Similarly, instances within continuous-development / continuous-integration (CI/CD) pipelines will often use API tokens to authenticate to other services for testing and deployment. If these pipelines are compromised, adversaries may be able to steal these tokens and leverage their privileges.
In Azure, an adversary who compromises a resource with an attached Managed Identity, such as an Azure VM, can request short-lived tokens through the Azure Instance Metadata Service (IMDS). These tokens can then facilitate unauthorized actions or further access to other Azure services, bypassing typical credential-based authentication.
Token theft can also occur through social engineering, in which case user action may be required to grant access. OAuth is one commonly implemented framework that issues tokens to users for access to systems. An application desiring access to cloud-based services or protected APIs can gain entry using OAuth 2.0 through a variety of authorization protocols. An example commonly-used sequence is Microsoft's Authorization Code Grant flow. An OAuth access token enables a third-party application to interact with resources containing user data in the ways requested by the application without obtaining user credentials.
Adversaries can leverage OAuth authorization by constructing a malicious application designed to be granted access to resources with the target user's OAuth token. The adversary will need to complete registration of their application with the authorization server, for example Microsoft Identity Platform using Azure Portal, the Visual Studio IDE, the command-line interface, PowerShell, or REST API calls. Then, they can send a Spearphishing Link to the target user to entice them to grant access to the application. Once the OAuth access token is granted, the application can gain potentially long-term access to features of the user account through Application Access Token.
Application access tokens may function within a limited lifetime, limiting how long an adversary can utilize the stolen token. However, in some cases, adversaries can also steal application refresh tokens, allowing them to obtain new access tokens without prompting the user.
Rules on DetectionCode tagged with T1528.
| Rule | Level | Log source |
|---|---|---|
| HackTool - Koh Default Named Pipe | critical | windows / pipe_created |
| Anomalous Token | high | azure / NULL |
| Anonymous IP Address | high | azure / NULL |
| App Granted Microsoft Permissions | high | azure / NULL |
| Application URI Configuration Changes | high | azure / NULL |
| Delegated Permissions Granted For All Users | high | azure / NULL |
| Primary Refresh Token Access Attempt | high | azure / NULL |
| Renamed BrowserCore.EXE Execution | high | windows / process_creation |
| Suspicious Teams Application Related ObjectAcess Event | high | windows / NULL |
| End User Consent Blocked | medium | azure / NULL |
| Microsoft Teams Sensitive File Access By Uncommon Applications | medium | windows / file_access |
| Potentially Suspicious Command Targeting Teams Sensitive Files | medium | windows / process_creation |
| Potentially Suspicious JWT Token Search Via CLI | medium | windows / process_creation |
| End User Consent | low | azure / NULL |
| Rule | Type | Risk | Data source |
|---|---|---|---|
| Azure AD Device Code Authentication | TTP | NULL | Azure Active Directory |
| Azure AD OAuth Application Consent Granted By User | TTP | NULL | Azure Active Directory Consent to application |
| Azure AD User Consent Blocked for Risky Application | TTP | NULL | Azure Active Directory Consent to application |
| Azure AD User Consent Denied for OAuth Application | TTP | NULL | Azure Active Directory Sign-in activity |
| O365 File Permissioned Application Consent Granted by User | TTP | NULL | O365 Consent to application. |
| O365 Mail Permissioned Application Consent Granted by User | TTP | NULL | O365 Consent to application. |
| O365 User Consent Blocked for Risky Application | TTP | NULL | O365 Consent to application. |
| O365 User Consent Denied for OAuth Application | TTP | NULL | O365 |
| Windows Cloud Sensitive File Read Access By Uncommon Process | Anomaly | NULL | Windows Event Log Security 4663 |
| Used by | Procedure example |
|---|---|
| GroupAPT28 | APT28 has used several malicious applications to steal user OAuth access tokens including applications masquerading as "Google Defender" "Google Email Protection," and "Google Scanner" for Gmail users. They also targeted Yahoo users with applications masquerading as "Delivery Service" and "McAfee Email Protection". |
| GroupAPT29 | APT29 uses stolen tokens to access victim accounts, without needing a password. |
| GroupShinyHunters | ShinyHunters has stolen valid OAuth credentials from DevOps personnel or a company GitHub repository. Additionally, ShinyHunters has stolen application access tokens to access cloud services and to bypass authentication mechanisms. |
| GroupTeamPCP | TeamPCP has used malware to steal access tokens from targeted cloud and developer environments. |
| Used by | Procedure example |
|---|---|
| ToolAADInternals | AADInternals can steal users’ access tokens via phishing emails containing malicious links. |
| MalwareCanisterWorm | CanisterWorm has gathered cloud access tokens. |
| MalwareKali365 | Kali365 has obtained OAuth access and refresh tokens by deceiving victims into completing actor-initiated device authorization requests, and intercepting authentication sessions with legitimate identity providers through adversary-in-the-middle reverse proxy infrastructure. |
| MalwareMini Shai-Hulud | Mini Shai-Hulud has stolen application access tokens and other tokens to include those associated with CI/CD. |
| ToolPeirates | Peirates gathers Kubernetes service account tokens using a variety of techniques. |
| MalwareShai-Hulud | Shai-Hulud has stolen access tokens and API tokens from with CI/CD pipeline solutions and repositories. |
| MalwareTeamPCP Cloud Stealer | TeamPCP Cloud Stealer can read runner.worker process memory to extract plaintext tokens. |
| ToolTruffleHog | TruffleHog has gathered access tokens and API tokens from CI/CD pipeline solutions and repositories. |
| Used by | Procedure example |
|---|---|
| CampaignLeviathan Australian Intrusions | Leviathan abused access to compromised appliances to collect JSON Web Tokens (JWTs), used for creating virtual desktop sessions, during Leviathan Australian Intrusions. |
Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.