Insecure service configuration - Security Groups
Description
EC2 Security Groups are not explicitly defined. Security Group input/output rules are not defined.
Impact
- Extract information from the server without proper consent.
- Create holes to gain remote access.
Recommendation
Securely configure the vulnerable service by explicitly defining the Security Groups.
Threat
Anonymous attacker with access to an EC2 instance from an internal network.
Expected Remediation Time
⌚ 30 minutes.
Score
Default score using CVSS 3.1. It may change depending on the context of the vulnerability.
Base
- Attack vector: A
- Attack complexity: H
- Privileges required: N
- User interaction: N
- Scope: U
- Confidentiality: L
- Integrity: L
- Availability: N
Temporal
- Exploit code madurity: P
- Remediation level: O
- Report confidence: C
Result
- Vector string: CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N/E:P/RL:O/RC:C
- Score:
- Base: 4.2
- Temporal: 3.8
- Severity:
- Base: Medium
- Temporal: Low
Code Examples
Compliant code
The services have specific security groups configured
Resources:
MyLaunchTemplate2:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateName: MyLaunchTemplate
LaunchTemplateData:
InstanceType: t2.micro
KeyName: MyKeyPair
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: "ami-79fd7eee"
KeyName: "testkey"
SecurityGroups:
- name1
Non compliant code
There are services with the default security groups configured
Resources:
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateName: MyLaunchTemplate
LaunchTemplateData:
InstanceType: t2.micro
KeyName: MyKeyPair
SecurityGroupIds:
- sg-083cd3bfb8example
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: "ami-79fd7eee"
KeyName: "testkey"
Using the AWS CLI, the following command checks if the EC2 instance uses the default security groups
$ aws ec2 describe-instances
--region us-east-1
--filters "Name=instance.group-name,Values=default"
--output table
--query 'Reservations[*].Instances[*].InstanceId'
If the output returns one or more instance ID, these have the default security group configured
Requirements
Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.