Badly configured localhost records create security issues

Delete all localhost labels from your zones

Red open digital padlock amid closed blue digital padlocks

Of the 6.2 million domain names in the .nl zone, no fewer than 1.3 million still have an A record for the localhost label. It used to be mandatory for every zone to have a localhost record, but that requirement was scrapped long ago. Nevertheless, localhost records do need attention, because they make web servers with active users vulnerable to XSS attacks. We advise all registrants and operators (often registrars) to check their domain names' zones for localhost labels and to delete any they find.

Security problem

The recommendation that every zone should include a localhost record goes right back to RFC 1537, written nearly thirty years ago by Piet Beertema (founder of the .nl domain). Section 10 of that RFC (which also covers reverse DNS) says that every domain must have a localhost A record. However, after all these years, even Beertema can no longer remember exactly why. Operators who followed the RFC to the letter – as they were supposed to – added localhost labels to their zones, creating a reference to 127.0.0.1 (the loopback interface) from within their own domains: localhost.example.nl. However, as explained in this article, such records are vulnerable to cross-site scripting (XSS) attacks. An XSS attack involves someone on the same system as the one where a website is running to read site users' HTTP cookies (recording session and authentication data, for example). That's done by opening a 'high' TCP port and directing other system users to an address such as 'http://localhost.example.nl:49152/'. Because www.example.nl and localhost.example.nl have the same main domain, a malicious user who opens a connection with localhost.example.nl (127.0.0.1) also receives cookies intended for www.example.nl.

Localhost exclusively local

RFC 1537 was declared obsolete in 1996 and superseded by RFC 1912. The newer RFC clearly states that localhost should be configured (exclusively) as a special host name (reflecting its local scope). What's more, the host name has to be followed by a dot, so that it is unmistakably a Fully Qualified Domain Name (FQDN):

  localhost.    IN    A    127.0.0.1

Delete all localhost records from your zones

Many years back, in line with RFC 1537, we made inclusion of a localhost label mandatory in .nl domains. Compliance was an absolute technical requirement for the approval of a .nl domain. Although that requirement was withdrawn long ago, we did not explicitly communicate the message that the records should then have been deleted from all .nl zones. Consequently, misunderstanding of the situation has persisted, as the figures given at the start of this article attest. A large number of .nl domains still include bad localhost records, with some companies still even requiring the use of localhost labels. It is therefore high time that we stated unequivocally: you should delete all localhost labels from your zones.