Before WordPress 4.9.5, the URL validator assumed URLs with the hostname localhost were on the same host as the WordPress server.
www.securityfocus.com/bid/104350
www.securitytracker.com/id/1040836
codex.wordpress.org/Version_4.9.5
core.trac.wordpress.org/changeset/42894
github.com/WordPress/WordPress/commit/804363859602d4050d9a38a21f5a65d9aec18216
wordpress.org/news/2018/04/wordpress-4-9-5-security-and-maintenance-release/
wpvulndb.com/vulnerabilities/9053
www.debian.org/security/2018/dsa-4193