Relying on a CDN to provide essential code directly to users can lead to malicious code execution.
Using a CDN to serve an application's dependent JavaScript offers many advantages over serving JavaScript from the application's own server. These benefits include increased performance and less code maintenance for the application owner. However, the application assumes that the CDN will deliver safe content to the browser. If an attacker compromises a CDN, the CDN will deliver malicious code to the user's browser. The user's browser is now executing code that the application cannot control or detect as melicious.
Example 1: The following ASPX code includes Microsoft's jQuery code by referencing the Microsoft CDN:
...
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
...
...
<asp:ScriptManager
ID="ScriptManager1"
EnableCdn="true"
Runat="Server" />
...
[1] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A1 Injection
[2] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A1 Unvalidated Input
[3] Standards Mapping - OWASP Top 10 2007 - (OWASP 2007) A3 Malicious File Execution
[4] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I, APP3600 CAT II
[5] Content Deliver Network and its Regulation The Journal of China Universities of Posts and Telecommunications
[6] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 94, CWE ID 98
[7] Managed Content Security Delivery radware
[8] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.3.1.1, Requirement 6.5.3
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.1
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 - (PCI 2.0) Requirement 6.5.8
[11] Standards Mapping - SANS Top 25 2009 - (SANS 2009) Risky Resource Management - CWE ID 094
[12] Standards Mapping - SANS Top 25 2010 - (SANS 2010) Risky Resource Management - CWE ID 098
[13] Standards Mapping - FIPS200 - (FISMA) SI