Friday, June 4, 2010

Third-party JavaScript widget discovered to be infected with malware

Potentially thousands of legitimate websites that embed the widget are serving malware to their users.

Many websites use third-party JavaScript widgets for counting traffic, tracking users, sharing content, displaying video, enabling polls, and providing other user functionality. The use of third-party widgets has enabled rich user functionality and analytics. However, as noted by Jeremiah Grossman in his blog post "Web 2.0 pivot attacks", in a security context, websites that use third-party widgets "essentially allow arbitrary executable code, supplied by a third party, complete access to the web page DOM and the user’s session information." This could, of course, be used to infect the website’s users with malware. Tom Stripling also discusses the dangers of third-party JavaScript widgets, as well as user contributed content.

In a research paper published by Google titled “The Ghost in the Browser,” researchers claimed that third-party widgets were one of the primary vectors of attack for a website to get infected with malware.

We identified a free statistics counter that operated fine for almost four years, “when the nature of the counter changed and instead of cataloging the number of visitors, it started to exploit every user visiting pages linked to the counter… In this particular case, the user visited a completely unrelated web site that was hosting a third-party web counter. The web counter was benign for over four years and then drastically changed behavior to exploit any user visiting the site. This clearly demonstrates that any delegation of web content should only happen when the third party can be trusted.”

Just this past weekend, the Dasient security research team identified a third-party JavaScript widget that was responsible for infecting web users at a large Quantcast 100 website. The third-party widget in question was from a reputable market research and analytics firm, and the widget was used for traffic analysis and audience demographics. (Our team has been in contact with the Quantcast 100 website, and is also reaching out to the widget provider in order to help resolve this problem.)

This third-party JavaScript code was included among a number of other tracking tags present on several thousand URLs of the Quantcast 100 website. The JavaScript code (after being anonymized) is as follows:

// xxxxxx tagging
XXXX.require('//', function () {
var trac = nol_t({
cid: 'xx-xxxxxxx',
content: '0',
server: 'secure-us'

In turn, served the following complicated JavaScript code:

function NolTracker(b,a){this.pvar=b;this.mergeFeatures(a)}function nol_t(b,a){return new NolTracker(b,a)}NolTracker.prototype.version="6.0.9";NolTracker.prototype.scriptName=(function(){try{var b=document.getElementsByTagName("script");var c=b[b.length-1].getAttribute("src").match(/[^\/]*$/)}catch(a){}return c||"xxx.js"})...

At the end of the complex JavaScript was a malicious iframe sourcing in content from:
http://94. 75. 210. 6/measure/

What is notable about the attack above is that the JavaScript code is so complex, it would be difficult for even a technical person to parse the code quickly and identify the malicious iframe at the end. Furthermore, the attackers have used the pathname "measure" on the malicious domain in an effort to further obfuscate their attack. As a result, a technical person who was investigating the cause of the malware might not pay attention to the iframe; he or she could easily assume that this was part of the legitimate JavaScript code that was measuring user traffic on the website.

The attackers compromised this third-party analytics provider's JavaScript code and embedded the malicious iframe. A quick search on Google for the JavaScript code showed over 19,000 results of websites which contained this provider's analytics code. Thus, the attackers were able to stripe their web-based malware over thousands and thousands of legitimate websites (including multiple Quantcast 100 websites) by infecting the third-party analytics provider's JavaScript code with the malicious iframe.

There is a significant implication for web businesses. The "widgetization" of the web will continue to create opportunities such as the one detailed in this post for attackers to infect legitimate websites with malware. Any third-party code included in a legitimate website can be compromised and exploited to serve malware. In fact, the attackers have an incentive to infect these JavaScript widgets as a way to achieve scale and get "back door access" to popular websites. The concern for web businesses is that, despite all of the security operations and software development practices that they may have in place, there are dependencies on third-parties for rendering functionality on web pages on their site. And a particular web business has no control over the security practices of the third-party partner, which can get compromised, as was evident from the attack described above.

It is unrealistic to believe that web businesses will be able to remove all third-party software and JavaScript code from their websites. The "widgetization" of the web will only accelerate, as the trend towards distributed software development, interactivity, and combining best-of-breed software and widgets continues. Despite a web business having significant preventative security measures in place, its website is vulnerable to serving malware due to the use of third-party JavaScript widgets. Therefore, it is critical that web businesses monitor their websites (and thus their third-party JavaScript widget providers) for malware on a regular basis. An attack where a reputable partner gets compromised and infected with malware could happen any time, and it is important that the web business can respond immediately if such an attack occurs. Otherwise, the web business is at risk of serving malware to its users, which would result in users getting infected with malware; significant losses of brand, reputation, and revenue; and potential liability issues. Companies can use Dasient's Web Anti-Malware (WAM) monitoring service to defend their websites against the prospect of third-party widgets getting infected with malware.


  1. Great article about a massively underrated risk. But it occurs to me that this is less likely and less damaging than malicious libraries on the server side-which is probably even more ubiquitous than this problem. The malicious library is easier to obscure and far more difficult to detect. But more importantly, the damage is complete application takeover-and perhaps takeover of the host and other backend systems. Yet virtually nobody looks at libraries.

  2. Very Good! These are wonderful! Thank you for sharing!
    my Blogs: cityville cheats | how to get taller

  3. check my blog out everyone say everyone say wat you think :)

    1. I Like your blog,will sharing this with my friends, excellent work.
      business phone deals


    The attackers compromised this third-party analytics provider's JavaScript code and embedded the malicious iframe. A quick search on Google for the JavaScript code showed over 19,000 results of websites which contained this provider's analytics code.

  5. Hello I must say for this well prepared information.I am now bookmarking this website for future reference.Keep up the good work. agen judi bola online, ibcbet indonesia, 338a royal casino

  6. Then Document prodded the dog once. "Do men of all ages want to utilize big, tight-fitting, extravagant tuxedos " The person reckoned in a few moments and reacted basically no. check out my site

  7. This information provides a great help to overcome the problems face by malware. Students buy essay online UK because they have insufficient knowledge.

  8. Contractors and other participants need to create time dedication to be present at the Show and do their preparation in advance so they know who they want to see and what they want to talk about. TUBE

  9. But Little wasn’t even near to completed securing horns with LG&E. Actually, she was getting ready to take on other coal-burning causes, as well, journeying outside of Louisville to help areas experiencing similar situations. to enjoy live webcam services with shemale click here

  10. One specialist informed me that while in business university he took part in SkillsUSA Nationwide Management and Abilities Competition, successful first place in a couple competitions. venus factor reviews

  11. Congratulations Neil, Ameet, Dasient team! Outstanding product and service in the web security space.

  12. If you need some item or set up details, it is often much much better to find your solutions on the internet than to contact. venus factor weight loss

  13. Thus purchasing lengthy lasting ties is only inflationary if the industry requires it as a indication that the Fed is getting serious about enhancing rising prices eventually. Google

  14. I'm going to subscribe to this blog because it's very interesting. Friv | Kizi 1 | Y4

  15. Shameless connect here — don’t skip the Fab Five as they existing “The Technological Town Hall” at AHR Jan 28 at 1:00 p.m.I lately taken up with Indicate Halligan, CEO of H+A Worldwide, Chicago, illinois, il, about the very subject of organization events. Indicate has a success of experience with preparing organization events and he has hand to create AHR the effective display that it is nowadays. joey atlas' naked beauty symulast method

  16. Often it is the surprising lack of way of life of someone near that provides this home; and then the frequency of hospital visits and memorials progressively starts to select up amount, like a drumbeat in the woodlands. old school new body forum

  17. Great buy for the price! I received the item in a day or so and I was able to complete a photo project I had been working on! It also shuts the feeding ports when they put enough weight on the ring. old school new body pdf free download

  18. He approved NAFTA and GATT, redeveloped the govt, and decreased well being.
    check this site out

  19. The presentation of skills certainly shows more excellent work. I appreciate the significant posting the most excellent thought. This topic posted by you is trustworthy. 
    Assignment help UK

  20. Thanks for your insights, John. Glad to hear that you’re crushing it with YouTube SEO (even without any views and likes). It looks like it’s all about backlinks for videos too. ibcbet online, taruhan bola terbesar