Modify Cloud Resource Hierarchy: Leave AWS Organization
AWS Specific Sub-Technique
Other sub-techniques of Modify Cloud Resource Hierarchy (2)
ID | Name |
---|---|
T1666.A001 | Create or Invite AWS Account |
T1666.A002 | Leave AWS Organization |
AWS Specific Content
A prerequisite for this technique is that a threat actor has already gained access to the Management account within in AWS Organization as well as control of an AWS identity with the permissions to perform the actions in the Management account in the Event Name(s) section.
With access to an AWS identity that has the appropriate permissions, threat actors may make the
organizations:LeaveOrganizations
API call in an AWS account against the AWS Organization to which it is tied. Once this action is completed, the standalone member account would no longer be subject to the Service Control Policies, guardrails, or restrictions imposed upon it by the AWS Organization management account. This will allow a threat actor to manage and have access to the resources and the data accessible through the AWS account.Detection
AWS Specific Content
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
organizations:LeaveOrganization
.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.
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.
You can also regularly audit the AWS Organizations console for suspicious or unauthorized activity.
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).
An example SCP that helps prevent member accounts from leaving an organization and allows use of some desired AWS services is presented below:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:*",
"cloudwatch:*",
"organizations:*"
],
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "organizations:LeaveOrganization",
"Resource": "*"
}
]
}
Additional strategies for implementing SCPs is available in this guidance.
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.