一句话:通过大规模爬取评估 Google 四项基于 nonce 的 CSP 方案在 Tranco 前 10K 网站的可行性与稳定性。
内容安全策略(CSP)可缓解 XSS 等注入攻击,但因机制复杂,网站部署率低且配置常有不安全或错误。Google 提出四种基于 nonce 的 CSP 方案并在 160 多项服务上部署;本文评估其推广到其他网站的可行性。作者构建爬虫,自动访问 Tranco 前 10K 网站、模拟交互并注入四种 CSP,收集触发的违规。基于这些违规,分析方案的可采纳性、部署问题与稳定性。结果显示,多数网站所有被访问页面均可采纳 nonce-based CSP;无法整体采纳的网站中,通常约 40% 页面难以采用。总体结果积极,有助于推动 CSP 正确部署。
Content Security Policy (CSP) is a leading security mechanism for mitigating content injection attacks such as CrossSite Scripting (XSS). Nevertheless, despite efforts from academia and industry, CSP policies (in short, CSPs) are not widely deployed on websites, and deployed CSPs often have security issues or errors. Such low and insecure CSP deployment problems are mainly due to the complexity of the CSP mechanism. Google recently proposed four nonce-based CSP solutions which are simpler and more secure compared to traditional whitelisting-based CSP solutions. Google successfully deployed their nonce-based CSP solutions on over 160 services, covering 62% of all outgoing Google traffic. These nonce-based CSP solutions use simple CSPs but provide fine-grained control of web resources; therefore, if widely adopted on many other websites, they can be very helpful on addressing the low and insecure CSP deployment problems. In this paper, we evaluate the feasibility of adopting Google's nonce-based CSP solutions on the Tranco top 10K websites. We construct a crawling tool to automatically visit websites, simulate user interactions, and insert four CSPs to collect the CSP violations triggered under them. We investigate the adoptability of the nonce-based CSP solutions, adoption issues, and the stability of adopting them on websites by analyzing the CSP violations triggered under the inserted CSPs. We found that most websites can adopt the nonce-based CSP solutions on all their webpages visited in our study. For websites that cannot, usually the adoption is hard on around 40% of their webpages. Overall, our results are very encouraging and can be helpful in promoting the proper deployment of CSPs on many websites.
DOI 原文 ·
@inproceedings{paperbot8786,
title = {Analyzing the Feasibility of Adopting Google's Nonce-Based CSP Solutions on Websites},
author = {Mengxia Ren and Anhao Xiang and Chuan Yue},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00193}
}