Resource Hijacking: Compute Hijacking - EC2 Use
AWS Specific Sub-Technique
Other sub-techniques of Resource Hijacking (7)
ID | Name |
---|---|
T1496.004 | Cloud Service Hijacking |
T1496.A007 | Cloud Service Hijacking - Bedrock LLM Abuse |
T1496.A001 | Cloud Service Hijacking - SES Messaging |
T1496.001 | Compute Hijacking |
T1496.A008 | Compute Hijacking - EC2 Use |
T1496.A006 | Compute Hijacking - ECS |
T1496.003 | SMS Pumping |
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 the action in the Event Name(s) section
With access to an AWS identity that has the appropriate permissions, threat actors can create a new computing instance to hijack resources or evade defenses. Creating a new instance may also allow a threat actor to carry out unauthorized activity within an environment without affecting the execution of current running instances.
This technique is related to the Modify Cloud Compute Infrastructure > Create Cloud Instance technique and is used to additionally identify what type of cloud instance was created.
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
ec2:RunInstances
.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.
If an EC2 instance is created for the purposes of resource hijacking and Amazon GuardDuty is configured within the AWS account, a GuardDuty finding may be created when the instance is used. For example, the CryptoCurrency:EC2/BitcoinTool.B finding is used to identify when an EC2 instance in the environment is querying an IP address assocated with Bitcoin or other cryptocurrency-related activity. GuardDuty Runtime Protection and GuardDuty Malware Protection provide additional layers of detection.
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.