AWS Root Account Persistence via CreateLoginProfile
Adversaries with temporary root access may invoke the CreateLoginProfile API without a username to establish persistent console password access for the AWS root principal.
Adversaries who obtain temporary elevated privileges in an AWS environment may attempt to establish long-term persistence by creating or resetting the console login profile for the root account. By executing the CreateLoginProfile API call while operating under a temporary root session (e.g., via AssumeRoot), and omitting the userName parameter, the attacker effectively assigns a password to the root user principal itself. This grants the attacker persistent administrative access to the AWS Management Console that remains valid even after the original temporary access keys or tokens used to gain entry are rotated, disabled, or expire. Because the root user possesses unrestricted privileges across the entire account, this activity represents a critical security incident necessitating immediate containment and credential rotation. Defenders should monitor for CreateLoginProfile events where the user identity is type 'Root' and the request parameters lack a specified username.
Attack Chain
- The attacker gains initial access to temporary AWS credentials through techniques such as phishing, compromised access keys, or insecure environment variables.
- The attacker performs discovery to identify available privileges, eventually leveraging a method to assume a root or highly privileged session (e.g.,
AssumeRoot). - The attacker identifies that they have sufficient IAM permissions to perform administrative actions, specifically
iam:CreateLoginProfile. - The attacker executes the
CreateLoginProfileAPI call against the AWS IAM endpoint. - The attacker omits the
userNameparameter in the request, causing AWS to apply the login profile to the root user. - The attacker sets a known password for the root account, effectively establishing a persistent entry point.
- The attacker authenticates to the AWS Management Console using the newly created root password to maintain ongoing administrative access.
Impact
Success in this attack provides the adversary with full, unrestricted administrative control over the entire AWS account. This allows for data exfiltration, resource destruction, the creation of additional backdoors, and the configuration of further persistence mechanisms. If undetected, this can lead to total account takeover, significant financial loss, and severe compliance violations.
Recommendation
- Deploy detection logic to monitor CloudTrail for
CreateLoginProfileevents initiated by the root user identity. - Correlate
CreateLoginProfileactivity with concurrentAssumeRootorConsoleLoginevents to identify the session used for the modification. - Audit all IAM policies to enforce least-privilege, specifically restricting
iam:CreateLoginProfileandiam:UpdateLoginProfilepermissions to only essential personnel. - Ensure that MFA is enforced for all root-level access and verify that no root access keys are active.
- If unauthorized modification is detected, immediately delete the login profile, rotate the root password, and invalidate all associated active sessions.
Immediate actions
Deploy the Sigma detection rule to monitor for root login profile creation.
Mitigations
Review and restrict iam:CreateLoginProfile permissions for all IAM users and roles.
Account manipulation (T1098)
Detection coverage 1
Detect AWS Root IAM Login Profile Creation
highDetects creation of a console login profile for the AWS account root user by checking for successful CreateLoginProfile events where the identity type is Root and no username is specified.
Detection queries are available on the platform. Get full rules →