Account Discovery: Cloud Account
Other sub-techniques of Account Discovery (2)
ID | Name |
---|---|
T1087.004 | Cloud Account |
Adversaries may attempt to get a listing of cloud accounts. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application.
With authenticated access there are several tools that can be used to find accounts. The Get-MsolRoleMember
PowerShell cmdlet can be used to obtain account names given a role or permissions group in Office 365. The Azure CLI (AZ CLI) also provides an interface to obtain user accounts with authenticated access to a domain. The command az ad user list
will list all users within a domain.
The AWS command aws iam list-users
may be used to obtain a list of users in the current account while aws iam list-roles
can obtain IAM roles that have a specified path prefix. In GCP, gcloud iam service-accounts list
and gcloud projects get-iam-policy
may be used to obtain a listing of service accounts and users in a project.
AWS Specific Content
A prerequisite for this technique is that a threat actor has already gained control of an AWS identity with the permissions to perform discovery on IAM users.
In AWS, an AWS account is a container where you can create and manage your AWS resources. An account is also a unique identity, typically associated with a user, that grants access to a specific system or resource, for example, an IAM user. This technique is used when a threat actor identifies and enumerates the users and roles that are present within an AWS account, usually performed with the
iam:ListUsers
or iam:ListRoles
action. The threat actor can then use knowledge about the users and roles in attempts to further their objectives.Detection
Monitor processes, command-line arguments, and logs for actions that could be taken to gather information about cloud accounts, including the use of calls to cloud APIs that perform account discovery. System and network discovery techniques normally occur throughout an operation as an adversary learns the environment, and also to an extent in normal network operations. Therefore discovery data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as Lateral Movement, based on the information obtained.AWS Specific Content
Amazon GuardDuty has detections in place for when an API commonly used to discover resources were invoked in an anomalous way.
When this technique is used by the threat actor, actions taken by the threat actor using the credentials obtained will be logged in CloudTrail. You can use the Event history page in the AWS CloudTrail console to view the last 90 days of management events in an AWS Region for the events listed in the AWS CloudTrail Event Name(s) section, such as
iam:ListUsers
.A separate CloudTrail trail will give you an ongoing record of events in your AWS account past 90 days and can be configured to log events in multiple regions. You can also review events using the console as well as the AWS CLI.
When looking through Event history for events related to this technique, you should note that the actions are non-mutable and are therefore listed as
readOnly
, which means that the Events will not be visible if there are filters set to show only mutable actions.It is also possible to create a CloudWatch metric filter to watch for when specific AWS API calls are used and perform notification actions if logged, and additionally configure CloudWatch to automatically perform an action in response to an alarm.
Mitigation
AWS Specific Content
You can make sure that principals are scoped with the least-privileged permissions necessary to perform duties, limiting the ability to perform unauthorized actions in an AWS account when not required. One possible method of applying the principle of least-privileged permissions is to use Service Control Policies to restrict the maximum available permissions for the IAM users and IAM roles within your AWS Organizations accounts (note - you should test SCPs in a development environment before deploying them in production).
You can also use IAM Access Analyzer to regularly review and verify access and manage permissions across your AWS environment, which will highlight AWS identities with excessive permissions and the actions performed by those identities.