Nytro Posted December 2, 2014 Report Posted December 2, 2014 From: Tavis Ormandy <taviso () sdf lonestar org>Date: Fri, 18 Jan 2008 16:40:58 +0000Hello, I'd like to document what appears to be a common namedmisconfiguration that can result in a minor security issue with webapplications.It's a common and sensible practice to install records of the form"localhost. IN A 127.0.0.1" into nameserver configurations, bizarrelyhowever, administrators often mistakenly drop the trailing dot,introducing an interesting variation of Cross-Site Scripting (XSS) Icall Same-Site Scripting. The missing dot indicates that the record isnot fully qualified, and thus queries of the form"localhost.example.com" are resolved. While superficially this mayappear to be harmless, it does in fact allow an attacker to cheat theRFC2109 (HTTP State Management Mechanism) same origin restrictions, andtherefore hijack state management data.The result of this minor misconfiguration is that it is impossible toaccess sites in affected domains securely from multi-user systems. Theattack is trivial, for example, from a shared UNIX system, an attackerlistens on an unprivileged port[0] and then uses a typical XSS attackvector (e.g. <img src=...> in an html email) to lure a victim intorequesting http://localhost.example.com:1024/example.gif, logging therequest. The request will include the RFC2109 Cookie header, which couldthen be used to steal credentials or interact with the affected serviceas if they were the victim.Another attack vector exists where a victim connects to a site from (orvia) a machine that hosts another website, any XSS-like flaw orreflective web service on the hosted website can therefore be exploitedin the context of the misconfigured domain. This would also affect userswho connect via a shared caching http proxy machine, that also hosts anhttp daemon.An excellent example of exploiting this misconfiguration was discoveredby my colleague, Will Drewry, in CUPS.http://localhost.example.com:631/jobs/?job_id=&job_printer_name=Click%20Me&job_printer_uri=javascript:alert(document.cookie)This misconfiguration allows any of the domains affected to bevulnerable to this issue via CUPS (installed on most UNIX, Linux, Macsystems). The bug requires a click to be exploited, but illustrates theproblem nicely.Initial analysis shows that some of the worlds most popular websites areaffected. The administrators of the example domains listed below weresent a draft of this email 7 days before release, so some (or all) mayhave been corrected, these examples are simply intended to demonstratehow widespread this problem is. localhost.microsoft.com has address 127.0.0.1localhost.ebay.com has address 127.0.0.1localhost.yahoo.com has address 127.0.0.1localhost.fbi.gov has address 127.0.0.1localhost.citibank.com has address 127.0.0.1localhost.cisco.com has address 127.0.0.1etc.RecommendationsIt is advised that non-FQ localhost entries be removed from nameserverconfigurations for domains that host websites that rely on HTTP statemanagement. Of course, any other records that return RFC1918 or RFC3330reserved addresses should also be carefully examined for similar issues.Additionally, those practising blackhole routing via dns to mitigatedenial of service attacks against specific hostnames should avoid thetemptation to resolve targets to 127.0.0.1 or similar addresses forsensitive domains.[0] It appears to be a common mistake to confuse the JavaScript SOP andthe HTTP originating host definition for Cookies with regard to portnumber. The JavaScript SOP(http://www.mozilla.org/projects/security/components/same-origin.html)does include the port number, where as RFC2109(http://www.ietf.org/rfc/rfc2109.txt) explicitly does not. Thisbehaviour is arguably incorrect, making it impossible to securely host awebsite from a multi-user machine, but nevertheless is the case, and isimplemented by most major browsers.Thanks to Will Drewry, Robert Swiecki, and Filipe Almeida for theirvaluable assistance researching this topic.-- -------------------------------------taviso () sdf lonestar org | finger me for my gpg key.-------------------------------------------------------Sursa: Bugtraq: common dns misconfiguration can lead to "same site" scripting Quote