Description
Allow TCP 3389 only from administrator addresses or management networks on instances that need RDP. 0.0.0.0/0 covers all IPv4 sources and ::/0 all IPv6 sources.
Potential impact
With a suitable address, route and listener, external clients can attempt RDP sign-in. Compromised credentials or weak host controls can put internal resources at risk.
Remediation
Test the required management operation through a VPN, bastion or management service before removing public rules. Remove RDP permission if unused. Otherwise check all attached groups, the host firewall, authentication and patches.
Examples
Supply the actual VPC ID as myVPC. Configure the instance attachment, RDP service and management path separately.
Before
Parameters:
myVPC:
Type: AWS::EC2::VPC::Id
Resources:
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow rdp to client host
VpcId:
Ref: myVPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 3389
ToPort: 3389
CidrIp: 0.0.0.0/0
The first rule permits inbound TCP 3389 from every IPv4 address.
After
Parameters:
myVPC:
Type: AWS::EC2::VPC::Id
Resources:
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow rdp to client host
VpcId:
Ref: myVPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 3389
ToPort: 3389
CidrIp: 192.168.0.0/16
The second permits the whole of 192.168.0.0/16. Narrow it to the actual management clients and test new connections from an approved and an unapproved source.