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 environment 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-ControlsCSA-CCMISO-27001NIST-800-53PCI-DSSSOC-2
  • Snyk IDSNYK-CC-00132
  • creditSnyk 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"]
  }
}