Site Blog - Security
29
Jan OvervieweCheck Seciruty is a tiny tool for detecting malicious PHP scripts and code portions on your website. It was originally build to check e107 CMS based sites, but it can be actually used on any kind of PHP based projects. This tool is licensed under GNU General Public License - http://www.gnu.org/licenses/gpl.txt Before you start using the tool, I have to warn you - DON'T PANIC when you first see the 'suspicious' results. Be sure you read the 'Analyzing the results' chapter. Download most recent version of eCheck Seciruty here Shell script (echeck.php)Copy echeck.php somewhere on your server. In this example I'm copying it in /home/secretr/
You can always get quick help
Now, the only thing you need to know is the path to your web root (e107 root for e107 user). In my case this is /home/secretr/public_html and my e107 Installation is located in e107_0.7 folder. There are two alternatives. You could let eCheck know the path to your web root:
or the opposite - navigate to web root and call the script with the proper path:
Here is the output of eCheck scan on fresh e107 v0.7 CVS copy:
There is (still experimental) cleanup option you could try if eCheck finds files marked as INFECTED. I recommend to make a backup of your files first. Additionally, you need write permission on all checked files (e.g. run eCheck as root) and your PHP version should be at least 5.0. I'll put infected and real malicious files inside my local e107 system to show you what happens:
You need to confirm (type yes and press enter) to continue the operation
Our index.php was infected with known infection, so eCheck was able to clean it. Note we have one new line - './public_html/e107_0.7/e107_files/public/shell.php'. We'll talk about this one later. One last example - let's execute eCheck as root (your current user should be sudoer), output everything (all checked files) and write the output to a file - log.txt in our case.
Scan via a browser (echeckwww.php)For those who don't have shell access to their sites (most common case for shared hosting) there is an alternative. Copy echeckwww.php to your site root (in my case /home/secretr/public_html/e107_0.7/) and just call it in your favorite browser like this: yoursite.com/echeckwww.php You should see something like this (click to enlarge) Keep in mind you don't have any options you can set in this case. Auto-clean is not available as well Analyzing the resultsScripts are analyzed in two ways:
Suspected doesn't mean files are infected in some way. Most of the phrases (generic php functions) are used in all kind of software. The process of analyzing the results is your responsibility. If you know the structure of your site, and you have generic knowledge of 'what, where happens', it would be easy to identify the problems (if there are any). I'll use the example above, more precisely this line from our latest shell example:
Every e107 user should know that /e107_files/public/ folder should not contain any scripts. Experienced admins would know what to do from now on - checking the file last modified date and investigating the Apache logs to find out how was this file uploaded on the server, eventually reporting the problem to e107 core team. In other hand we see
lines are appearing on and on. These are the false positives I'm talking about. You'll have many of them on a live site with a lot of 3rd party code. You just need to investigate all you see - it's pretty easy to distinguish malicious from creative code. Where can I get help?
Comments30 Jan
![]() 30 Jan
30 Jan
01 Feb
Brynn Neilson Site Blog - Security
Excellent tool and just what I was looking for. Would also be good if it didn't just scan the e107 root folder but all virtual servers so it could be scheduled to run daily and send reports to server admin. Would also be good to be able to exclude files from scanning that we know are safe.
02 Feb
dolphin713 eCheck Security PHP tool - find malware on your site
Hi and thanks.
Just a small tip: add .svn files do $rejectArray in get_files function.
![]() 03 Feb
You must be logged in to make comments on this site - please log in, or if you are not registered click here to signup
|
Blog categories |
|
You must be logged in to make comments on this site - please log in, or if you are not registered click here to signup
|
|



SecretR


