Timthumb Vulnerability Renders Many Wordpress Sites Blocked by Google

Timbthumb vulnerability renders wordpress on the Google AlertThe Google Malware warnings started popping all over the internet early this month and even now, sites are still being infected by autonomous internet scripts.  If you’re running a WordPress site with a custom premium theme, you might already be seeing the above message when you try to visit your website (hopefully not….).  The problem lies with a vulnerability recently discovered in a popular image manipulation script called Timthumb.  The script is very popular among premium Wordpress Themes which makes this exploit particularly dangerous being that exploit code has been in the wild for several weeks already.  The good news is, I’m going to review not only how-to detect if you’ve already been infected but also how-to patch your blog to prevent getting infected in the first place.

How to check if you have a problem

Other than seeing a warning in Chrome similar to the one above while visiting your site, there are two easy ways to see if your WordPress installation has been infected.

The first is an external wordpress scanner designed by Sucuri:

The second is a server side script that you upload to your site and then load from a web browser.  This is available at and will have to be renamed after download as per Sucuri’s instructions below:

    1. Save script to your local machine by right clicking the link above and save link as
    2. Login to your site via sFTP or FTP (We recommend sFTP/SSH)
    3. Upload the script to your root WordPress directory
    4. Rename sucuri_wp_check.txt to sucuri_wp_check.php
    5. Run the script via browser of choice – – Make sure you change the URL path to your domain and wherever you uploaded the file
    6. Check the results

If the scanners pull up anything infected, you’ll want to directly remove the infected files immediately.  But, even if the scanners show “all clear” you likely still have a problem with your actual timthumb installation.

How do I fix it?

First, if you haven’t already done so –backup and download a copy of your WordPress directory, and your MySQL database.  For instructions on backing up the MySQL database see the Wordpress Codex.  Your backup may contain junk, but it’s better than starting over from nothing.

Next, grab the latest version of timthumb at

Now we need to secure the new timbthumb .php and make it so external sites cannot activate run scripts. To do this follow these steps:

  1. Use a text editor like Notepad++ and go to line 27 in timbthumb.php –  It should read $allowedSites = array (
  2. Remove all of the sites listed such as “” and  “”
  3. After removing everything the parenthesis should now be empty and closed like this: $allowedSites = array();
  4. Save changes.

allowed sites array in timthumb

Okay, now that your new timbthumb script is secure, you’ll need to connect to your website’s server via FTP or SSH.  In most WordPress custom themes that use timbthumb, it is located in the wp-content\themes\[themename] folder.  Delete the old timbhumb.php and replace it with the new one.  If you have more than one copy of timbthumb on your server you’ll need to be sure to replace ALL of them –note that sometimes they will just be called thumb.php.

timbthumb on filezilla ftp server

Once you have updated timbthumb on your web server and cleared out any of the files that were detected by the above scanners, you’re more or less good to go.  If you think you might be upgrading a bit to late and you might already be infected, you should contact your web host immediately and ask them to do a full AV scan of your web server.  Hopefully then can help fix ya up otherwise you might need to revert back to a backup.



  1. Renji

    August 26, 2011 at 12:17 am

    Latest version of timbthumb (v2) has fixed this vulnerability.

    • MrGroove

      August 26, 2011 at 12:53 am

      Hi Renji – True. I should mention that removing the externals sites from the $allowedSites = array in step 4 above is mainly just for added security but not a requirement. Personally I prefer this config since I host all the images in my articles on my own host vs. using an external image site.

      Thnx for the comment.

  2. I have

    April 21, 2012 at 2:39 am

    I love this blogging site! The material is invaluable. Thanks for all of the posts and making my personal morning. Regards!!

Leave a Reply

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


To Top