Extra Adverts showing in Chrome?

For the last few weeks I’ve noticed unusual floating adverts from superfish.com on amazon.co.uk, focalprice.com and other shopping sites but I couldn’t figure out what was causing it. Turns out I’m not the only one to notice them.

superfish floating advert

It was an extension I had installed in Google Chrome. I went through each of the extensions I have installed, checking the options for each. Some didn’t have any options page and only one mentioned adverts at all but it wasn’t the Superfish one. With those checked I disabled each extension one by one, reloading Amazon until the advert went away.

I found it. “Flash Video Downloader” version 2.3.5 (id: ggkfikfcbnpfoicfjammigpnakpogebh) was responsible for the adverts. Authors of software want to be paid but this was very underhand. The extension has no options page and doesn’t mention adding Superfish adverts on the extensions page. It’s also a reminder of how much trust we put into the authors of software with access to our personal and private data. Since finding this I found the CNET download page and reviews for the extension. The latest reviews warn of the added malware:

Pros
Flash Video Downloader used to be an easy & safe product to download flash-based videos embedded into various websites.

Cons
They’ve secretly slipped Adware/Malware into their product (Superfish “Featured Shopper”). Flash Video Downloader obviously tracks your browsing history (that’s how it know’s when there’s a flash video available to download)… who knows where your browsing data is going now that they’ve got AdWare/Malware involved.

Also, Flash Video Downloader recently removed support to download YouTube videos. (I suspect Google/YouTube probably forced that change for copyright purposes.)

Summary
With Adware/Malware added to the product and YouTube support removed removed, I suspect most users will no longer find this product helpful or safe to use.

The extension isn’t on the Chrome Web Store. The last time I went searching I couldn’t find a decent one on there but maybe that has changed since. I don’t want to pirate Youtube videos. Sometimes I just want to watch a gameplay video offline!

If you thought software development was hard …

shot4-550x412

You should read about the development of a Ludum Dare entry called Ponk.

It’s a C64 version of Pong, developed on a real C64 with only a C2N datasette to save code. Back in the day I was lucky enough to have a 1541-II disk drive. I can’t imagine how painful it must have been working with a slow and unreliable cassette.

datassete

In the end he couldn’t transfer his game to a PC so he had to take screenshots of his game and OCR them, hand checking every byte. I did something similar about 20 years ago when I was tinkering with a C64 to Amiga cable and needed to somehow transfer a C64 programme from the Amiga to the C64 to do the transfer .. Painful.

playing

Wow. Well done Sosowski. (via Indiegames)

mfunc in WP Super Cache 1.4 and beyond

WP Super Cache is a full page caching plugin for WordPress. It creates static pages that are served quickly by the web server. Sometimes however, users still want parts of their pages to remain dynamic and be non static. That’s where mfunc, mclude and dynamic-cached-content came in.

Security

Unfortunately it was reported recently that remote visitors to sites using the plugin could execute any code they like by simply leaving a comment containing the right mfunc code. These functions are now disabled by default, and a filter removes harmful code from comments but if enabled they pose a security risk. I considered adding a security code to the mfunc tag but unfortunately the best way of dealing with this problem is to replace it completely with something different. The next release of the plugin will do away with mfunc, mclude and dynamic-cached-content entirely.

The new dynamic cache system

The development version of WP Super Cache has already been updated with a new filter based system. It uses a cacheaction filter called “wpsc_cachedata”. This filter runs when a page is first cached and also when a cached page is subsequently served. It also runs when caching is disabled for known users, something that has always been broken when using mfunc.

Almost all the data that is displayed on your website will run through the cacheaction filter “wpsc_cachedata”. When a page is first cached, the data that is shown to the first visitor of that page goes through that filter. The second visitor gets a cached page and that page too goes through the filter. What this allows us to do is define a template tag (or more than one) that a function hooked on that filter can search for in the filtered data. It can replace that tag with some other text, usually derived from code that has to run on each request. The visitor is then shown the page with the replaced tag.

Example code

The readme.txt hasn’t been updated yet but an example plugin, dynamic-cache-test.php is included in WP Super Cache. It’s fairly simple but it’s documented so it should be easy enough to follow. A template tag is inserted at the bottom of the page using the wp_footer action, and a filter then replaces that tag with text and the current server time. That test plugin replaces mfunc code that would look like this, excluding the necessary code to hook on to wp_footer and print it.

<!--mfunc echo "<!-- Hello world at " . date( 'H:i:s' ) . " -->"; -->
<?php echo "<!-- Hello world at " . date( 'H:i:s' ) . " -->" ?>
<!--/mfunc-->

WP Super Cache has it’s own action hooks using add_cacheaction() and do_cacheaction(), and work like WordPress actions or filters. The reason the plugin needs those is because they are available before WordPress is loaded. They allow developers to hook into the plugin from the very start of the PHP process and modify how it works using plugins. Those plugins are usually copied into wp-super-cache/plugins/ but I encourage you to move that directory elsewhere because when WordPress updates the plugin it will delete any custom changes you make. The next time a new version of WP Super Cache comes out WordPress will delete the wp-super-cache folder, replacing it with the new update. In your wp-config.php set $wp_cache_plugins_dir to the location of the new plugins directory.

If you use this filter system in your own plugin for distribution do not ever define the template tag for the user. Let the user decide what it is or generate a random tag and save it somewhere. It’s important to keep the tag secret so visitors cannot trigger your function maliciously. It is however better than the remote user running any code they like as was the case with mfunc!

I hope to release a new version with this code late next week. If your plugin or site uses mfunc please download the development version on a test server and start the process of updating your code.
On the other hand, if you don’t want to update your mfunc tags you could try W3 Total Cache instead. It uses the mfunc tag with a secret code.