More than 99% of websites use code from third-party vendors to build their sites. Examples of this are social sharing buttons, advertising iframes, payment iframes, chatbots, analytics and metrics scripts, A/B testing scripts for experiments and helper libraries such as jQuery.
In order for such code to work, developers must grant the third-party JavaScript some level of access to their site, apps and data. This means that JavaScript has the ability to access, modify, create an alternative for and remove anything from the page, including UI elements, object prototypes, storage assets and network activity.
Cybercriminals understand the power that JavaScript has. They target weaknesses in this code, thereby gaining access to every website that uses it. The goal is to steal PII and payment information. This stolen data fuels a continuous cycle of cyberattacks, including credential stuffing, carding and account takeover (ATO). Here are a few of the vulnerabilities that are commonly exploited in supply chain attacks:
- DOM Modification: The Document Object Model (DOM) is a programming interface for web documents that represents a webpage and the relationship between all of its elements. It allows JavaScript to interact with and modify a page. By modifying the DOM, malicious JavaScript can display fake content, serve unauthorized ads, show a made up form asking for PII and PCI information, and make other changes to a webpage.
- Browser Storage Data Access: Today’s browsers support cookies, session storage, local storage and other types of web storage, all of which usually hold sensitive user data. Third-party JavaScript likely has the ability to read and modify this storage. If cybercriminals exploit this code, they can access or change PII, social network tokens, affiliation codes, session keys, user histories and clickstreams.
- Network Sniffing and Manipulation: JavaScript code can extend or modify supporting system software locally to change network call parameters, content, headers and target domains — also known as a monkey patch. In addition, it can clone its entire content and modify the target, thus replaying the same network request. Cybercriminals can abuse this capability to fake the appearance of a browser or a web application.
- Data Harvesting: JavaScript can monitor browser events, form field input changes and user interactions, and collect the data. If the code is compromised, any data on an application could be stolen and exfiltrated by cybercriminals.