TimThumb Image Resizer and Website Security

TimThumb is no longer supported or maintained.
More information →

My friend Alex Denning recently asked me to write some bits about TimThumb for an article he was putting together.

The main purpose of TimThumb was to dynamically resize images on websites, making it easier for web developers to manage their content. Unfortunately it was vulnerable to hacking and many sites were infected because of it.

Shockingly, even today, there are still tens of thousands of sites out there using TimThumb, unknowingly putting themselves at risk.

Fortunately nobody has contacted me about it for a while now so I think use has reduced a lot, but as the article shows there are still a lot of sites using it.

My Memories of TimThumb

Anyway - Alex (or someone in his team) wrote the article which you can see here. The full text I wrote for Alex is below.


Back when we created TimThumb, WordPress didn’t have image thumbnails, so we saw it as a really cool way to enhance website aesthetics. We built it to include in our premium themes that we were about to release, but we didn’t anticipate its popularity. WordPress Theme Shops were still a new concept, so other theme shops like WooThemes bought our theme to use the image resizing script.

At the time, GitHub didn’t exist, so when we open-sourced it, we hosted it on Google Code. The first indication that something was wrong was when my own site was defaced. Someone had changed my footer to link somewhere else. Unsure of the cause, I reverted it and ensured everything was up to date. Fortunately, this was before hackers started introducing backdoors, so it didn’t happen again.

A couple of days later, reports emerged that TimThumb was hacked, and my heart sank. I felt super guilty and spent a lot of time over the next few days trying to make it more secure. Meanwhile, a developer named Mark Maunder was rewriting TimThumb to make it (hopefully) bulletproof, and Matt Mullenweg introduced us. We joined forces to release a more secure TimThumb that was backward-compatible.

Mark went on to found WordFence, a company focused on website security.

The vulnerability arose from a few different factors:

  1. I had allowed resizing of external images, which meant files from other websites could be loaded.
  2. I enabled data caching for those external files without performing any file type checks to ensure they were images, not code.

Besides feeling really bad about the damage I had caused, I learned a lot from this experience. Since it happened, I have been a lot less trusting of people online and have released a lot less code than I think I might have otherwise. In the projects I have been involved with, I have become very vigilant when it comes to data sanitization and ensuring it is as secure as possible.

How was it for you? Let me know on BlueSky or Mastodon

(Please) Link to this page

Thanks for reading. I'd really appreciate it if you'd link to this page if you mention it in your newsletter or on your blog.

Related Posts

01 Apr 2015

The State of WordPress Themes #wcldn

I recently spoke on a panel at WordCamp London 2015e. Lance – who used to be the Theme Team lead at WordPress.com – asked me if I wanted to speak on a panel with him at WordCamp London 2015. I’ve...
27 May 2013

WordPress: 10 Years Young, What Does The Future Hold?

WordPress is now 10 years old. I started using wordpress 9 years ago – which means I joined the WordPress community early on. The reason I chose WordPress is simply because of the fabled 5 minute install process – I...
01 Mar 2019

Open Source Sustainability

A lot of the internet is powered by open source technology. WordPress being a perfect example. This article looks at the practices behind open source development and considers just how sustainable it all is.One story looks at OpenSSL and how...
20 Feb 2013

The Amazing Art of Flipping Websites

Recently I have looked at expanding my internet empire. I have all sorts of ideas and never enough time – so I thought I would see if I could buy some websites relatively cheaply, improve them, and then either flip...
08 Aug 2013

The Death of WordPress Theme Frameworks

WordPress theme frameworks are on their way out. They’re dying a slow death. At least that’s what I think.Nathan Rice recently wrote an article with his thoughts about theme frameworks – in defense of them – however he clearly has...
01 Jul 2014

I No Longer Use TimThumb – Here’s What I do Instead

Last week there was a second exploit found in TimThumb. Thankfully it was no-where near as bad as the first one – but it raised an interesting question of whether TimThumb is even needed anymore.TimThumb was made to be useful...