Zero-day bug found in WordPress themes

A bug in a popular WordPress utility is being misused by attackers to upload and make appear on the targeted site annoying and possibly malicious content.

The bug was discovered by Mark Maunder, the CEO of Feedjit, when he loaded his blog and an ad that should not have been there popped up.

After digging through the code, he narrowed down the problem to TimThumb, an image resizing utility that is widely used by many WordPress themes. In fact, when Googling the timthumb.php script, more than 39 million results show just how widespread its use is.

“The utility only does a partial match on hostnames allowing hackers to upload and execute arbitrary PHP code in your timthumb cache directory,” explains Maunder. “Timthumb.php is inherently insecure because it relies on being able to write files into a directory that is accessible by people visiting your website.”

Curiously enough, TimThumb’s developer’s own site was hacked in the very same way. In a comment on Maunder’s blog post, he apologized for the oversight in the code and said he hopes that his error didn’t lead to too many problems.

“At the moment the best fix is to simply use the latest version of TimThumb,” he shared. “There have been a stack of tweaks that will make the script harder to abuse.”

For those who want to be absolutely sure that the script won’t be misused by attackers, the best thing to do is to remove the file using rm timthumb.php for the time being, and make sure the removal didn’t affect the theme.

Also, there are a lot of themes in which the name of this script has been modified to thumb.php, so search for that as well.

UPDATE (August 9): The vulnerability has been patched in version 2.0 of the TimThumb script, which you pick up here.

Don't miss