Back to Checks
aws

Security group does not allow ingress from 0.0.0.0/0 or ::/0 to Redis TCP port 6379

ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379
Service: ec2Severity: high
OfficialBuilt-inVerified
Categories:internet-exposed
Resource Type:AwsEc2SecurityGroup

EC2 security groups permitting Internet sources (0.0.0.0/0 or ::/0) to TCP 6379 are identified, indicating Redis is reachable from public networks

Risk

Public Redis access undermines confidentiality, integrity, and availability:

  • Read keys and secrets
  • Modify or flush data and configs
  • Exhaust memory for DoS Attackers can brute-force AUTH, exploit replication or modules for code execution, and pivot within the VPC.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler aws --checks ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379

Recommendation

Restrict Redis to private connectivity and apply least privilege:

  • Allow 6379 only from required app hosts, security groups, or CIDRs
  • Prefer VPC/private networks or VPN over public IPs
  • Enforce Redis AUTH and TLS, bind to private interfaces
  • Use segmentation and monitoring for defense in depth

Remediation

CLI

aws ec2 revoke-security-group-ingress --group-id <SECURITY_GROUP_ID> --protocol tcp --port 6379 --cidr 0.0.0.0/0

Terraform

# Security group with Redis limited to trusted sources
resource "aws_security_group" "secure" {
  vpc_id = "<example_resource_id>"

  ingress {
    from_port   = 6379
    to_port     = 6379
    protocol    = "tcp"
    cidr_blocks = ["10.0.0.0/8"] # Critical: do NOT use 0.0.0.0/0 or ::/0; restrict to trusted CIDR
  }
}

NativeIaC

# CloudFormation: restrict Redis (6379) from Internet
Resources:
  SecureSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Restrict Redis access
      VpcId: <example_resource_id>
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 6379
          ToPort: 6379
          CidrIp: 10.0.0.0/8  # Critical: do NOT use 0.0.0.0/0 or ::/0; restrict to trusted CIDR

Other

1In the AWS Console, go to EC2 > Security Groups
2Select the affected security group
3Open the Inbound rules tab and click Edit inbound rules
4Find any rule allowing TCP port 6379 with Source 0.0.0.0/0 or ::/0
5Delete that rule (or change Source to a trusted CIDR or security group)
6Click Save rules

Check Code

from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.ec2.ec2_client import ec2_client
from prowler.providers.aws.services.ec2.ec2_securitygroup_allow_ingress_from_internet_to_all_ports import (
    ec2_securitygroup_allow_ingress_from_internet_to_all_ports,
)
from prowler.providers.aws.services.ec2.lib.security_groups import check_security_group
from prowler.providers.aws.services.vpc.vpc_client import vpc_client


class ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_redis_6379(Check):
    def execute(self):
        findings = []
        check_ports = [6379]
        for security_group_arn, security_group in ec2_client.security_groups.items():
            # Check if ignoring flag is set and if the VPC and the SG is in use
            if ec2_client.provider.scan_unused_services or (
                security_group.vpc_id in vpc_client.vpcs
                and vpc_client.vpcs[security_group.vpc_id].in_use
                and len(security_group.network_interfaces) > 0
            ):
                report = Check_Report_AWS(
                    metadata=self.metadata(), resource=security_group
                )
                report.resource_details = security_group.name
                report.status = "PASS"
                report.status_extended = f"Security group {security_group.name} ({security_group.id}) does not have Redis port 6379 open to the Internet."
                # only proceed if check "..._to_all_ports" did not run or did not FAIL to avoid to report open ports twice
                if not ec2_client.is_failed_check(
                    ec2_securitygroup_allow_ingress_from_internet_to_all_ports.__name__,
                    security_group_arn,
                ):
                    # Loop through every security group's ingress rule and check it
                    for ingress_rule in security_group.ingress_rules:
                        if check_security_group(
                            ingress_rule, "tcp", check_ports, any_address=True
                        ):
                            report.status = "FAIL"
                            report.status_extended = f"Security group {security_group.name} ({security_group.id}) has Redis port 6379 open to the Internet."
                            break
                else:
                    report.status_extended = f"Security group {security_group.name} ({security_group.id}) has all ports open to the Internet and therefore was not checked against the specific Redis port 6379."

                findings.append(report)

        return findings