Subresource Integrity (SRI) is not implemented, and external scripts are not loaded securely

OWASP 2013-A5 OWASP 2017-A6 WASC-15 ISO27001-A.14.2.5 CWE-16

Subresource Integrity (SRI) provides a method to protect website delivery. It provides a mechanism to check the integrity of the resource hosted by third parties interface plug-ins. The plug-ins might include Content Delivery Networks (CDNs). This method verifies if the fetched resource has been delivered to the user without unexpected manipulation. This method ensures these assets have not been compromised for hostile purposes. SubResource Integrity cannot mitigate all risks in the application. A 3rd party javascript could access information from the end-users. Subresource integrity was introduced by scan and verify fetched files. An integrity value starts with at least one string. Each string contains a prefix that indicates hash algorithm. An integrity value may have multiple hashes, separated by whitespaces.

Example

The below code is an example of integrity string with base64-encoded sha384 hash.

        sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wq4JwY8wC

    

Impact

An attacker can gain access to Content Delivery Networks and cause huge damage to the application. If the attacker is one of the persons who had developed one of the CDN used by the application. He can gain access to your system by tweaking the content from CDN.

Mitigation / Precaution

Beagle recommends the following:-

  • Implement Sub resource integrity properly.
  • Load external URLs via HTTPS

Latest Articles