A mitigation for this sort of thing: your Wordpress installations can be owned by someone other than the webserver, with 644/655 permissions. This will prevent folks from uploading arbitrary code (through any of the NUMEROUS plugins/themes with a vulnerability that allows them to do that), and also prevents folks from appending malicious code to known files.
You could also "cat /usr/local/wordpress/wp-config.php" and see the plaintext mysql username/password and inject malicious data into the DB, create/drop tables or databases depending on access level.
Problem is that then you can't auto install themes, auto update wordpress - and the script causing this vulnerability requires a writable cache directory under the wordpress root.
My WP theme is from WooThemes and it includes "thumb.php" which upon inspection is timthumb.php. The blog post says to patch this you should remove the list from the allowedSites variable which I have done... I'll look at this more tomorrow but just FYI!
Great writeup. It's clear, it's concise and it's not overly dramatic. Thanks for taking the time to write this up and share it.
I have invested a bit of time installing and tuning mod_security. I'd love to know how it'd have faired against this attack, probably it wouldn't have stopped the upload, but it might have stopped a lot of payload/control commands from working.
While it's concise and not overly dramatic, lots of people run Wordpress on shared hosting. That generally means they don't have SSH access and the instructions are harder to follow... It needs a "for beginners" section on how to check and accomplish the steps.
I invest time in doing things like looking over any third party libraries for stuff like this, too. The quality of the average WordPress plugin is quite low, and I'm surprised we don't hear about issues like this more often.
I did a series on talks on Wordpress security earlier this year at OWASP London and AppSec EU. Sadly the AppSec slides were lost but the OWASP slides are still there for anyone interested:
I used to see so many security problems with xmlrpc.php, and never used the functionality, so I put in a cron job entry that did this for all blogs I had hosted:
I bought my theme from Theme Forest and it has this vulnerability. If you have a theme that you've purchased and contains this file, it would be helpful to post this on the theme's support forum.
Exactly what I thought upon reading "The current version of timthumb has this issue. Since it’s already in the wild and I just got hacked by it, I figure it’s ok to release the vulnerability to the general public."
is sufficient to cause it to download payload.php and cache it. Afterwards, you can access the PHP file in the same manner to execute it.
One could trivially make a list of signatures for vulnerable themes (for example, all the ones I paid for from a certain prominent Wordpress themes company), and then exploit any website whose main page matched a signature. Alternatively, you could just speculatively hit a few hundred URLs on every domain you found.
Wordpress gets no opportunity to execute a single line of code at any point in this process. TimThumb can be executed without needing to go through Wordpress at any point. The only relevance of Wordpress to this is that many Wordpress themes happen to ship with TimThumb. If you have a Wordpress theme installed on your server (note: activation not required!) which ships with it, you are vulnerable.
Wordpress could theoretically intercept calls to PHP files below its own root, but that would be a breaking change for a LOT of code and sites.
The problem is that timbthumb.php is usually contained within themes or plugins. There's quite a few small php libraries with little insecurities dotted all around the web and sometimes theme and plugin developers tend to use a version and stick with it.
Realistically the best thing that could happen is that plugins like WP-Security Scan could check for timbthumb.php's presence and warn you.
[+] [-] patio11|14 years ago|reply
[+] [-] d2|14 years ago|reply
[+] [-] d2|14 years ago|reply
[+] [-] cosgroveb|14 years ago|reply
[+] [-] mrspeaker|14 years ago|reply
[+] [-] muppetman|14 years ago|reply
I have invested a bit of time installing and tuning mod_security. I'd love to know how it'd have faired against this attack, probably it wouldn't have stopped the upload, but it might have stopped a lot of payload/control commands from working.
[+] [-] joelhaasnoot|14 years ago|reply
[+] [-] code_duck|14 years ago|reply
[+] [-] _b8r0|14 years ago|reply
https://www.owasp.org/images/d/db/Wordpress-security-ext.pdf
[+] [-] gbrindisi|14 years ago|reply
[+] [-] ecaron|14 years ago|reply
[+] [-] davidw|14 years ago|reply
[+] [-] code_duck|14 years ago|reply
[+] [-] billpg|14 years ago|reply
That's not an option on a surprising number of web hosts offering PHP hosting. You'd have to find the file using FTP instead.
[+] [-] ck2|14 years ago|reply
[+] [-] rozim|14 years ago|reply
[+] [-] qeorge|14 years ago|reply
[+] [-] teyc|14 years ago|reply
[+] [-] tansey|14 years ago|reply
I bought my theme from Theme Forest and it has this vulnerability. If you have a theme that you've purchased and contains this file, it would be helpful to post this on the theme's support forum.
[+] [-] mildweed|14 years ago|reply
[+] [-] teyc|14 years ago|reply
[+] [-] code_duck|14 years ago|reply
[+] [-] dangrossman|14 years ago|reply
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] hluska|14 years ago|reply
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] headShrinker|14 years ago|reply
php resize crop and cache source.
[+] [-] lfx|14 years ago|reply
[+] [-] patio11|14 years ago|reply
Accessing
is sufficient to cause it to download payload.php and cache it. Afterwards, you can access the PHP file in the same manner to execute it.One could trivially make a list of signatures for vulnerable themes (for example, all the ones I paid for from a certain prominent Wordpress themes company), and then exploit any website whose main page matched a signature. Alternatively, you could just speculatively hit a few hundred URLs on every domain you found.
[+] [-] nbpoole|14 years ago|reply
[+] [-] sogrady|14 years ago|reply
[+] [-] dangrossman|14 years ago|reply
[+] [-] inconditus|14 years ago|reply
[+] [-] adamzap|14 years ago|reply
http://code.google.com/p/timthumb/source/list
[+] [-] quizbiz|14 years ago|reply
[+] [-] patio11|14 years ago|reply
Wordpress could theoretically intercept calls to PHP files below its own root, but that would be a breaking change for a LOT of code and sites.
[+] [-] _b8r0|14 years ago|reply
Realistically the best thing that could happen is that plugins like WP-Security Scan could check for timbthumb.php's presence and warn you.
[+] [-] ck2|14 years ago|reply