Skip to main content

Google Website Optimizer Security Issue


If you're a Google Website Optimiser user then you've probably already received and read the email below. If you've not, but do use Google Website Optimiser, then you may need to update your code to prevent an XSS attack.

There's no mention of the fix or issue on http://websiteoptimizer.blogspot.com/, but in the interests of getting people up to speed as quickly as possible here is a copy of the email containing the fix needed, with thanks to Trevor Claiborne from Google.

This applies to any scripts created before December 3rd, 2010.



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<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)):'')+
    '" type="text/javascript" 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)):'')+
    '" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
    </script>
    <!-- End of Google Website Optimizer Control Script -->


   2. Locate the following in the Control Script: return c.substring(...
   3. 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)):'')+
    '" type="text/javascript" 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)):'')+
    '" type="text/javascript" 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.


Sincerely,
Trevor
Google Website Optimizer Team

Comments

Popular posts from this blog

Which blog engine?

So the time has come to move to a more advanced blog engine for my blog. blogger.com , Google's blogging service, has served me well. It's incredibly easy to use and to get started with, along with having some great features such as inbuilt stats; however now I need a few more advanced features and greater control over the blog. There's a vast array of blog engines out there, some free, some paid for, some hosted, some self-hosted, and picking which one is best or the right choice could be a little bit tricky. This article from Mashable lists most of the main options and bigger players -  http://mashable.com/2007/08/06/free-blog-hosts/ . There are a few parameters that I've kind of decided on Ease of installation/compatibility and support with web hosts Simple to use. I don't want to spend ages clicking around just to add a post or format it. Feature rich and well supported. Most blog engines should have a fairly standard set of features now such RSS/ATOM fe

Enable .NET 8 Preview in Visual Studio

Download the SDK using Download .NET 8.0 (Linux, macOS, and Windows) (microsoft.com)  and install it. To enable projects to target the .NET 8 preview framework, the preview option in Visual Studio needs to be enabled, otherwise the option to target .NET 8 will not be available as shown below when setting up a new project (or trying to upgrade an existing one). To allow .NET 8 Preview to be used as a target framework for projects, the preview option needs to be enabled in Visual Studio. Open Visual Studio and select "Continue without code" In Visual Studio, select Tools then Options In Options, under Environment, select Preview Features and enable Use previews of the .NET SDK.

SQL Server - Remove Non-Alphanumeric Characters from String

The following SQL function will remove and strip all non-alphanumeric characters from a string. CREATE FUNCTION [dbo].[fncRemoveNonAlphanumericChars](@Temp VarChar(1000)) RETURNS VarChar(1000) AS BEGIN WHILE PatIndex('%[^A-Za-z0-9]%', @Temp) > 0 SET @Temp = Stuff(@Temp, PatIndex('%[^A-Za-z0-9]%', @Temp), 1, '') RETURN @TEmp END Example: SELECT dbo.fncRemoveNonAlphanumericChars('abc...DEF,,,GHI(((123)))456jklmn') Result: abcDEFGHI123456jklmn