# hkb-alert-root-console-login

Fires on: Any root user console sign-in, successful or not.

Run the [common pre-checks](/wiki/runbooks/#common-pre-checks) first.

## Symptoms
An email from `hkb master alert` saying the management account's root user tried to sign in, with the source IP and the result (`Success` or `Failure`).

## Pre-checks
1. Was a root task planned? The management account's root user is break-glass only: nothing in the build signs in as root, and member accounts have no root password at all (centralized root access).
2. Read the event as HKB-ReadOnly:
   `aws cloudtrail lookup-events --profile ro-hkb-master --region us-east-1 --lookup-attributes AttributeKey=EventName,AttributeValue=ConsoleLogin --max-results 5`
3. Note `sourceIPAddress`, `userAgent`, `additionalEventData.MFAUsed` and the result.

## Resolution
- **Planned, and the result was `Success`:** record the reason and the session's end in the change record. Nothing else to do.
- **Not planned, result `Failure`:** someone has the root email address and is guessing. Confirm the root user still has MFA and no access keys (`aws iam get-account-summary --profile ro-hkb-master`: `AccountMFAEnabled` 1, `AccountAccessKeysPresent` 0). Watch for repeats.
- **Not planned, result `Success`:** treat as a compromise. Reset the root password and the MFA device from the root email inbox, then read every CloudTrail event since the sign-in time for `userIdentity.type` `Root` and undo what it did. Organization policies, Identity Center and Control Tower changes each raise their own alert, so check those emails first.

## Post-checks
The control tests' management checks pass (`verify/hkb-verify.sh`), and no further root events appear in CloudTrail.

## Rollback
Nothing to roll back for a reviewed sign-in. A password or MFA reset can't be undone; record the new device in the break-glass notes.

## Alert details

| Property | Value |
| --- | --- |
| Runs in | the management account, us-east-1 |
| Email | From `hkb master alert`: `ROOT CONSOLE SIGN-IN in the management account at <time> from <ip>, result <result>.` |
| Source | `security/hkb-security-master-alerts.yaml`, resource `RootConsoleLoginRule` |

The event pattern, as deployed:

```yaml
EventPattern:
  source: [aws.signin]
  detail-type: [AWS Console Sign In via CloudTrail]
  detail:
    eventName: [ConsoleLogin]
    userIdentity:
      type: [Root]
```
