For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/default_rules/tch-c9p-gh4.md. A documentation index is available at /llms.txt.

Security groups should restrict traffic to trusted IPv4 addresses

Description

AWS security groups should not allow ingress from 0.0.0.0/0 to remote server administration ports, such as SSH (22) and RDP (3389). A rule fails when it uses TCP (6), UDP (17), or ALL (-1) protocols, has a port range that includes 22 or 3389 (including ALL ports), and has a source of 0.0.0.0/0. Security groups are stateful and do not support DENY rules, so any such rule is non-compliant. A security group whose inbound rules were not collected fails, as does one with an inbound rule whose protocol is missing, blank, or invalid, a TCP or UDP port range whose numeric bounds are missing, inverted, below 0, or above 65535, a source CIDR entry with missing or invalid syntax or the wrong address family, a prefix-list or source-security-group item without a nonblank identifier, or no source CIDR, prefix list, or security group. Every present source family must be well formed, even when another valid source family is present. Sources that reference a managed prefix list or another security group, and other environment-specific administration ports, are not evaluated.

Remediation

Before removing access, make sure administrators can still connect through another mechanism.

  1. In the Amazon VPC console, select Security Groups, choose each affected group, and click Edit inbound rules on the Inbound rules tab.
  2. Change the source of each offending rule to a range other than 0.0.0.0/0 or delete the rule, then click Save rules. See Security group rules.

References