1000-ft view: SSRF lets an attacker make your server fetch URLs it shouldn’t (e.g., cloud metadata, internal panels, non-HTTP ports). This secure page calls a hardened fetcher that: allowlists domains, blocks private CIDRs, re-resolves hostnames, enforces HTTPS, limits ports, and rejects weird schemes.
Secure idea: refuse requests to private/loopback/link-local ranges
(10/8, 172.16/12, 192.168/16, 127/8, 169.254/16, ::1, fc00::/7), even if the URL is http(s).
Secure idea: resolve the host to an IP at request time and enforce the private-CIDR block on the final address (protects against DNS rebinding/hosts-file tricks).
http://localhost/… which resolves to 127.0.0.1.Secure idea: either don’t follow redirects or, if you must, re-validate the destination after each hop (scheme/host/IP/port).
redirector.php which forwards to
127.0.0.1.Secure idea: your feature likely needs HTTPS:443 only.
Disallow raw sockets, FTP, Gopher, and non-standard ports (e.g., 22, 25, 3306).
127.0.0.1:22). The secure probe should refuse it.Secure idea: accept only normalized https:// URLs with a
hostname that passes allowlist + DNS/IP checks. Reject file://, gopher://,
ftp://, IPv6 localhost http://[::1]/, mixed-encoded hosts, and userinfo tricks.