Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Hacked
PostPosted: Sat Mar 17, 2012 10:29 pm 
Offline
Junior Member

Joined: Sun Jul 31, 2011 5:03 pm
Posts: 49
Website: http://www.clubpenguincheatsy.com/
AOL: thefiame12
Location: GA
I believe my site was hijacked somehow and I really need help patching the exploit somehow. I use Wordpress, and when I went to my admin panel, this is what I saw:

http://i.imgur.com/8Kjpn.png

There were also files on my server that I didn't upload.

I can restore the site to an earlier date, but how do I stop this from happening again?[/img]


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 12:00 am 
Offline
Senior Member

Joined: Fri Jan 20, 2012 11:19 am
Posts: 100
The best thing you can do to prevent future exploits is to ensure that your Wordpress software (and any other software for that matter) is up to date.

If it is that you are running the latest Wordpress, check any other custom written scripts and other software that you may have running. The server logs may be helpful in finding out how exactly the attacker gained access.

You may also want to take the opportunity to change all passwords on the system.

From the image I see that the files belonging to your Wordpress installation belong to www-data. Is there any particular reason for that?

_________________
If all else fails, reboot...
PHP Tutorials and MySQL Tutorials


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 12:21 am 
Offline
Junior Member

Joined: Sun Jul 31, 2011 5:03 pm
Posts: 49
Website: http://www.clubpenguincheatsy.com/
AOL: thefiame12
Location: GA
Should they belong to a different user? I'm still pretty new to server management, still learning.


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 12:28 am 
Offline
Linode Staff

Joined: Fri Feb 18, 2011 10:08 am
Posts: 42
Location: Galloway, NJ
Were you using the timthumb plugin?


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 12:30 am 
Offline
Junior Member

Joined: Sun Jul 31, 2011 5:03 pm
Posts: 49
Website: http://www.clubpenguincheatsy.com/
AOL: thefiame12
Location: GA
Praefectus wrote:
Were you using the timthumb plugin?


No I was not, but after checking my access logs I noticed some files with that name were uploaded, also I believe the theme I have used an older version of it. I updated it.

I've gone ahead and lower a few permissions, changed all of my system passwords, change my db prefix, installed a few system scanner plugins and got rid of all the infected files, would there be anything else I could do to patch a security exploit?

Update: Researched the timthumb plugin, and found out about the exploit. I've updated it, I guess that's how they did it.


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 1:02 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Are you using FTP to manage your site? Do you use Windows at home? It's quite common for viruses to steal FTP passwords from Windows PCs.

As for ownership and permissions, only the "wp-content" folder should be owned/writable by the "www-data" user. Everything else should be owned by some other user, so that even a hacked plugin can't touch any critical files. But this makes it slightly difficult for WordPress to update itself from the admin page. You may have to update it manually from the command line or configure WordPress to update itself over FTP .


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 2:02 am 
Offline
Junior Member

Joined: Sun Jul 31, 2011 5:03 pm
Posts: 49
Website: http://www.clubpenguincheatsy.com/
AOL: thefiame12
Location: GA
Using Ssh. Thank you for the explanation, I've gone ahead and made the changes.

I actually managed to copy one of the scripts that was uploaded,
http://pastebin.com/zd2ETfXh

Not too sure what it did though, would I need to change anything?


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 8:23 am 
Offline
Senior Member

Joined: Fri Jan 20, 2012 11:19 am
Posts: 100
theflame12 wrote:
Using Ssh. Thank you for the explanation, I've gone ahead and made the changes.

I actually managed to copy one of the scripts that was uploaded,
http://pastebin.com/zd2ETfXh

Not too sure what it did though, would I need to change anything?


That script seems to be able to send email with optional attachment, but I only gave it a quick look.

Quote:
As for ownership and permissions, only the "wp-content" folder should be owned/writable by the "www-data" user. Everything else should be owned by some other user, so that even a hacked plugin can't touch any critical files. But this makes it slightly difficult for WordPress to update itself from the admin page. You may have to update it manually from the command line or configure WordPress to update itself over FTP .


+1

_________________
If all else fails, reboot...

PHP Tutorials and MySQL Tutorials


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 11:37 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
nehalem wrote:
theflame12 wrote:
http://pastebin.com/zd2ETfXh

That script seems to be able to send email with optional attachment, but I only gave it a quick look.

It also seems to extract e-mail addresses from your database so that they can be spammed. It's probably looking for e-mail addresses that people submitted with their comments, etc.

I don't think it's meant to infect anything else, though. Did you also save a copy of the "mysql.info.php" that it mentions, or did this file not exist? (Script kiddies often use simple scripts to look for and break into vulnerable websites automatically. If the script encounters an error, it may just abort and move on to the next site. So it's not uncommon for exploits to be uploaded only partially.)


Top
   
 Post subject:
PostPosted: Sun Mar 18, 2012 12:52 pm 
Offline
Junior Member

Joined: Sun Jul 31, 2011 5:03 pm
Posts: 49
Website: http://www.clubpenguincheatsy.com/
AOL: thefiame12
Location: GA
No sorry, I was in such a rush to get everything cleaned up that was the only script I was able to retrieve. I do remember there being about 4 or 5 other infected files that I found though.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: nqservices and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group