MEDIUM
Source
Trivy
Frameworks

CIS AWS 1.4

ID
AVD-AWS-0105

Network ACLs should not allow ingress from 0.0.0.0/0 to port 22 or port 3389.

The Network Access Control List (NACL) function provide stateless filtering of ingress and egress network traffic to AWS resources. It is recommended that no NACL allows unrestricted ingress access to remote server administration ports, such as SSH to port 22 and RDP to port 3389.

Impact

Follow the appropriate remediation steps below to resolve the issue.

Set a more restrictive CIDR range

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
AWSTemplateFormatVersion: "2010-09-09"

Description: Godd example of excessive ports

Resources:
  NetworkACL:
    Type: AWS::EC2::NetworkAcl
    Properties:
      VpcId: something

  Rule:
    Type: AWS::EC2::NetworkAclEntry
    Properties:
      CidrBlock: 10.0.0.0/8
      NetworkAclId: !Ref NetworkACL
      Protocol: 6
      RuleAction: allow
      PortRange:
        From: 22
        To: 22

Set a more restrictive CIDR range

1
2
3
4
5
6
7
8
resource "aws_network_acl_rule" "good_example" {
  egress      = false
  protocol    = "tcp"
  from_port   = 22
  to_port     = 22
  rule_action = "allow"
  cidr_block  = "10.0.0.0/16"
}