Detect Steal Application Access Token in Google Chronicle
Adversaries may steal application access tokens as a means of acquiring credentials to access remote systems and resources. Application access tokens — including OAuth 2.0 tokens, Kubernetes service account tokens, cloud provider temporary credentials (Azure Managed Identity via IMDS, AWS STS instance role credentials, GCP service account tokens), and CI/CD pipeline secrets — authorize API requests on behalf of users or services. Token theft enables adversaries to impersonate legitimate identities, access cloud resources and SaaS platforms with the victim's permissions, and move laterally without requiring plaintext passwords. Real-world examples include APT29 stealing OAuth tokens via malicious application consent phishing, APT28 creating fraudulent OAuth apps masquerading as Google services, and threat actors exploiting compromised containers to extract Kubernetes service account tokens via the pod filesystem.
MITRE ATT&CK
- Tactic
- Credential Access
- Technique
- T1528 Steal Application Access Token
- Canonical reference
- https://attack.mitre.org/techniques/T1528/
YARA-L Detection Query
rule t1528_steal_application_access_token {
meta:
author = "Argus Detection Platform"
description = "Detects T1528 - Steal Application Access Token via IMDS queries, Kubernetes token reads, and OAuth token cache access"
severity = "HIGH"
priority = "HIGH"
mitre_attack_tactic = "Credential Access"
mitre_attack_technique = "T1528"
mitre_attack_url = "https://attack.mitre.org/techniques/T1528/"
false_positives = "Cloud VM agents, Kubernetes orchestration processes, cloud CLI toolchains"
version = "1.0"
events:
(
$e.metadata.event_type = "NETWORK_CONNECTION" or
$e.metadata.event_type = "FILE_OPEN" or
$e.metadata.event_type = "FILE_READ"
)
(
// Vector 1: Cloud IMDS token requests from non-native processes
(
$e.metadata.event_type = "NETWORK_CONNECTION" and
$e.target.ip = "169.254.169.254" and
(
re.regex($e.network.http.request_url, `metadata/identity`) or
re.regex($e.network.http.request_url, `iam/security-credentials`) or
re.regex($e.network.http.request_url, `computeMetadata/v1/instance/service-accounts`) or
re.regex($e.network.http.request_url, `metadata/instance`)
) and
not re.regex($e.principal.process.file.full_path, `(?i)(waagent\.exe|WindowsAzureGuestAgent\.exe|WaAppAgent\.exe|MonAgentCore\.exe|HealthService\.exe|MMAExtensionHeartbeatService\.exe|AzureAttestService\.exe|azd\.exe|AzureCLI\.exe)`)
) or
// Vector 2: Kubernetes service account token reads by unexpected processes
(
($e.metadata.event_type = "FILE_OPEN" or $e.metadata.event_type = "FILE_READ") and
(
re.regex($e.target.file.full_path, `/var/run/secrets/kubernetes\.io/serviceaccount`) or
re.regex($e.target.file.full_path, `/run/secrets/kubernetes\.io`) or
re.regex($e.target.file.full_path, `/var/run/secrets/tokens`)
) and
not re.regex($e.principal.process.file.full_path, `(?i)(kubelet|pause|containerd-shim|containerd-shim-runc-v2|runc|cri-o|dockerd)`)
) or
// Vector 3: OAuth and cloud CLI token cache file access by unexpected processes
(
($e.metadata.event_type = "FILE_OPEN" or $e.metadata.event_type = "FILE_READ") and
(
re.regex($e.target.file.full_path, `(?i)(msal_token_cache\.(json|bin)|accessTokens\.json|application_default_credentials\.json|azureProfile\.json|\.git-credentials|TokenCache\.dat)`) or
re.regex($e.target.file.full_path, `\.config/gcloud/.+\.json`) or
re.regex($e.target.file.full_path, `/\.azure/.+\.json`)
) and
not re.regex($e.principal.process.file.full_path, `(?i)(gcloud(\.exe)?$|aws(\.exe)?$|az(\.exe)?$|gh(\.exe)?$|git(\.exe)?$|terraform(\.exe)?$|kubectl(\.exe)?$|Code\.exe$|^code$)`)
)
)
condition:
$e
} Google Chronicle YARA-L 2.0 rule detecting T1528 application access token theft across three behavioral vectors using the Unified Data Model (UDM): (1) NETWORK_CONNECTION events where target.ip is 169.254.169.254 and the HTTP request URL targets credential-bearing IMDS paths for Azure Managed Identity, AWS IAM instance role, or GCP service account tokens, from processes not in the native agent allowlist; (2) FILE_OPEN or FILE_READ events targeting Kubernetes service account token paths from non-orchestration processes; and (3) FILE_OPEN or FILE_READ events targeting OAuth and cloud CLI token cache files from processes outside the expected toolchain. The rule uses re.regex() with backtick-quoted patterns for case-insensitive matching where (?i) is prepended. Requires UDM-normalized endpoint events ingested via Chronicle Forwarder or EDR integration (CrowdStrike, Microsoft Defender, SentinelOne).
Data Sources
Required Tables
False Positives & Tuning
- Azure VM extensions and the Windows Azure Guest Agent legitimately contact 169.254.169.254 for managed identity token refresh — the exclusion regex must match exact binary names in your cloud environment, including full paths like /usr/sbin/waagent on Linux
- HashiCorp Vault agent injector and AWS IAM Roles for Service Accounts (IRSA) mechanisms cause legitimate IMDS traffic from workload processes — add verified workload binary names to the not re.regex() exclusion for each environment tier
- Developer containers using Telepresence, minikube, or KIND (Kubernetes in Docker) environments frequently access service account tokens as part of local cluster authentication — correlate principal.ip with known developer subnet ranges before escalating
Other platforms for T1528
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Query Azure IMDS Endpoint for Managed Identity Token
Expected signal: Sysmon Event ID 3: Network Connection from powershell.exe to 169.254.169.254:80. DeviceNetworkEvents in MDE: RemoteIP=169.254.169.254, InitiatingProcessFileName=powershell.exe. The RemoteUrl field will contain the metadata identity path.
- Test 2Read Kubernetes Service Account Token from Pod Filesystem
Expected signal: Linux auditd syscall audit event for openat/read on /var/run/secrets/kubernetes.io/serviceaccount/token with the process name (cat or the shell). Sysmon for Linux Event ID 11 (if deployed) for file access. The token value (JWT) will be visible in any memory or command output capture.
- Test 3Enumerate and Exfiltrate Azure CLI Token Cache
Expected signal: Sysmon Event ID 11: File access/creation event with TargetFilename matching *msal_token_cache.json and Image=powershell.exe. DeviceFileEvents in MDE: FileName=msal_token_cache.json, ActionType=FileRead or FileAccessed, InitiatingProcessFileName=powershell.exe.
- Test 4Register Malicious OAuth App and Simulate Consent Phishing Link
Expected signal: Azure AD AuditLogs OperationName='Add application' followed by 'Update application' with permissions modification. The registered app will appear in AuditLogs with the requesting user's UPN and source IP. If a test user clicks the generated consent URL, AuditLogs will show OperationName='Consent to application' with the scopes granted.
References (13)
- https://attack.mitre.org/techniques/T1528/
- https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-use-vm-token
- https://posts.specterops.io/managed-identity-attack-paths-part-1-automation-accounts-82667d17187a
- https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
- https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
- https://www.amnesty.org/en/latest/research/2019/08/evolving-phishing-attacks-targeting-journalists-and-human-rights-defenders-from-the-middle-east-and-north-africa/
- https://blog.trendmicro.com/trendlabs-security-intelligence/pawn-storm-abuses-open-authentication-advanced-social-engineering-attacks
- https://auth0.com/blog/why-should-use-accesstokens-to-secure-an-api/
- https://auth0.com/learn/refresh-tokens
- https://web.archive.org/web/20220316130828/https://www.cidersecurity.io/top-10-cicd-security-risks/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1528/T1528.md
- https://github.com/danielmiessler/SecLists
- https://github.com/AonCyberLabs/PMapper
Unlock Pro Content
Get the full detection package for T1528 including response playbook, investigation guide, and atomic red team tests.