Malvertising: Distributing Malice via Cross-Domain Script Inclusion

Recently, malvertising (malicious advertising on the Internet) attack mechanism has been opted by the attackers to infect Equifax ( ) and Transunion ( )credit bureau websites.

In malvertisements, the malicious code is injected in the third-party libraries hosted on the Content Delivery Networks (CDNs) or any other third-party domain. A Content Delivery Network (CDN) is a third-party ad server that provides content to different domains across the web. CDNs are the preferred choice for attackers to spread malware by exploiting the CDN web servers — the attackers can simply let the servers assist in spreading the malware. Advertisements use Flash, Silverlight, pop-ups, Windows Media Player files and Javascript extensively. However, this is a grave concern because if a CDN server is exploited, the attacker can inject malicious code in the form of malvertisements and that code is widely distributed. There is a chain reaction because if a parent server is infected, the child nodes will automatically get infected, too. Corrupting a server that serves thousands of sites spreads the malvertisements broadly and often in a trusted manner.

Attack Flow

  • The attacker analyzes the scripts that are included in the target website from the third-party domain.
  • The attacker compromises the third-party domain, injects malicious code and then let the attack trigger.
  • When user opens the primary website in browser, the scripts are included from the cross domain injected with malicious content and served to the end-users.

Browser Exploit Packs (BEPs) infections have also been triggered using malvertisements. In this scenario, primary website has not control as it simply includes the script hosted on server that is not managed and operated by the primary website. This attack mode is used to distribute infections to a large number of users on the Internet.

As you can see, CDNs have the potential to be a big problem with respect to web malware.

In our earlier paper, Malvertising — Exploiting Web Advertising, we covered different malvertisements attack scenarios as listed below:

  • Malvertising with malicious widgets and redirection
  • Malvertising with hidden iframes
  • Malvertising with infected Content Delivery Networks (CDNs)
  • Malvertising through Malicious Banners



Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store