An Empirical Study of the Use of Integrity Verification Mechanisms for Web Subresources

Bertil Chapuis, Olamide Omolola, Mauro Cherubini, Mathias Humbert, Kévin Huguenin

Introduction: The Vulnerability of the Modern Web

Modern websites are rarely self-contained; they "hotlink" scripts, stylesheets, and images from third-party Content Delivery Networks (CDNs) to improve performance and reduce costs. However, this architectural choice introduces a significant security risk. If a CDN is compromised, an attacker can inject malicious code into thousands of downstream websites that rely on its resources, as seen in high-profile incidents like the 2018 British Airways hack.

Webpage fetching subresources from multiple servers, illustrating the potential for third-party compromise.

To mitigate this, the W3C introduced Subresource Integrity (SRI). By adding a cryptographic hash (the integrity attribute) to <script> or <link> tags, developers allow browsers to verify that the fetched file matches a specific fingerprint before execution. This paper provides the first large-scale longitudinal study of SRI adoption and developer understanding.

Methodology

The researchers employed a dual-method approach to understand the state of SRI:

  1. Longitudinal Analysis: They analyzed 13 snapshots of the Common Crawl dataset from 2016 to 2019, covering approximately 3 billion URLs per snapshot to track the evolution of the integrity= attribute.
  2. Developer Survey: A survey of 227 active developers from the WordPress and NPM ecosystems was conducted. This included a technical quiz to assess their actual understanding of SRI implementation details, such as how browsers handle multiple hashes or malformed attributes.

Key Insights: The "Copy-Paste" Phenomenon

A primary finding is that SRI adoption is largely driven by "copy-paste" behavior rather than proactive security engineering. Popular libraries like Bootstrap and CDNs like jsDelivr provide ready-made code snippets that include the SRI attribute. Developers often include these attributes because the library suggests it, without necessarily understanding the underlying mechanism.

This lack of deep understanding was confirmed by the survey results. While 65% of developers claimed familiarity with SRI, only 0.7% correctly answered all technical questions regarding browser behavior. Many developers were unaware that browsers default to the strongest algorithm (e.g., SHA-512) when multiple hashes are provided.

SRI usage has seen steady growth, rising from near zero in 2016 to approximately 3.40% of all webpages by late 2019. Adoption is notably higher among high-traffic sites (the "Top 1M"), where security standards are generally more rigorous.

Growth of SRI adoption over time, highlighting the impact of popular library snippets like Bootstrap and Font Awesome.

Despite this growth, several issues persist:

  • Manual Bottlenecks: Most developers implement SRI manually, which is error-prone and difficult to scale for frequently updated resources.
  • Broken Implementations: Approximately 1.41% of SRI attributes in the wild were found to be malformed, rendering the security check useless.
  • The HTTPS Paradox: Many developers apply SRI on plain HTTP sites. This is largely ineffective because an attacker could simply strip the integrity attribute out of the HTML during transit.

Conclusion and Future Directions

For SRI to achieve widespread effectiveness, it must move beyond manual implementation. The authors argue for native integration into Content Management Systems (like WordPress) and build tools (like Webpack or Gulp). Automating the generation of integrity hashes within the deployment pipeline would make security an invisible, default part of web development. Future extensions of SRI could also cover other resource types, such as images and video, to provide a more comprehensive integrity framework for the modern web.

Summary updated

Abstract

Web developers can (and do) include subresources such as scripts, stylesheets and images in their webpages. Such subresources might be stored on content delivery networks (CDNs). This practice creates security and privacy risks, should a subresource be corrupted. The subresource integrity (SRI) recommendation, released in mid-2016 by the W3C, enables developers to include digests in their webpages in order for web browsers to verify the integrity of subresources before loading them. In this paper, we conduct the first large-scale longitudinal study of the use of SRI on the Web by analyzing massive crawls (≈ 3B URLs) of the Web over the last 3.5 years. Our results show that the adoption of SRI is modest (≈), but grows at an increasing rate and is highly influenced by the practices of popular library developers (e.g., Bootstrap) and CDN operators (e.g., jsDelivr). We complement our analysis about SRI with a survey of web developers (N=): It shows that a substantial proportion of developers know SRI and understand its basic functioning, but most of them ignore important aspects of the recommendation. The results of the survey also show that the integration of SRI by developers is mostly manual – hence not scalable and error prone. This calls for a better integration of SRI in build tools.
BibTeX
@inproceedings{chapuis2020empirical,
  author = {Bertil Chapuis and Olamide Omolola and Mauro Cherubini and Mathias Humbert and Kévin Huguenin},
  title = {{An Empirical Study of the Use of Integrity Verification Mechanisms for Web Subresources}},
  booktitle = {The Web Conference},
  year = {2020},
  doi = {10.1145/3366423.3380092},
}
Figure