[svlug] Need help with diagnosing compromised Linux system

Rick Moen rick at linuxmafia.com
Fri Apr 22 11:30:40 PDT 2005


Quoting Karsten Self (kmself at ix.netcom.com):

[RH 7.2:]

> Unless you're manually applying security updates from sources or third-party
> sites, your system's been open to any cumulative vulnerabilities since
> then, and there are many, any of which could be responsible.

<aol>Strongly concur.</aol>

> Determining which particular vulnerability was used is pretty much
> pointless:  

Exception:  One might be interested in determining the vector of
compromise as a topic in itself.  But otherwise, just move onwards to
reasserting control, safeguarding data assets, doing complete system
rebuild using more-suitable software, rebuilding local machine state, 
studying and planning for a new security policy, and finally readmitting
previous users making sure they don't reuse compromised security tokens.

> If you want to continue along the Red Hat line, you're looking at Fedora
> Core.

RHEL rebuilds also beckon:  I particularly like CentOS.  Please see:
"RHEL Forks" on http://linuxmafia.com/kb/RedHat/

> If you want to switch distros, I'd recommend a Debian-based
> system (Debian, Ubuntu, Xandros, etc.).  Ubuntu in particular is well
> received by many people and I've had pretty good results with it myself
> on two systems used in a school setting.

I keep a list of such distributions (concentrating on their usability as
installers for Debian, but perhaps useful as a distro guide otherwise):
"Installers" on http://linuxmafia.com/kb/Debian/

> Needless to say:  if you're using your system password(s) anywhere else,
> change them now.

Other standard root-compromise advice also applies.
http://www.cert.org/tech_tips/win-UNIX-system_compromise.html

> The other corrolary:  anything short of wiping and reinstalling your
> system files falls short of full assurance.

Case study by the guy I shave:
http://linuxmafia.com/pipermail/conspire/2005-February/000821.html
http://linuxmafia.com/pipermail/conspire/2005-February/000828.html
http://linuxmafia.com/pipermail/conspire/2005-February/000873.html

> Google will probably give you information on what sorts of nasties there
> are.  There's a program 'chkrootkit' which can look for things
> installed.  

Along with rkhunter (mentioned by the OP).

...neither of which, inherently as a consequence of the situation
(compromised system), can logically be fully trusted unless you run them
from uncompromised boot media -- and, even at that, they would not
necessarily be able to spot, e.g., a well-hidden LKM rootkit, or one
previously unknown to the utility authors.  Thus the advantage of 
file-based IDSes, if you've installed/configured one or more prior to 
compromise.

Some thoughts on that:
http://linuxgazette.net/issue98/moen.html

>     Don't allow remote password authentication (use SSH RSAKey auth
>     instead).

Better: DSA.  (Yes, there are problems with public-key auth, too, but at
least you won't have to worry about dictionary attacks.)

>   - Minimize your services.  Run only what you _need_ to run.

And double-check that from a nearby host using nmap.

>   - Read your system logs.

Better:  Have logcheck or similar show you the important bits.

>   - Set up a remote logging host and ship your system logs to it.

Quick poll:  Anyone on this list actually _do_ this?  I suspect this is
one of those good ideas that succumb as casualties of "rounds tuit"
deficiency.

Suggestion:  A HOWTO on this subject would make a fine gift to TLDP.

>   - Run an IDS (intrusion detection system).  'snort' is one of the more
>     common ones.  These are _all_ pretty crufty and take some tuning and
>     getting used to, but it's a good investment.

Some of us call this category "network IDSes", and dub AIDE et alii
"file-based IDSes".

> PHP and awstats are awfully prevalent security problems ATM.

Really?  ;->
http://linuxmafia.com/news.html

(Upcoming task:  Install AWstats again, but reconfigured to run as a
cronjob posting _only_ static pages, rather than as a CGI.)

-- 
Cheers,
Rick Moen                                     Age, baro, fac ut gaudeam.
rick at linuxmafia.com




More information about the svlug mailing list