Abstract: With the increasing prevalence of progressive web applications, web workers have found themselves in the spotlight. Indeed, workers have drastically changed the Web attack surface. Prior work has demonstrated unique flaws enabled by the introduction of service workers, e.g., their computation, persistence, caching, or ability to process web push messages. As for XSS (cross-site scripting), its treatment in web worker contexts by various Web stakeholders is largely unsatisfactory and insufficient. Content injection attacks are still largely framed from the perspective of webpages, including the defense mechanisms. In this work, we undertake the first comprehensive security analysis of content injection attacks in all web workers, with a focus on XSS. To do so, we start by defining a clear threat model, considering that workers are dedicated to code execution, but lack a DOM, meaning that the ways they are infected by attackers are different from web pages. Then, we devise a rigorous methodology we applied to a large-scale dataset consisting of 4,757,077 workers collected from 56,945,781 websites in the wild. As a result, we confirmed, through extensive manual vetting, different forms of server and client XSS in at least 89,945 workers. We reported our findings to many of the vendors (covering 99.8% of the vulnerable workers), and many of them acknowledged the issue, and at the time of this writing, the issue has been fixed for at least 82.3% of the vulnerable workers. From a defensive side, we engaged in an extensive discussion with proposals and demonstrated how to extend the Content Security Policy and the importScripts function implementations to allow the expression and support of finer-grained policies like nonces and hashes which we believe can help thwart most of the attacks discussed in this work.
Meta Review:
The paper presents a large-scale study of cross-site scripting (XSS) vulnerabilities in web worker contexts. By examining XSS risks in dedicated, shared, and service workers, the authors apply a semi-automated methodology to a massive dataset of over 56 million websites, identifying 89,945 risky workers. The study also proposes extending Content Security Policy (CSP) and Subresource Integrity (SRI) to mitigate these risks and discusses their proposals with the W3C Web Application Security Working Group. Overall, this paper makes a timely and valuable contribution toward understanding and addressing XSS in web workers.