VPC security group attached to RDS instance permits ingress from '0.0.0.0/0' to all ports Affecting VPC service in AWS


Severity

0.0
medium
0
10
    Severity Framework
    Snyk CCSS
    Rule category
    Network / Public Access

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls CSA-CCM ISO-27001 NIST-800-53 PCI-DSS SOC-2
  • Snyk ID SNYK-CC-00132
  • credit Snyk Research Team

Description

RDS security groups should permit access only to necessary ports to prevent access to potentially vulnerable services on other ports.

How to fix?

Set the ingress.cidr_blocks attribute with a more restrictive CIDR block, for example 192.168.1.0/24.

Example Configuration

resource "aws_security_group" "ingress-rds-test-group" {
  name = "ingress-rds-test-group"
  description = "Ingress rds"

  ingress {
    from_port = 3306
    to_port = 3306
    protocol = "tcp"
    cidr_blocks = ["192.168.1.0/24"]
  }
}