1. Resources
  2. Detection rules
  3. Windows Administrator Password Data Retrieved from EC2

Windows Administrator Password Data Retrieved from EC2 detection rules

An attacker with ec2:GetPasswordData retrieves the encrypted administrator password of Windows instances and, with the private key of their key pair, decrypts it and signs in to the hosts as the local administrator.

Platform
AWS
Severity
Medium
Log source
AWS CloudTrail
Last updated
MITRE ATT&CK technique
T1552Unsecured Credentials
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Permission to call ec2:GetPasswordData on a Windows instance and the private key of the key pair the instance was launched with.
Impact
The local administrator password of the Windows instance, which gives full control of the host and the credentials that software on it can reach.
Response
Change the local administrator password of every affected instance and contain the principal that retrieved the password data.
Mitigation
Grant ec2:GetPasswordData only to Windows administrators, change the generated password after first use, and keep key pair private keys out of shared places.
CloudTrail event
GetPasswordData

How the attack works

When a Windows instance boots for the first time, the EC2Config service or the EC2Launch scripts generate a password for its administrator account and encrypt it with the key pair the instance was launched with. GetPasswordData returns that encrypted password for a running Windows instance. AWS documents that decrypting it requires the corresponding key pair file, so the call is one half of a credential: the other half is the private key, which often sits in a code repository, on an administrator's workstation or in a shared store.

Attackers who hold AWS credentials call GetPasswordData for the instances they can see and keep what comes back for the moment they find the matching private key. GuardDuty names GetPasswordData among the APIs it watches for credential access (CredentialAccess:IAMUser/AnomalousBehavior). CloudTrail records the call as an EC2 management event from ec2.amazonaws.com with the caller in userIdentity, and the request names the instance (the InstanceId parameter of the API). One rule on this page reports every call, a threshold rule reports one principal calling it many times in a short time.

What an attacker needs

  • Credentials for a principal allowed to call ec2:GetPasswordData on the instance.
  • The private key of the key pair the instance was launched with, to decrypt the result.
  • A Windows instance whose generated administrator password is still in use, and a network path to the instance for the sign-in.

Impact

The local administrator password of the Windows instance, which gives an interactive sign-in with full control of the host, its data and the credentials that software on it can reach. The call does nothing visible on the instance, so the owner learns of it only from CloudTrail.

Detection rules

EC2 Windows Password Data Requested Repeatedly by One Principal

Counts GetPasswordData calls per principal. An administrator retrieves the generated password of a new Windows instance now and then. Five or more calls by one principal within 10 minutes look like someone collecting the encrypted administrator passwords of many instances, or trying instances one after another to see which return data. The count includes failed calls, which show probing. The count and the window are starting points to tune.

Fires when one userIdentity.arn has at least 5 matching events within 10 minutes.

Threshold ruleLevelMediumStatusExperimentalLog sourceAWS CloudTrail
title: EC2 Windows Password Data Request (Repeated Requests Base Event)
id: 45144c84-4ef2-4533-a802-abcab62927f9
name: aws_ec2_get_password_data
status: experimental
description: >-
  Base event of the threshold rule in this file. A GetPasswordData call from
  ec2.amazonaws.com, successful or not.
logsource:
  product: aws
  service: cloudtrail
detection:
  selection:
    eventSource: ec2.amazonaws.com
    eventName: GetPasswordData
  condition: selection
level: low
---
title: EC2 Windows Password Data Requested Repeatedly by One Principal
id: 3be25aa3-6a22-4946-bfff-16d72d3a57c4
status: experimental
description: >-
  Counts GetPasswordData calls per principal. An administrator retrieves the
  generated password of a new Windows instance now and then. Five or more
  calls by one principal within 10 minutes look like someone collecting the
  encrypted administrator passwords of many instances, or trying instances one
  after another to see which return data. The count includes failed calls,
  which show probing. The count and the window are starting points to tune.
references:
  - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html
  - https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html
author: Forestall
date: 2026-11-18
tags:
  - attack.credential-access
  - attack.t1552
correlation:
  type: event_count
  rules:
    - aws_ec2_get_password_data
  group-by:
    - userIdentity.arn
  timespan: 10m
  condition:
    gte: 5
falsepositives:
  - An administrator who sets up several new Windows instances at once, and tools that retrieve the password for each instance they launch. Exclude those roles after confirming them.
  - The values of 5 calls and 10 minutes are starting points, not tested limits. Measure how often your Windows administrators call GetPasswordData and adjust both.
level: medium

False positives

  • An administrator who sets up several new Windows instances at once, and tools that retrieve the password for each instance they launch. Exclude those roles after confirming them.
  • The values of 5 calls and 10 minutes are starting points, not tested limits. Measure how often your Windows administrators call GetPasswordData and adjust both.

EC2 Windows Administrator Password Data Retrieved

Detects GetPasswordData calls, which return the encrypted administrator password of a running Windows instance. With the private key of the key pair the instance was launched with, the caller can decrypt it and sign in to the instance as its local administrator. GuardDuty lists GetPasswordData among the APIs it watches for credential access. It also matches attempts that failed (errorCode present).

LevelLowStatusExperimentalLog sourceAWS CloudTrail
title: EC2 Windows Administrator Password Data Retrieved
id: c5c39f39-f33e-4330-8399-bc4ebbf954a9
status: experimental
description: >-
  Detects GetPasswordData calls, which return the encrypted administrator
  password of a running Windows instance. With the private key of the key pair
  the instance was launched with, the caller can decrypt it and sign in to the
  instance as its local administrator. GuardDuty lists GetPasswordData among
  the APIs it watches for credential access. It also matches attempts that
  failed (errorCode present).
references:
  - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html
  - https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html
author: Forestall
date: 2026-11-18
tags:
  - attack.credential-access
  - attack.t1552
logsource:
  product: aws
  service: cloudtrail
detection:
  selection:
    eventSource: ec2.amazonaws.com
    eventName: GetPasswordData
  condition: selection
falsepositives:
  - Administrators who retrieve the generated password to connect to a new Windows instance. Exclude the roles of the team that administers the Windows instances after confirming them.
level: low

False positives

  • Administrators who retrieve the generated password to connect to a new Windows instance. Exclude the roles of the team that administers the Windows instances after confirming them.

Triage

  • Identify the caller (userIdentity.arn), the source IP address and the user agent. Is the caller an administrator of Windows instances, calling from where that team works?
  • Read the instance of the request and check whether the caller's team owns it.
  • Count the instances the same principal requested password data for in a short time, and read errorCode. Calls for many instances, or many failed calls, look like collection.
  • Find the key pair the instance was launched with and where its private key is stored, to judge whether the caller could decrypt the result.
  • Where the Windows Security logs of the instance are collected, look for remote interactive sign-ins as the administrator after the call.

Response

Once the attack is confirmed:

  1. Change the local administrator password on every instance whose password data was retrieved without explanation, and end the remote sessions open on them.
  2. Contain the principal that made the calls by deactivating its access keys or revoking its role sessions.
  3. Treat the private key of the key pair as exposed if the caller could have it. Stop launching instances with that key pair and remove its copies.
  4. Review what happened on the affected instances after the call, and what their instance roles did in CloudTrail.

Mitigation

  • Grant ec2:GetPasswordData only to the administrators of the Windows instances, and leave it out of broad read and developer policies.
  • Change the local administrator password after the first sign-in, or manage local administrator passwords centrally, so that the generated password stops being the one that works.
  • Keep key pair private keys out of code repositories, images and shared drives, and store the ones you need in a secrets store with restricted access.
  • Connect to Windows instances with a method that does not depend on the generated password where you can, so that few people ever need GetPasswordData.

Frequently asked questions

Does GetPasswordData hand the attacker the password?

Not in clear text. AWS documents that the password is encrypted with the key pair specified at launch and that you must provide the corresponding key pair file to decrypt it. The call still deserves an alert, because private keys are often stored next to the credentials an attacker already holds, and the encrypted value can be kept until the key turns up.

Why can the call return nothing?

AWS documents that password generation and encryption can take a few minutes after launch, and that the call returns an empty string while the password is not yet available. The CloudTrail event is written either way, so an empty result does not mean that nobody asked.

Who calls GetPasswordData legitimately?

Administrators who retrieve the generated password to connect to a new Windows instance for the first time. A principal that retrieves it for many instances, for instances its team does not own, or from an unfamiliar address does not fit that pattern.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.