EC2 security groups are evaluated for rules that allow inbound Telnet on TCP 23 from the Internet (0.0.0.0/0 or ::/0).
Risk
Public Telnet exposes cleartext credentials and remote shell access.
- Brute-force and credential interception enable account takeover
- Command execution enables data theft and lateral movement
This threatens confidentiality and integrity and can degrade availability through misuse.
prowler aws --checks ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_telnet_23
Recommendation
Remove rules permitting Internet access to TCP 23 from 0.0.0.0/0 or ::/0. Disable Telnet on hosts. Prefer SSH or SSM and apply least privilege network rules. Restrict admin access to trusted IPs, VPN, or private endpoints, and use defense in depth with NACLs and logging.
Remediation
aws ec2 revoke-security-group-ingress --group-id <SECURITY_GROUP_ID> --ip-permissions '[{"IpProtocol":"tcp","FromPort":23,"ToPort":23,"IpRanges":[{"CidrIp":"0.0.0.0/0"}],"Ipv6Ranges":[{"CidrIpv6":"::/0"}]}]'
- In the AWS console, go to VPC > Security Groups
- Select the affected security group and open Inbound rules
- Click Edit inbound rules
- Find any rule allowing TCP port 23 (Telnet) from 0.0.0.0/0 or ::/0
- Delete the rule or change Source to a specific trusted CIDR
- Save rules
Source Code
Resource Type
AwsEc2SecurityGroup
References
- https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
- https://support.icompaas.com/support/solutions/articles/62000233790-ensure-no-ec2-instances-allow-ingress-from-the-internet-to-tcp-port-23-telnet-
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/EC2/unrestricted-telnet-access.html