How to Reduce On-Premises-to-Cloud Lateral-Movement Risks

Summary
The guide explains how attackers can pivot from compromised on-premises devices to AWS, Azure, and GCP using cached credentials, cloud keys, SSH keys, or Azure PRTs, and recommends safer authentication and device-hardening measures.
Key points
- Cloud keys, cached access and refresh tokens, service-principal secrets, and service-account keys on compromised devices can provide access to cloud resources; some credentials may remain valid for long periods or lack expiration.
- Compromised SSH private keys, combined with connection details in known_hosts files, may help attackers access cloud compute instances.
- The article describes Pass-the-PRT and Pass-the-Cookie methods for abusing Azure Primary Refresh Tokens on Azure-integrated devices; it says the former requires local administrator privileges, while the latter targets the compromised user’s PRT cookie.
- Recommended device protections include restricting local administrator access, enabling the ASR rule that blocks credential theft from LSASS, and using strong passwords and MFA.
- The guide recommends reducing reliance on long-lived credentials through options such as AWS IAM Identity Center, cloud shells, Azure service-principal certificates, and temporary credentials.
- It advises limiting cloud session or refresh-token duration and setting expiration for newly created GCP service-account keys.
- For compute-instance access, it recommends AWS SSM or GCP IAP with IAM permissions and centralized activity logging instead of SSH or RDP authentication.
Article Details
- Defense Focus
- Reduce on-premises-to-cloud lateral movement by preventing theft and misuse of cached cloud credentials, tokens, private keys, and Primary Refresh Tokens (PRTs).
- Detection Methods
- Use AV/EDR to detect or block attempts to access LSASS and steal PRTs; the article notes Pass-the-PRT can be detected or blocked by many AV/EDR solutions.
- Deploy the LSASS credential-theft Attack Surface Reduction (ASR) rule in Audit mode first and review audit results before enabling Block mode.
- Use centralized AWS SSM or GCP IAP activity logs to investigate who accessed compute instances, when, and from where.
- Data Sources
- LSASS process-access telemetry
- AV/EDR alerts
- Windows ASR audit events
- AWS SSM and GCP IAP centralized user-activity logs
- Rule Types
- Windows Attack Surface Reduction rule for blocking credential stealing from LSASS
- PowerShell Add-MpPreference configuration for ASR AuditMode or Enabled actions
- Platforms
- Windows 10 or later
- Windows Server 2016 or later
- AWS
- Azure
- GCP
- Defensive Actions
- Restrict local administrator privileges on AAD-joined, registered, and hybrid-joined devices.
- Initially configure the LSASS credential-stealing ASR rule in Audit mode; review compatibility and then enable Block mode.
- Require strong passwords and MFA for AAD users, including through Windows Hello for Business.
- Replace long-term AWS access keys with temporary credentials through AWS IAM Identity Center or use AWS CloudShell where appropriate.
- Upgrade Azure CLI versions below 2.30.0; reduce refresh-token lifetime with Conditional Access and prefer service-principal certificates over secrets.
- Set GCP refresh-token session limits and expiration dates for service-account keys; use user credentials for local development where appropriate.
- Use Azure Cloud Shell or GCP Cloud Shell where appropriate to reduce local token caching.
- Prefer AWS SSM or GCP IAP with IAM permissions and centralized activity logging over SSH or RDP access to compute instances.
MITRE ATT&CK
T1003.001 · LSASS MemoryThe described Pass-the-PRT procedure uses Mimikatz to extract a PRT and encrypted session key from LSASS memory.T1021.004 · SSHThe article describes using a compromised SSH private key to authenticate to a cloud compute instance and move into the cloud environment.T1059.001 · PowerShellThe Pass-the-Cookie procedure uses a PowerShell script to retrieve a PRT cookie through BrowserCore.exe.T1078.004 · Cloud AccountsThe article describes authenticating to cloud resources as users or service principals using stolen cloud credentials and tokens.T1528 · Steal Application Access TokenThe article describes stealing cached cloud access or refresh tokens, including PRTs, to obtain or use access to cloud resources.T1539 · Steal Web Session CookieThe Pass-the-Cookie procedure directly steals a local AAD user's PRT cookie.T1550.001 · Application Access TokenThe described attack uses stolen PRT or other cloud access-token material to authenticate to cloud resources.T1550.004 · Web Session CookieThe attacker injects a generated PRT cookie into a browser session to authenticate as the AAD user.T1552.001 · Credentials In FilesThe article describes attackers obtaining credentials from cleartext local files, including AWS credentials, cached Azure and GCP tokens or secrets, and GCP credentials.db.T1552.004 · Private KeysAttackers may obtain SSH private keys associated with cloud compute instances or cached GCP service-account private keys from compromised on-premises devices.
Threat Actors
LAPSUS$The article says LAPSUS$ conducted reconnaissance and discovery to obtain cloud credentials for access to an organization's cloud infrastructure.MERCURYThe article describes MERCURY, linked to the Iranian government, gaining access to a hybrid environment and discovering credentials to extend access to cloud infrastructure.
Vendors
Amazon Web Serviceson-prem computer. Some keys need to be downloaded manually and stored locally in a specific file such as AWS user access keys, whereas others like AAD/GCP user access/refresh tokens and AAD service principal secretsGoogleUpon authenticating to GCP from an on-prem machine with Google user credentials via the Gcloud Command-Line Interface (e.g. by running the gcloud auth login command), the generated access and refresh tokens are cachedMicrosoftAccording to the official Microsoft documentation, “the default lifetime of an access token is variable. When issued, an access token’s default lifetime is assigned a random value ranging between 60-90 minutes (75
Products
AWS CLIOn-prem users tend to use these AWS cloud keys to authenticate and execute cloud APIs on behalf of the IAM identity via the AWS CLI. AWS CloudShellLeverage AWS CloudShell AWS IAM Identity CenterUtilize AWS IAM Identity Center AWS SSMAuthenticating to compute instances via AWS SSM or GCP IAP may provide a more secure, centralized, and streamlined way to manage infrastructure access. These services enable you to leverage IAM to define granularAzure CLIOnce an AAD user has been authenticated and has signed in to an Azure subscription via the Azure CLI from an on-prem machine (e.g. by running the az login command), the generated access token and refresh token areAzure Cloud ShellUtilize Azure Cloud Shell Gcloud CLILike with Azure, the cached access and refresh tokens allow the user to perform multiple Gcloud CLI operations without re-authenticating. When the access token expires, the Gcloud CLI automatically uses the cachedGCP Cloud ShellUse GCP Cloud Shell GCP IAPAuthenticating to compute instances via AWS SSM or GCP IAP may provide a more secure, centralized, and streamlined way to manage infrastructure access. These services enable you to leverage IAM to define granularMicrosoft Authentication Library (MSAL)current version as of this writing is 2.46.0). Starting with v2.30.0, Azure CLI uses Microsoft Authentication Library (MSAL) as the underlying authentication library; previous versions use Azure Active DirectoryMicrosoft Intuneuse of Windows Hello for Business on Windows 10 or Windows 11 devices at the time of enrollment in Microsoft Intune, or alternatively, using an Identity protection profile to manage Windows Hello for Business onWindows DefenderCons: Requires local admin privileges; can easily be detected or blocked by most AV/EDR solutions (including the built-in Microsoft Windows Defender).
