A security group lets the whole internet reach SSH, RDP or another administration port
What it finds
Administration services such as SSH and RDP are scanned and attacked constantly. Open to 0.0.0.0/0 or ::/0, they are one weak password or unpatched flaw away from a compromise. A bastion, a VPN or a list of known addresses narrows who can try.
Reported are addIngressRule calls whose peer is Peer.anyIpv4() or Peer.anyIpv6() and whose port is TCP 22, 3389, 5900, 5985 or 5986, in files that use the CDK.
From the rule's source, admin_port_open_to_world.rs.
import { Peer, Port } from "aws-cdk-lib/aws-ec2";declare const group: any;group.addIngressRule(Peer.anyIpv4(), Port.tcp(22));tx0 reports: this opens an administration port to the whole internetgroup.addIngressRule(Peer.anyIpv4(), Port.tcp(443)); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:admin-port-open-to-world" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:admin-port-open-to-world] reason="..."tx0 explain tx0/ts:admin-port-open-to-world shows the same in the terminal. Found a false positive? Report it.