XSS-over-DoH: On the Adverse Side Effects of DoH on Web Security
Abstract
DNS-over-HTTPS (DoH) is a technique to resolve domain names from the DNS backbone via HTTPS requests, which at first glance seems to be an unambiguous security improvement over plain DNS. In this work, however, we show that DoH exposes the web to new security risks by introducing HTTP as an additional application layer protocol and reusing the standard HTTPS port 443. Furthermore, DoH does not strictly require the presence of HTTP headers that are essential for its secure integration into the current web ecosystem. In the light of these issues, we discovered a new class of web attacks called XSS-over-DoH. We demonstrate how attackers can exploit weaknesses in the DoH standard and attack DoH and web servers with Direct-XSS-over-DoH and CSP-Bypass-over-DoH. Direct-XSS-over-DoH achieves XSS on a website, even if there is no markup injection on that site, which other XSS attacks require. To mitigate XSS on websites, the Content Security Policy (CSP) is often recommended to neutralize the effects of markup injection vulnerabilities. Our CSP-Bypass-over-DoH circumvents this mitigation technique entirely and exploits DoH to bypass even a strong CSP, given a markup injection. These issues prove our major point: New web features like DoH may invalidate established web security technologies. Therefore, thorough research is needed when new components are introduced into the web ecosystem. The discovery of the XSS-over-DoH attacks contradicts a key security assumption present in the DoH standard, i.e., the content of DoH messages is not executable code. We investigated XSS-over-DoH and performed a large-scale Internet scan of more than 3 million domains and identified 1,297 DoH servers. Among those, 72% deliver headers that are insecure in the presence of XSS-over-DoH. Furthermore, we discovered 2,265 CSPs of public websites vulnerable to our CSP-Bypass-over-DoH attack, and we found a Direct-XSS-over-DoH vulnerability in three cases, including Proton Mail. Based on our findings, we propose substantial improvements to the DoH standard to mitigate XSS-over-DoH.