More Restrictive CIDR High

CidrIp Property is set to 0.0.0.0/0. Make sure that you set CidrIp roperty to a more restrictive CIDR than 0.0.0.0/0.

Detector ID
cloudformation/checkov-custom-restricted-ssh@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-

Noncompliant example

1Resources:
2  InstanceSecurityGroup:
3    Type: AWS::EC2::SecurityGroup
4    Properties:
5      GroupDescription: Enable SSH access and HTTP from the load balancer only
6      SecurityGroupIngress:
7      - Description: Allow SSH access from trusted IP
8        IpProtocol: tcp
9        FromPort: 22
10      # Noncompliant: `CidrIp` is less restricted
11        CidrIp: "0.0.0.0/0"
12      - Description: Allow HTTP access from anywhere
13        IpProtocol: tcp
14        FromPort: 80
15        ToPort: 80

Compliant example

1Resources:
2  InstanceSecurityGroup:
3    Type: AWS::EC2::SecurityGroup
4    Properties:
5      GroupDescription: Enable SSH access and HTTP from the load balancer only
6      SecurityGroupIngress:
7      - Description: Allow SSH access from trusted IP
8        IpProtocol: tcp
9        FromPort: 22
10        ToPort: 22
11      # Compliant: `CidrIp` is more restricted
12        CidrIp: "203.0.113.42/0"
13      - Description: Allow HTTP access from anywhere
14        IpProtocol: tcp
15        FromPort: 80
16        ToPort: 80