LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-30-2013, 06:09 AM   #1
i4visualmedia
LQ Newbie
 
Registered: Sep 2013
Posts: 3

Rep: Reputation: Disabled
Defacement of websites serverwide


Hi Guys my first post here.

I have an extremely large problem with my server.

Currently running centos 6.3 and plesk 11 latest version

Over the last year or so i have 2 different servers defaced around 6-7 times

They are somehow running scripts in the hosting directory that they are probably inserting via a componant.

they are then gaining control of the server and changing the index files server wide to a deface sign.

They have also managed to add users with root access, we have now limited SSH to certain ip's to stop them logging in. however i need to stop this happening again.

has anyone else had this problem? i know its currently a massive problem for alot of people at the moment.

i really dont know how they are adding new users as root. and i dont know how they are defacing the whole server from a users environment.


Regards

Grant
 
Old 09-30-2013, 07:07 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
You have changed your root password first thing, right? And you've checked the content of your /etc/sudoers file? You've looked at /etc/passwd and there is only one user account with UID 0 and GID 0 (that would be root)? You do not allow remote root log in via SSH?

Have you checked the human factors -- nobody has root access, there are no plain text files anywhere than contain the root password? You're using a "good" root password -- no dictionary words, both upper- and lower case alphabetic characters, punctuation and numeric characters, at least 8 characters in length (more is better)?

The directory and files than contain your web pages are are owner/group root, read-write-execute owner, read-execute group and public (that would be 755, 644 for files)? You web applications (where the index files are) are owned by root, group apache (or root, root)? The masks of those directories and files do not permit group or public write?

You do not use the same root password system-wide, each machine has its own root password only known to system administrators (not to any local users)? You have checked your logs, particularly /var/log/secure and /var/log/syslog to see where the intrusions are coming from?

Those are things I'd look for first, then I might think about finding and eliminating a rootkit.

Hope this helps some.
 
1 members found this post helpful.
Old 09-30-2013, 07:40 AM   #3
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
I find tronayne's post really amusing. Check on the basics of security first before hitting on the high notes.

Also, I appears to me that you are working for web services. IMO, you should know better than using your company's domain as your username in a forum like this.

Cheers.
 
Old 09-30-2013, 07:45 AM   #4
i4visualmedia
LQ Newbie
 
Registered: Sep 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ilesterg View Post
I find tronayne's post really amusing. Check on the basics of security first before hitting on the high notes.

Also, I appears to me that you are working for web services. IMO, you should know better than using your company's domain as your username in a forum like this.

Cheers.
Hello

its not the company in question.

Regards
 
Old 09-30-2013, 07:49 AM   #5
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
Quote:
Originally Posted by i4visualmedia View Post
Hello

its not the company in question.

Regards
Apologies if I give you that impression.

If you're working on a business, I suggest you setup your own set of security rules/processes/policies. That includes addressing the security points mentioned by tronayne.

Cheers.
 
Old 09-30-2013, 09:17 AM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Something simple you may want to look for is files owned by root with the "su" bit set:
Code:
su -
<root password>
find / -type f -owner root -perm -4000
There are a bunch of those that should be owned by root with the su bit set (/etc/passwd is one of them); however, there should be no user files with root ownership and the su bit set (what the su bit does is allow anyone to execute as-if they are root or some other account).

You might want to use the above command with a redirection into a file for review; e.g.,
Code:
find / -type f -owner root -perm -4000 > /tmp/subits.txt
or something similar to that. The list should look like this (yours may vary, depending upon what you have installed):
Code:
find / -type f -user root -perm -4000 

/bin/fusermount
/bin/umount
/bin/su
/bin/ping6
/bin/ping
/bin/ntfs-3g
/bin/mount
/usr/bin/procmail
/usr/bin/gpasswd
/usr/bin/kppp
/usr/bin/chsh
/usr/bin/traceroute6
/usr/bin/fdmount
/usr/bin/Xorg
/usr/bin/rsh
/usr/bin/crontab
/usr/bin/passwd
/usr/bin/rcp
/usr/bin/pkexec
/usr/bin/expiry
/usr/bin/chfn
/usr/bin/chage
/usr/bin/sudo
/usr/bin/rlogin
/usr/bin/newgrp
/usr/bin/cgexec
/usr/lib64/kde4/libexec/start_kdeinit
/usr/lib64/kde4/libexec/kcheckpass
/usr/lib64/kde4/libexec/fileshareset
/usr/libexec/pt_chown
/usr/libexec/ssh-keysign
/usr/libexec/polkit-agent-helper-1
/usr/libexec/dbus-daemon-launch-helper
Note there they're all in system directories (that doesn't mean that someone has not compromised a system directory, though). If you find one or more files in the /home or /usr/local tree, those are the ones you really want to look it.

It's normal for the above list of files to look like this:
Code:
ls -l /usr/bin/rcp
-rws--x--x 1 root root 17976 Sep 23  2008 /usr/bin/rcp*
That "s" in the pattern rws is the giveaway that the "su" bit is enabled. There should be none of those anywhere in "user land." For that matter, there should not be any executable files owned by an administrative user account in "user land." If you find any, start asking questions and get ready to clamp down hard on them.

If you find one (or two) in "user land," it would probably be a Real Good Idea to move them to a protected directory where you can analyze them and identify who is using them for what and them get them off your system altogether. You do not want to mess with system files (such as those above), but you do want to eliminate any "su" bit files you may find outside of those. You may wind up needing to compare distribution files against your installed system files in case one or more of them have been compromised; looking at the file date stamps, for example, may be useful:
Code:
find / -type f -user root -perm -4000 -exec ls -l {} \;
will show you that.

Hope this helps some.
 
Old 09-30-2013, 10:29 AM   #7
i4visualmedia
LQ Newbie
 
Registered: Sep 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you for all your help. i have found there is an exploit for these versions

2 of our server fell into this category and both have been hacked multiple times.

They have been getting in via a vulnerable joomla modules or other extensions, inserting the exploit and getting in that way.

i have placed a vulnerable list below.


VULNERABLE

Linux localhost.domain 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 x86_64
Linux localhost.domain 2.6.32-358.6.1.el6.x86_64 #1 SMP Tue Apr 23 19:29:00 UTC 2013 x86_64
Linux localhost.domain 2.6.32-279.19.1.el6.x86_64 #1 SMP Wed Dec 19 07:05:20 UTC 2012 x86_64
Linux localhost.domain 2.6.32-279.22.1.el6.x86_64 #1 SMP Wed Feb 6 03:10:46 UTC 2013 x86_64
Linux localhost.domain 3.2.2-ipprojects #4 SMP Fri Feb 3 15:53:51 CET 2012 x86_64
Linux localhost.domain 2.6.32-042stab076.5 #1 SMP Mon Mar 18 20:41:34 MSK 2013 x86_64
Linux localhost.domain 2.6.32-220.4.1.el6.x86_64 #1 SMP Tue Jan 24 02:13:44 GMT 2012 x86_64
Linux localhost.domain 2.6.32-379.22.1.lve1.2.17.el6.x86_64 #1 SMP Wed Apr 3 12:05:42 EEST 2013 x86_64
Linux localhost.domain 2.6.32-042stab068.8 #1 SMP Fri Dec 7 17:06:14 MSK 2012 x86_64
Linux localhost.domain 2.6.32-379.22.1.lve1.2.14.el6.x86_64 #1 SMP Wed Mar 6 15:12:30 EET 2013 x86_64
Linux localhost.domain 2.6.32-379.19.1.lve1.2.6.el6.x86_64 #1 SMP Fri Jan 18 10:16:30 EST 2013 x86_64
Linux localhost.domain 2.6.32-042stab053.5 #1 SMP Tue Mar 27 11:42:17 MSD 2012 x86_64
Linux localhost.domain 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64
Linux localhost.domain 3.2.0-0.bpo.3-amd64 #1 SMP Thu Aug 23 07:41:30 UTC 2012 x86_64
Linux localhost.domain 2.6.32-358.0.1.el6.x86_64 #1 SMP Wed Feb 27 06:06:45 UTC 2013 x86_64
Linux localhost.domain 2.6.32-042stab061.2 #1 SMP Fri Aug 24 09:07:21 MSK 2012 x86_64
Linux localhost.domain 2.6.32-379.14.1.lve1.1.9.9.el6.x86_64 #1 SMP Thu Dec 6 07:12:24 EST 2012 x86_64
Linux localhost.domain 2.6.32-12-pve #1 SMP Tue May 15 06:02:20 CEST 2012 x86_64
Linux localhost.domain 2.6.32-131.21.1.el6.x86_64 #1 SMP Tue Nov 22 19:48:09 GMT 2011 x86_64
Linux localhost.domain 3.2.7 #1 SMP Sun Feb 26 23:00:18 CET 2012 x86_64
Linux localhost.domain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64
Linux localhost.domain 2.6.32-379.22.1.lve1.2.17.el5h.x86_64 #1 SMP Wed Apr 3 14:28:52 EEST 2013 x86_64
Linux localhost.domain 2.6.32-320.4.1.lve1.1.4.el6.x86_64 #1 SMP Wed Mar 7 06:32:27 EST 2012 x86_64
Linux localhost.domain 2.6.32-220.7.1.el6.x86_64 #1 SMP Wed Mar 7 00:52:02 GMT 2012 x86_64
Linux localhost.domain 2.6.32-7-pve #1 SMP Mon Feb 13 07:33:21 CET 2012 x86_64
Linux localhost.domain 2.6.32-042stab062.2 #1 SMP Wed Oct 10 18:28:35 MSK 2012 x86_64
Linux localhost.domain 2.6.38 #5 SMP Sat Mar 19 13:19:08 CET 2011 x86_64
Linux localhost.domain 2.6.32 #1 SMP Wed Sep 5 22:46:20 MSK 2012 x86_64
Linux localhost.domain 2.6.32-379.19.1.lve1.2.7.el6.x86_64 #1 SMP Wed Jan 23 14:53:41 EST 2013 x86_64
Linux localhost.domain 3.2.0-0.bpo.2.dar-amd64 #1 SMP Fri Apr 27 18:23:24 MSK 2012 x86_64
Linux localhost.domain 2.6.32-16-pve #1 SMP Fri Nov 9 11:42:51 CET 2012 x86_64
Linux localhost.domain 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64
Linux localhost.domain 2.6.32-279.9.1.el6.x86_64 #1 SMP Tue Sep 25 21:43:11 UTC 2012 x86_64
Linux localhost.domain 2.6.32-042stab065.3 #1 SMP Mon Nov 12 21:59:14 MSK 2012 x86_64
Linux localhost.domain 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
Linux localhost.domain 2.6.32-11-pve #1 SMP Wed Apr 11 07:17:05 CEST 2012 x86_64
Linux localhost.domain 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64
Linux localhost.domain 2.6.32-131.17.1.el6.x86_64 #1 SMP Thu Oct 6 19:24:09 BST 2011 x86_64
Linux localhost.domain 2.6.32-042stab072.10 #1 SMP Wed Jan 16 18:54:05 MSK 2013 x86_64
Linux localhost.domain 3.5.2 #1 SMP Thu Aug 23 17:07:20 CEST 2012 x86_64
Linux localhost.domain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64
Linux localhost.domain 2.6.32-279.2.1.el6.x86_64 #1 SMP Fri Jul 20 01:55:29 UTC 2012 x86_64
Linux localhost.domain 3.2.20 #1 SMP Tue Aug 28 02:39:06 MSK 2012 x86_64
Linux localhost.domain 2.6.32-220.4.2.el6.x86_64 #1 SMP Tue Feb 14 04:00:16 GMT 2012 x86_64
Linux localhost.domain 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 23:54:45 UTC 2012 x86_64
Linux localhost.domain 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 x86_64 GNU/Linux


I hope im ok to post this here. if not i will remove.
 
Old 10-02-2013, 03:44 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by i4visualmedia View Post
i have found there is an exploit for these versions
2 of our server fell into this category and both have been hacked multiple times.
They have been getting in via a vulnerable joomla modules or other extensions, inserting the exploit and getting in that way.
The problem here is that a lot of people blithely use the OS, a CMS, Web Log, forum and other software solely because it is available without cost and without bothering to secure and harden their web server, audit things and update software. Any software in the web stack that is not updated, stale, unsupported or outright vulnerable is low hanging fruit for spam crews and such. Now the OS comes with installation, admin and security documentation and documentation of software in the web stack often has a specific security section. It's just that people often don't read much and don't care enough.

Security is a continuous process requiring a layered approach. Unless you want to investigate further I'd make backups for future reference (never restore them without a thorough comb out), set up a new server, properly harden it and then migrate web sites after thorough inspection for any stale software, wrong permissions, configuration errors and other common mistakes.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Websites liuxsever Linux - General 1 02-04-2009 11:25 AM
Can ping websites, can visit websites with ip address, cannot visit with Web address TheGeneralsLounge Linux - Networking 2 03-29-2007 02:07 AM
Websites on the same ip gubak Linux - Networking 3 10-31-2006 05:25 AM
Websites that sell websites..? mScDeX General 2 12-29-2003 03:01 PM
websites zipporah General 23 08-06-2003 02:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration