25 Years of Programming Community Forum
Blog  Sitemap  Services
May 25, 2013, 08:09:03 PM *
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: How to find malicious scripts or backdoors left by the hacker  (Read 4085 times)
0 Members and 1 Guest are viewing this topic.
fs_tigre
Newbie
*
Offline Offline

Posts: 23


« on: October 06, 2010, 11:27:52 AM »

Hi,

I recently found this website with a nice and easy to understand article about what to do to prevent your site for being hacked and I started wondering, why is that books aren’t written the same way as the article, easy to understand (great job on this).
I have been having a hard time with a website that was recently hacked, that’s basically how I started looking for information about security. When I first noticed that this website was hacked (they replaced my index page with a note that said hacked by bla bla) I basically replaced the index page with my back-up file and it started working fine so I assumed that it was ok and I forgot about it until the other day that I downloaded a complete site backup to my local computer and ran a scan using Norton and to my surprise it found something called “PHP.RSTBackdoor”  so now I’m I little scare about not be able to find the malicious scripts, I could go through all of my files but since I don’t know what I’m looking for it would take me years to go and look every single file since I’m using WordPress as my CMS and I may not find what I need.

Is there a better method to hunt malicious scripts, viruses or backdoors that my site may contain?

Is there some sort of software like McAfee or Norton that I could use to scan my Cpanel?

Thanks a lot!
Report to moderator   Logged
SteveW
Administrator
Sr. Member
*****
Offline Offline

Posts: 285


WWW
« Reply #1 on: October 07, 2010, 04:01:47 AM »

Quote
Is there some sort of software like McAfee or Norton that I could use to scan my Cpanel?

I believe there are a few shared webhosts that provide an antivirus scanner as an icon in cPanel. If yours doesn't, then using another scanner isn't usually an available option. I'm assuming you're on shared hosting.

Otherwise, the task of finding malware in your site basically boils down to searching through the files on your server. It's just like searching through files on your PC, except that you're not physically sitting at your website's server, and it's probably a Linux computer rather than Windows. Both those things can complicate matters quite a bit. The things you'd be searching for are:

1) malicious entire files that shouldn't be there (such as r57.php or other backdoor scripts -- these are the "backdoors")

This article shows how to get a listing of all the files in your site. Having the list of file names is a start:
http://25yearsofprogramming.com/blog/2009/20090621.htm

This article is about specifically searching for backdoor scripts, with the use of text search utilities available in Linux and Windows:
http://25yearsofprogramming.com/blog/2010/20100315.htm

2) malicious code inserted into your otherwise normal files, such as the index.php that you replaced with a fresh copy. These aren't "backdoors". These are viruses, etc. that attack visitors who load the web pages.

This article has examples of what malicious code tends to look like:
http://25yearsofprogramming.com/blog/20071223.htm

The reason for the general lack of extremely clear instructions for these types of tasks is that they are complex. They can require knowing, or learning, how to use the necessary utilities, and it helps to have a general familiarity with Linux and the structure of your website on it.

Imagine someone tells you, "Some stranger sat down at my computer and changed a bunch of my files, and I think they also installed a program that will allow them to access my PC remotely through the internet. I only use my PC for email and web browsing, and don't know anything about Windows other than that. Can you give me some simple instructions how to find out what they did, and fix it?"

The obvious answer is No. It isn't possible to give simple instructions that will cover the various possibilities, especially if the person isn't generally familiar with their PC or its operating system.

If the challenge is really daunting, it might be worth hiring somebody to do the cleanup. Cost seems to run from $150 to $400 for a WordPress site. For most websites, and most webmasters, the cost of having somebody else do a cleanup like this is a significant and unpleasant expense.

I generally encourage people to take this opportunity to learn about their site, by doing the cleanup themselves. It's slower, but you're saving quite a bit of money and learning a lot when you do it that way.

Quote
until the other day that I downloaded a complete site backup to my local computer and ran a scan using Norton and to my surprise it found something called PHP.RSTBackdoor
You might have successfully cleaned out the initial malware when you replaced index.php with a clean copy. What remained was a "backdoor" that allows the hackers to get back into the site. That is, it's a different type of malware. It's not a virus that infects PCs; it's just a script that the hackers can call with their browser, which gives them access to your files.

If you can determine the name of the file that Norton quarantined from the set of files you downloaded, try to find that filename in the listing of your site files -- see the article in #1) above --, and go on the server (cPanel File Manager), and delete that file.
« Last Edit: October 07, 2010, 04:06:16 AM by SteveW » Report to moderator   Logged
fs_tigre
Newbie
*
Offline Offline

Posts: 23


« Reply #2 on: October 07, 2010, 07:26:34 AM »

Once a gain, your are great at explaining this type of things it looks like while I'm reading I'm asking and you are answering my questions at the same time, thank you! this helps a lot.

Now, to understand this a little be more... do I need to look into every folder in the cpanel (server), I'm referring to main folders like www, .cpanel, .fantasticodate, etc, public_ftp, public_html etc... or only the public_html?

Do you think this attacks can easily occurred when using chip hosts? I'm currently using 247-host a very chip host and so far two of my sites have been hacked.


Thanks a lot.
Report to moderator   Logged
SteveW
Administrator
Sr. Member
*****
Offline Offline

Posts: 285


WWW
« Reply #3 on: October 07, 2010, 08:03:41 AM »

do I need to look into every folder in the cpanel (server), I'm referring to main folders like www, .cpanel, .fantasticodate, etc, public_ftp, public_html etc... or only the public_html?
Since a backdoor script is basically a web page that the hackers call with their browser (it gives them a File-Manager-like interface in their browser), it needs to be accessible from the web. Apache can only serve files that are in public_html, so that is the most important place to search.

Quote
Do you think this attacks can easily occurred when using chip hosts? I'm currently using 247-host a very chip host and so far two of my sites have been hacked.

The host is generally the less important factor. In your situation, the priorities should be:

1) Make sure your home PC is virus-free. If you found viruses on your PC, that's the most likely way your site got hacked.
2) Make sure your WordPress is upgraded to its most recent version. If your WordPress was out of date, that's the most likely way your site got hacked.
Report to moderator   Logged
fs_tigre
Newbie
*
Offline Offline

Posts: 23


« Reply #4 on: October 07, 2010, 08:20:08 AM »

Thanks a lot for the good information.
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!