Skip to main content

Unrestricted access between network segments - RDS

Description

Some RDS Cluster or Instances are not defined inside a Database Subnet Group.

Impact

Access to RDS services in a insecure way from the Internet.

Recommendation

Ensure that all RDS instances belong to a Database Subnet Group.

Threat

Authenticated attacker from the Internet.

Expected Remediation Time

⌚ 90 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: L
  • Privileges required: H
  • User interaction: N
  • Scope: U
  • Confidentiality: L
  • Integrity: L
  • Availability: L

Temporal

  • Exploit code madurity: P
  • Remediation level: O
  • Report confidence: C

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C
  • Score:
    • Base: 4.7
    • Temporal: 4.2
  • Severity:
    • Base: Medium
    • Temporal: Medium

Code Examples

Compliant code

The resources have defined security groups

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"
SecurityGroups:
- name1

Non compliant code

There are some resources which use the pre defined security group or do not define one

Resources:
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateName: MyLaunchTemplate
LaunchTemplateData:
InstanceType: t2.micro
KeyName: MyKeyPair
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: "ami-79fd7eee"
KeyName: "testkey"

Using the AWS CLI, the following command checks the subnet groups associated with a given database instance subnet ID

$ aws ec2 describe-route-tables
--region us-east-1
--filters "Name=association.subnet-id,Values=subnet-19e7cc6f"
--query 'RouteTables[*].Routes[]'

If the output contains any entries with the GatewayId value set to igw-xxxxxxxx and the DestinationCidrBlock value set to 0.0.0.0/0, the selected RDS database instance was provisioned inside a public subnet, and has an insecure configuration

Requirements

free trial

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.