githubEdit

VPC

Security Group vs Network ACL

Feature / Behavior
Security Group
Network ACL

Level of operation

Instance level

Subnet level

Rule types supported

Allow rules only

Allow and deny rules

Statefulness

Stateful – return traffic automatically allowed regardless of rules

Stateless – return traffic must be explicitly allowed by rules

Rule evaluation

All rules evaluated before deciding whether to allow traffic

Rules processed in order starting with the lowest numbered rule

Application scope

Applies only if specified during launch or associated with an instance later

Applies automatically to all instances in associated subnets

Purpose

Primary instance-level traffic control

Additional layer of defense if security group rules are too permissive

Enumeration

1) Enumerate VPC endpoints

aws ec2 describe-vpc-endpoints

2) Enumerate VPCs

aws ec2 describe-vpcs

Data Exfiltration

Prerequisites: AWS Credentials

1) Allocate a new public IP Address to the EC2 Instance in the account

AWS CLI or CloudShell

2) Find the ENI (network interface) for the target machine.

3) Attach the public IP to the ENI of the target machine, by associating the AllocationId with the NetworkInterfaceId

4) Get the IGW ID

5) Get the route table ID (the one that is for the private network)

6) Add the route to the route table

7) Verify that you have added the route

8) Find the group ID of a security group that might block access

9) Create a security group rule to allow traffic from anywhere

10) Find the NACL ID of our target NACL

11) Create an ingress rule in NACL

12) Create an egress rule in NACL

13) Verify with ping

Attack machine

Last updated