Security issue in Website Optimizer

This morning we woke up to an alert from the Google Website Optimizer Team titled “Security issue in Website Optimizer” that has since been verified as legitimate by Search Engine Land amongst others.

The full text of the email & instructions to remedy your experiments is below:

Dear Website Optimizer user,

We are writing to inform you of a potential security issue with Website Optimizer. By exploiting a vulnerability in the Website Optimizer Control Script, an attacker might be able to execute malicious code on your site using a Cross-Site Scripting (XSS) attack. This attack can only take place if a website or browser has already been compromised by a separate attack. While the immediate probability of this attack is low, we urge you to take action to protect your site.

We have fixed the bug, and all new experiments are not susceptible. However, any experiments you are currently running need to be updated to fix the bug on your site. Additionally, if you have any Website Optimizer scripts from paused or stopped experiments created before December 3, 2010, you will need to remove or update that code as well.

There are two ways to update your code. You can either stop current experiments, remove the old scripts, and create a new experiment, or you can update the code on your site directly. We strongly recommend creating a new experiment as it is the simpler method.

Creating a New Experiment

  1. Stop any currently running Website Optimizer experiments
  2. Remove all the Website Optimizer scripts from your site
  3. Create a new experiment as normal. New experiments are not vulnerable.

Updating the Website Optimizer Control Script Directly

  1. Locate the Control Script on your site. It looks like this:

A/B Test Control Script
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='XXXXXXXXXX',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<_x0030__x003f_c.length:j_x0029__x007d__x007d__x007d_var x="f('__utmx'),xx=f('__utmxx'),h=l.hash;">
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" charset="utf-8"></sc'+'ript>')})();
</script><script>utmx("url",'A/B');</script>
<!-- End of Google Website Optimizer Control Script -->

Multivariate Test Control Script
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='XXXXXXXXXX',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->

  1. Locate the following in the Control Script: return c.substring(...
  2. Modify the following line as shown:
    BEFORE: return c.substring(i+n.length+1,j<0?c.length:j)
    FIXED: return escape(c.substring(i+n.length+1,j<0?c.length:j))
    Make sure to include the final closing parenthesis “)”

Fixed A/B Control Script
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){} (function(){var k='XXXXXXXXXX',d=document,l=d.location,c=d.cookie;function f(n){ if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);
return escape(c.substring(i+n.length+1,j<0?c.length:j))}}}
var x=f('__utmx'),xx=f('__utmxx'),h=l.hash; d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" charset="utf-8"></sc'+'ript>')})();
</script><script>utmx("url",'A/B');
</script>
<!-- End of Google Website Optimizer Control Script -->

Fixed Multivariate Control Script
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='XXXXXXXXXX',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);
return escape(c.substring(i+n.length+1,j<0?c.length:j))}}}
var x=f('__utmx'),xx=f('__utmxx'),h=l.hash; d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->

Note that the k=XXXXXXXXX line in the above Control Script examples is a placeholder.

Your experiment will continue as normal after you’ve made this update. There’s no need to pause or restart the experiment.

We’re committed to keeping Website Optimizer secure, and we’re deeply sorry for this issue. We will continue to work hard to prevent future vulnerabilities.

End of Message

– – – – – – – – –

A handful of our clients use Google Website Optimizer and it is a solid (and free) tool.

Security issues like today’s email, however, highlight why we prefer to use our internal “Natural Selection Engine” for our client’s website optimization.

Contact us today to increase your Conversion Rate . . .

We put our money where our mouth is – click here to contact us today and learn how we can drastically increase your website conversion rate for no money up front, and backed by our $10,000 guarantee!

Talk to a conversion rate expert now

Contact Us

One thought on “Security issue in Website Optimizer

  1. Keith,
    Zack,

    Thanks for the update. Your readers may be interested in a simple Google Optimizer Code checker at

    https://www.observepoint.com/optimizer-test.php

    You just enter the URL of the page in question, and it will tell you whether the google website optimizer code is up-to-date, and if it needs to be edited, it will tell you what to change and where to change it.

Leave a Reply

Your email address will not be published. Required fields are marked *