The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security Checklist
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 67 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Wed Sep 06, 2006 1:37 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
Ok folks,

The attached script is not directly Joomla! related, after seeing quite an upsurge in attempted and unfortuntely, successful exploits in the forums in recent weeks, we decided to release a script that we have to try and at least "limit" the damage caused if we have missed something...


Information/Overview:
A reasonably effective script to search for particular known strings within .php and .cgi files that MAY present exploit capabilities.

The simple logic is by no means "fool proof" or "exhaustive" but gives a reasonably good indication that the target script maybe part of an exploit set. False positives are extremely possible due to the fact that many valid scripts make use of the same logic/technologies to acheive required activities, therefore some "human intelligence" must be applied to the final reports.

Installation:

  1) FTP sploitFinder.sh.txt to your server
  2) Rename to either sploitFinder.sh or just sploitFinder
  3) chmod 755 sploitFinder
  4) READ the comments andinstructions in the file
  5) run it to test with all the different switches, setup crons etc etc


  sploitFinder: list possible exploit scripts and optionally email output
    Usage: ./sploitFinder(.sh) [-a] [-c] [-m ] [egrep pattern]
              -m : email output to instead of writing to stdout
              -a : shows all files not just changes since last run
              -c : shows matching lines with context
              -r : reset/delete history


The script is well commented, only a couple of internal variables to be configured and select your command line execution switches.

Configuration:

    searchpath=/home  (Default : /home)
    sploitdir=//sploitFind  (Default : none)


This is the search pattern criteria. Listed are some of the signitures of some exploits we have heard of, these ARE NOT exhaustive. Obviously, the more variables there are, the longer each run will take.

  sploitpattern='r0nin|m0rtix|r57shell|c99shell|phpshell|void\.ru|phpremoteview|directmail|bash_history|\.ru/|brute *force|MultiViews|cwings|bitchx|eggdrop|guardservices|psyBNC|DALnet'

(Feel free to post additions to the sploitpattern to enhance the scripts capability and share your experience and knowledge.!)


This script may be run adhoc if prefered, another option is via crom, for example: TWO regular cron jobs.

  The first cron runs every 4 hours on Monday through Sunday at 02.10hrs, 06.10hrs, 10.10hrs, 14.10hrs, 18.10hrs & 22.10hrs
    - Showing only new files since the previous run and mailing the report

  The second cron runs once a week on Sunday at 01.10hrs
    - Resets/rebuilds the Baseline and mails out a full report of ALL files (-a implied)

EG:
  10 2,6,10,14,18,22 * * * //sploitFinder.sh -m your@emailaddress.com.au >& /dev/null
  10 1 * * 0 //sploitFinder.sh -rm your@emailaddress.com >& /dev/null


As ever, This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY or support; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Wed Sep 06, 2006 3:18 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Wed Mar 29, 2006 9:11 pm
Posts: 56
Excellent idea.  I haven't looked at the script yet to see what it does.

Some other ideas could be:
1.  Detect new files since last scan
2.  Detect modified files since last scan
3.  Use of an exclusion file to eliminate noise and false positives


Last edited by Bog on Wed Sep 06, 2006 3:20 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Sep 06, 2006 10:36 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
Bog

Thanks for the interest in the script,

The script has been designed to search through all .php and .cgi files in the designated searchpath (Default: /home) looking for the strings in $sploitpattern. If run without the -a or -r switch it will only report new files with matches since the last scan. So we beleive that answers point 1)

If the file has been modified;  if the file was not captured on a previous scan it will be reported this scan, but at the moment the script does not capture  subsequent changes to a file that has already been reported once for other string matches (If it was already reported once, it should have been reveiwed already), if you reset/rebuild (-r switch) occasionally, that will ensure that files that have been subsequently modified, after already being reported will be re-reported. Does this answer 2) ?

We will look in to your suggestion of an exclusion list for filenames not to scan, in an attempt to eliminate false positives. Don't hold your breath though, busy as ever. We will post in here again if/when it is implemented.


Top
 Profile  
 
PostPosted: Mon Sep 11, 2006 12:11 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
Updated sploitpattern to include latest seen exploit attempts;


sploitpattern='r0nin|m0rtix|upl0ad|r57shell|c99shell|shellbot|phpshell|void\.ru|phpremoteview|directmail|bash_history|\.ru/|brute *force|multiviews|cwings|bitchx|eggdrop|guardservices|psybnc|dalnet|undernet'


Replace current pattern in script with the above...


Top
 Profile  
 
PostPosted: Sun Sep 17, 2006 9:47 am 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
Updated to include latest seens exploit attmepts; just update the spoitpattern in the posted script.

sploitpattern='r0nin|m0rtix|upl0ad|r57shell|c99shell|shellbot|phpshell|void\.ru|phpremoteview|directmail|bash_history|\.ru/|brute *force|multiviews|cwings|bitchx|eggdrop|guardservices|psybnc|dalnet|undernet|vulnscan|spymeta|raslan58'


Top
 Profile  
 
PostPosted: Sun Sep 17, 2006 2:06 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Jun 19, 2006 5:54 pm
Posts: 314
Thanks Wizzie!


Top
 Profile  
 
PostPosted: Wed Nov 08, 2006 11:01 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Nov 08, 2006 10:47 am
Posts: 1
Wonderfull.

But where is the attached script!
how can I download it.

thanks.


Top
 Profile  
 
PostPosted: Wed Nov 08, 2006 11:23 am 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
It is attached to the first post in this thread. (File name: sploitFinder.sh.txt)


Top
 Profile  
 
PostPosted: Wed Nov 08, 2006 5:16 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Mon Oct 23, 2006 1:23 pm
Posts: 57
sorry for the stupid question, but how do we actually run this? I've followed the instructions and uploaded etc however it just says 'run the script' - I've tried opening in a browser, but that just opens a file download selector...  ???


Top
 Profile  
 
PostPosted: Wed Nov 08, 2006 5:50 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Mon Dec 05, 2005 10:17 am
Posts: 1367
Location: New Orleans, LA, USA
It is a shell script.  You need to have shell access to use it.

_________________
Rob Schley - Open Source Matters
Webimagery - http://www.webimagery.net/ - Professional Consulting Services
JXtended - http://www.jxtended.com/ - Free and Commercial Joomla! Extensions


Top
 Profile  
 
PostPosted: Wed Nov 15, 2006 2:50 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Wed May 10, 2006 11:00 pm
Posts: 81
Location: uk
:-[Sorry for being ignorant..
Those who know may simply write "YEs" or "No"
I have a cpanel access.
Can I run this script using cpanel ?
Thank you for your valuable time
Regards,

_________________
http://www.enad.co.uk


Top
 Profile  
 
PostPosted: Wed Nov 15, 2006 4:06 pm 
I've been banned!
Offline

Joined: Sat Sep 03, 2005 3:37 pm
Posts: 143
hilu wrote:
:-[Sorry for being ignorant..
Those who know may simply write "YEs" or "No"
I have a cpanel access.
Can I run this script using cpanel ?
Thank you for your valuable time
Regards,



SHELL ACCESS means, by use of a special interface your web host has set up, you can connect to your website with a command prompt JUST AS IF YOU WERE SITTING AT THE KEYBOARD OF THE LINUX/UNIX SERVER.

from there, you can type any Linux command, like LS (to list files) and many more.

It is very powerful, many things can only be done via the shell acess.

(the answer is no)



that script is no great loss, you havent missed much.

you can get a similar effect by mirroring your site to a folder on your hard drive, then using the Windows file search functions..

you should mirror your site to your local hard drive anyway for testing and backup purposes. :pop


Top
 Profile  
 
PostPosted: Tue Dec 19, 2006 6:15 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Dec 19, 2006 6:04 am
Posts: 2
Hi,

I am having some difficulties to run the script. It says:-

/usr/bin/sploitfinder: line 246: unexpected EOF while looking for matching `''
/usr/bin/sploitfinder: line 254: syntax error: unexpected end of file

Any idea?
Thanks


Top
 Profile  
 
PostPosted: Tue Dec 19, 2006 6:18 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Dec 19, 2006 6:04 am
Posts: 2
hilu wrote:
:-[Sorry for being ignorant..
Those who know may simply write "YEs" or "No"
I have a cpanel access.
Can I run this script using cpanel ?
Thank you for your valuable time
Regards,



I dont think there will be any problem.. Just upload the file using ur favorite ftp client and chmod it to 755 and add a crond job from the cpanel menu.


Top
 Profile  
 
PostPosted: Fri Jan 05, 2007 10:47 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Jan 03, 2007 11:57 am
Posts: 3
Can you tell me where SploitFinder.sh is attached .
I am unable to find it

Thanking you


Top
 Profile  
 
PostPosted: Fri Jan 05, 2007 10:54 am 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Tue Sep 06, 2005 4:37 am
Posts: 2703
Location: Australia
It is attached to the first post in this thread. (File name: sploitFinder.sh.txt).


Top
 Profile  
 
PostPosted: Fri Jan 19, 2007 9:24 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Thu Nov 09, 2006 12:48 pm
Posts: 3
Now all we need to do is make this into a component  :D
And we can start a war with the script kiddies. viva la com_JoomlaExploits
Hint hint.


Top
 Profile  
 
PostPosted: Fri Jan 19, 2007 11:54 am 
Joomla! Intern
Joomla! Intern
Offline

Joined: Mon Dec 18, 2006 9:00 pm
Posts: 54
Wicked script thanks  :D

Back soon, time to play with my new toy :)

_________________
My code never has bugs. It just develops random features.


Top
 Profile  
 
PostPosted: Thu Feb 22, 2007 12:35 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Fri Mar 17, 2006 12:20 am
Posts: 83
Location: Barcelona
I've just found, installed and tested this script,
I have one question and one problem.

question:
I see that the sploitpattern has been updated a few times, will this be updated again? from time to time?

problem:
in terminal - #./sploitFinder.sh -rm webmaster@mydomain.net
error- ./sploitFinder.sh: line 244: /bin/mail: Permission denied

Thanx for any insight to my problem and thanx for the script.


Top
 Profile  
 
PostPosted: Thu Feb 22, 2007 8:19 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Sun Oct 22, 2006 4:42 am
Posts: 9142
Location: Sunshine Coast, Queensland, Australia
Yes, from time to time the patterns will be updated, but there is nothing to stop you from updating or adding to the patterns yourself if you see something occurring on your own servers or in any security forums you may follow.

As for your mail problem, you are getting permission denied to the mail problem, either the user you are running the script as, does not have access to the mail binary or maybe security on your host disables the command line use of the binary.

_________________
Joomla! on the fabulous Sunshine Coast...
http://www.networksmarts.com.au/


Top
 Profile  
 
PostPosted: Wed Apr 04, 2007 10:31 am 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Sun Aug 28, 2005 1:19 pm
Posts: 484
Location: Noel, MO
ok I'm lost... I know what I'm supposed to change but not what to change it to... is it like an absolute url or a directory or what?

_________________
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!


Top
 Profile  
 
PostPosted: Wed Apr 04, 2007 11:04 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Sun Oct 22, 2006 4:42 am
Posts: 9142
Location: Sunshine Coast, Queensland, Australia
As the Help at the top of file suggests,  you will need to complete the following variables to suit your server or site information;

  searchpath=/home  (Default : /home)
  Which directory do you want to search? This will be your hosting account directory.

    sploitdir=//sploitFind  (Default : none)
  Where you want the sploitFind to put its database....

_________________
Joomla! on the fabulous Sunshine Coast...
http://www.networksmarts.com.au/


Top
 Profile  
 
PostPosted: Wed Apr 04, 2007 11:18 am 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Sun Aug 28, 2005 1:19 pm
Posts: 484
Location: Noel, MO
well, thanks for the quick reply but that's completely greek to me so I think I'll just pass

_________________
As soon as you make something idiot proof, Nature makes better idiots!!!

If you want to know what "coulda", "shoulda", and "woulda" gone wrong, send it my way! I have a natural ability of mucking things up!


Top
 Profile  
 
PostPosted: Wed Apr 11, 2007 1:32 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Tue Aug 23, 2005 12:15 pm
Posts: 91
I run this:

./sploitFinder.sh -rm myemailaddress@someplace.com

I get this error:
: bad interpreter: No such file or directory

My configuration:

#### SETUP OPTIONS ####
searchpath=/httpdocs
sploitdir=/httpdocs/sploitfind

Any ideas what I am doing wrong?


Top
 Profile  
 
PostPosted: Thu Apr 12, 2007 9:25 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Sun Oct 22, 2006 4:42 am
Posts: 9142
Location: Sunshine Coast, Queensland, Australia
Which shell are you trying to run this in?

Without knowing your server configuration or setup; try also setting your path to the full path,  something like,    /home//public_html

_________________
Joomla! on the fabulous Sunshine Coast...
http://www.networksmarts.com.au/


Top
 Profile  
 
PostPosted: Thu Apr 12, 2007 2:14 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Tue Aug 23, 2005 12:15 pm
Posts: 91
redhat linuix


Top
 Profile  
 
PostPosted: Mon Apr 16, 2007 11:04 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Tue Sep 06, 2005 11:18 am
Posts: 1362
Location: Germany
in the *.txt file are a bunch of  ^M from an MS-DOS like editor (gee thanks bill for this crap)
in a windows editor you dont even see this, but in vi or whatever u ve got a bunch of this line breaks (?) ..

it may happen that some systems run into trouble because of the ^M , check this and delete this and iam sure it will run...

_________________
Certified Linux Professional, Novell Linux Administrator, Novell Data Center Technical Specialist,
Microsoft Certified IT Professional , Microsoft IT Professional Enterprise Administrator
http://www.schrammen.net http://ballon.schrammen.net


Top
 Profile  
 
PostPosted: Tue Apr 17, 2007 3:48 pm 
usually caused by white space after the ending ?>


Top
  
 
PostPosted: Sat May 05, 2007 3:32 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Dec 09, 2006 6:29 pm
Posts: 45
It is insane.  I am currently using Hostgator as my hosting company.  I upload this script into my account, and in the process of using emacs to editing the script.  I haven't even run  it once.  I suddenly got an email saying that my account is suspended because of this script.  I asked them to lift the suspension but they ask me to wait for response. 

What should I do?


Top
 Profile  
 
PostPosted: Sat May 05, 2007 3:46 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Sun Oct 22, 2006 4:42 am
Posts: 9142
Location: Sunshine Coast, Queensland, Australia
Talk to your host? they are most likely evaluating the script as to its use and purpose, seeing as it popped their own security.

This is actually goodness, your host is pro-actively attempting to protect you (and themselves) against potential exploits... Congratulations to your host for their approach and attitude to security. However, this may mean that you cannot make use of the posted script on your account.


This script probably got detected by a script of theirs looking for common or known exploits. This script contains some "keywords" of common and known exploits, so is their script. The result being, that their script considers this script to be a possible exploit script itself (a false positive) because our search keywords match their search keywords and suspended the account to avoid abuse of your account.

_________________
Joomla! on the fabulous Sunshine Coast...
http://www.networksmarts.com.au/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 67 posts ]  Go to page 1, 2, 3  Next



Who is online

Users browsing this forum: No registered users and 0 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
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group