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