Incident response: Amazon EC2 instance Auto Scaling Groups compromised, how to resolve
STEP ONE: Detach the instance from its auto scaling group and tag it:
To detach an instance from an existing Auto Scaling group
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/, and choose Auto Scaling Groups from the navigation pane.
Select the check box next to your Auto Scaling group.
A split pane opens up in the bottom of the page.
On the Instance management tab, in Instances, select an instance and choose Actions, Detach.
When prompted for confirmation, type detach to confirm removing the specified instance from the Auto Scaling group, and then choose Detach instance.
How to add a tag
select the instance
click on action
select instance setting
click on manage tag
click add new tag
click on save
STEP 2: Create a new security group that disallows both inbound and outbound traffic.
To create a security group using the console
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
In the navigation pane, choose Security groups.
Choose Create security group.
Enter a name and description for the security group. You cannot change the name and description of a security group after it is created.
From VPC, choose the VPC.
Do not add any inbound or outbound rule, delete any rule which was automatically created.
You can add tags now, or you can add them later. To add a tag, choose Add new tag and enter the tag key and value.
Choose Create security group.
STEP 3: Remove the instance current security group and replace it with the group that blocks inbound and outbound traffic
How to remove
select the instance
click on Action
Select security
Click on change security group
Select the older sg and click on remove
search for the new sg you created and select
click on add new sg.
click on save
STEP 4: Remove the IAM role from the instance (ensure no role is associated)
To detach an IAM role from an instance
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, choose Instances.
Select the instance, choose Actions, Security, Modify IAM role.
For IAM role, choose No IAM Role. Choose Save.
In the confirmation dialog box, enter Detach, and then choose Detach.
STEP 5: Snapshot the instance's root volume for later analysis
To create a snapshot
Select the instance
click on storage
click on the volume associated to the instance
select action
select create snapshot
STEP 6: Create an AMI of the instance for later analysis.
Compiled by
Azeez halimat