Skip to content

How to reliably detect all root user activity (including ConsoleLogin) across Regions with minimal setup?

0

Hi all,

We need to reliably detect all root user activity in a customer-owned AWS account, and we'd like advice on the simplest design to achieve this.

[Environment]

  • Single AWS account (not using AWS Organizations)
  • CloudTrail: one multi-Region trail, home Region ap-northeast-1 (Tokyo), logs delivered to a single S3 bucket
  • We do not use us-east-1 for any workloads or monitoring resources
  • Current detection: EventBridge rule + SNS topic in [Region(s)] to notify on root sign-in

[Constraints]

  • This AWS account and its resources (S3 buckets, CloudTrail, etc.) are owned by our customer. We operate and monitor it as a service provider.
  • Because these are customer assets, we want to keep the monitoring setup as simple as possible and avoid adding resources across multiple Regions or complex configurations such as cross-Region event forwarding with additional IAM roles.
  • Ideally, we'd like to keep all monitoring resources in ap-northeast-1 with a single detection rule and a single notification path.

[What we observed] During testing, a colleague observed root ConsoleLogin events recorded in [Region A / Region B / Region C] instead of only us-east-1.

[What the documentation says] The CloudTrail User Guide states that root user sign-in events are recorded in us-east-1, while IAM user sign-ins via the global endpoint may be recorded in us-east-2, eu-north-1, or ap-southeast-2 when an account alias cookie is present: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-aws-console-sign-in-events.html

[Questions]

  1. What is the simplest and most maintainable way to reliably detect ALL root user activity (sign-in and API calls), regardless of which Region the events are recorded in?
  2. Is a CloudWatch Logs metric filter on the multi-Region trail's log group (in ap-northeast-1) a recommended approach for this? Any caveats regarding delivery latency or cost?
  3. Is it expected that root user ConsoleLogin events are recorded in Regions other than us-east-1? Has this behavior changed recently?
  4. If we use EventBridge instead, do we need a rule in every Region where root events may be recorded, or is there a simpler pattern without cross-Region forwarding?

Thanks in advance!

2 Answers
0

May considering this:

  1. AWS CloudTrail

https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-aws-console-sign-in-events.html

  1. Use CloudWatch Logs to create metric filters on CloudTrail logs to detect specific events such as ConsoleLogin or Root API calls.

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/MonitoringLogData.html

EXPERT

answered a month ago

0

There's no straightforward way to log all the actions the root user may take. Various services either only emit logs in their own, service-specific ways, or don't log some actions at all.

As just one example, to log emails sent via Amazon SES, a "configuration set" must be created in the Amazon SES configuration in each enabled region that hosts SES, and then ensuring that emails are sent in the context of one of the identities associated with the configuration set. Enforcing that for the account root user can only be done with an SCP (service control policy) configured in AWS Organizations attached to the account or one of its parent OUs. SES is just one of many services that the root user can use that don't support a universal "log all actions in all regions to a central logging destination" type of configuration.

If the intent is to set up a reliable detection for the root user's credentials being compromised, then there is no universal, cross-service way of doing that. The recommended approach starts with either creating a new, dedicated account to serve as the management account of an AWS Organization or dedicating an existing account, such as the centralised billing account, only to that single use. An org is created in AWS Organizations in that dedicated management account, followed by all the member accounts being invited to join the organisation. Once all the workload accounts are members of the new organisation, root user credentials should be deleted from all the workload accounts. The management account of the AWS Organization can delete the root credentials with this feature: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-enable-root-access.html

If root credentials are broadly used and cannot be quickly deleted, then the next-best first step is to apply one or more SCPs (service control policy) to the workload accounts that use root credentials: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html. SCPs apply to all actions taken in an account, including those taken by the root user, so they can be used to restrict the use of root credentials to those services and actions that are known to be used with root credentials. It would also be very valuable to restrict their use to legitimate IP addresses and VPC endpoints through which API calls are made by root. Once SCPs are configured to restrict actions to the relevant services, then you could determine which logging alternatives work best for those services.

The mid-term goal should be to use the logs to determine what root credentials are used for and to refactor each case to use IAM roles or IAM users instead (or federated logins, if any human user is logging on as root). Each IAM role/user should be configured with the proper permissions policies, and if possible, the identity-based policies attached to the roles/users should also include Deny statements to block access from outside expected IP addresses or VPC endpoints. There are good examples of network-based policy restrictions in this blog post: https://aws.amazon.com/blogs/security/establishing-a-data-perimeter-on-aws-allow-access-to-company-data-only-from-expected-networks/

Once all the identified uses for root credentials have been refactored to use IAM roles or IAM users (or federated sessions via IAM Identity Center for human users, if any human was logging on as root), you should set the SCP to block all actions by the root user, unless the request is being made with a special assumed root session from the management account. An example of how to configure an SCP to do this is in this documentation section: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-assumedroot. After the SCP is applied, anyone still logging on as root via the console will not be able to do anything. Once there are no legitimate uses left, the root credentials should be deleted from the workload accounts via the management account: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-enable-root-access.html

Despite the static, long-lived credentials of the root user having been deleted, the management account will still be able to perform the limited set of actions that are occasionally needed, by using the assumed root session feature. A typical situation where the root session is needed is if someone configured an S3 bucket policy that blocks access to everyone, including themselves; the root session can be used to delete the blocking bucket policy. A full list of the actions that the assumed root session can perform is here: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user-privileged-task.html

EXPERT

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.