11-12-2009, 03:26 PM #1Newbie
- Join Date
- Jan 2006
- San Antonio, TX
Remotely replaced sshd_config, CentOS 5.3/SSH 4.3p2-36el5_4.2
Fighting a bit of a nasty morning... anyone seen this before?
We have a number of servers that have password authentication disabled as well as shell access disabled for all users except those whom have keys. These servers run cPanel and have been updated to the following specs:
2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009 i686 i686 i386 GNU/Linux
Early (around midnight-1am CST) this morning we had a widespread attack via an unknown vector. In the attack, the only thing that I can find is the following (IP blacked out, although it is the attackers' address):
Nov 12 04:31:22 sharedserver/sharedserver sshd: Received disconnect from 100.100.100.100: 11: No supported authentication methods available
Nov 12 04:32:14 sharedserver/sharedserver sshd: Received signal 15; terminating.
Nov 12 04:32:14 sharedserver/sharedserver sshd: Server listening on :: port 2.
Nov 12 04:32:14 sharedserver/sharedserver sshd: error: Bind to port 2 on 0.0.0.0 failed: Address already in use.
Nov 12 04:32:27 sharedserver/sharedserver sshd: Accepted password for root from 100.100.100.100 port 3630 ssh2
Nov 12 04:32:27 sharedserver/sharedserver sshd: pam_unix(sshdession): session opened for user root by (uid=0)
The concerning part is that it obviously appears that there is someone reloading SSHD, but there is no successful login (at all) via shell prior to this.
This time corresponds with a modified sshd_config that then allows password authentication, whereby the user then logs in as root and has a good time, so to speak.
I know that the following vulnerability is out in the wild:
However, since the user never actually logged into the server from what I can see, I'm still searching for the real way that this occurred.
I have logs from these servers, if you need other information to possibly help track this down that is possible. I'm having a hard time finding the vector for this attack though...
Any assistance would be greatly appreciated.
11-12-2009, 03:30 PM #2Junior Guru
- Join Date
- Aug 2002
I would check through the server logs for web sites hosted to see if they exploited a php or cgi script to be able to first execute commands on the server. Often a first step is to upload some sort of phpshell through a hole in a web site.Datarealm Internet Services, Inc
SSD Shared Hosting | VPS | Dedicated Servers | Colocation
11-12-2009, 04:01 PM #3Web Hosting Master
- Join Date
- Feb 2006
- Buffalo NY
You can easily modify these logs (secure, wtmp, utmp, etc) so I would take them with a grain of salt unless you setup a central syslog server somewhere.
Unfortunately unless you setup an IDS awhile ago the only real way to be sure you're clean is to simply reinstall / replace all the common binaries and libraries (/bin, etc).
Try running chkrootkit / rkhunter to see if it finds anything odd, check all listening ports, check for daemons running that you can't identify and see what they're doing. Check the crons, all authorized_keys, etc.
Its a tedious process, in the future after you install a system / configure it setup a IDS like Tripwire to make some sort of database of the baseline core files - this makes it infinitely easier in finding if a system was compromised / where.█ Cody R.
█ Hawk Host Inc. Proudly Serving websites since 2004.
11-12-2009, 06:22 PM #4Web Hosting Evangelist
- Join Date
- Nov 2003
- Marylebone, London, UK
Regardless of what files are changed, you can limit
ssh to a set of IP addresses.
Using PF I allow:
1) anything from the cluster of IP addresses
I list in a file (just all my server IPs)
2) anything from my ISP (no fixed IP at home
so is allocated dynamically)
At least then their ssh attempt would
probably get no further than my firewall
By CymraegWalesHosting in forum Hosting Security and TechnologyReplies: 7Last Post: 01-01-2010, 07:32 PM
By JumptoMedia in forum Hosting Security and TechnologyReplies: 10Last Post: 05-04-2009, 11:28 PM
By Coolraul in forum Systems Management RequestsReplies: 4Last Post: 05-30-2008, 08:43 PM
By finly in forum Dedicated ServerReplies: 5Last Post: 04-19-2008, 11:49 PM
By pergesu in forum Hosting Security and TechnologyReplies: 7Last Post: 01-10-2005, 09:44 AM