Validate DNS Results Before Connecting to Untrusted Hostnames
A server that accepts a hostname from a user can make a careful security decision and still connect somewhere it never intended. The common mistake is validating the hostname first, then assuming that the later network connection will reach the same kind of destination. Hostnames are names, not network locations. DNS turns a hostname into one or more IP addresses, and those answers can change. If your security rule says “public destinations only,” checking the text of the hostname is not enough. The connection must also be constrained to an address that satisfies that rule.