Re: root or openssh exploited?

_at_(none)
Date: 03/28/04


Date: Sat, 27 Mar 2004 19:02:01 -0500


Kev wrote:
> Hi
>
> a quick summary of my status before mmy question
>
> *) Linux RedHat 7.3
> *) kernel 2.4.20-24.7
> *) uptime 100+ days
> *) OpenSSH_3.7p1
> *) loads of user accounts, user auth is against a local passwd file
> *) root login via ssh *is* allowed in sshd_config
> *) only ports visible to the world is 22, the rest shielded by a Cisco
> firewall
> *) no sign of any malicious activity within our network
>
> On this system we found
>
> *) root password had mysteriously changed, maybe due to sysadmin error? The
> "expected" root password worked until at least 5 days ago. Only root
> access now is via stored ssh keys.
>
> *) running chkrootkit-0.43 we see one probable problem
> ./chkproc -v
> PID 20: not in readdir output
> PID 20: not in ps output
> You have 1 process hidden for readdir command
> You have 1 process hidden for ps command
>
> Sure enough ps and ls /proc dont see a PID 20 or a dir called "20" resp.
>
> We will remove this system from operation, and reset all
> accounts and passwords.
>
> However, I want to know (if I can know) which exploit was used, in
> particular it would be good to know if it was a remote exploit of
> openssh or a local exploit of some sort, and since when has the machine been
> exploited?
>
> I'd also like to know as much as possible about the myserious PID 20
>
> Since I have a running kernel I can do a few things:
>
> cat /proc/20/cmdline
> initauto
>
> sum /proc/1/exe /proc/20/exe
> 26159 27 /proc/1/exe
> 26159 27 /proc/20/exe
>
> PID 1 is of course init.
>
> ls -l /proc/20/fd
> total 0
> lrwx------ 1 root root 64 Mar 27 00:06 0 -> /dev/null
> lrwx------ 1 root root 64 Mar 27 00:06 1 -> /dev/null
> lrwx------ 1 root root 64 Mar 27 00:06 2 -> /dev/null
> lrwx------ 1 root root 64 Mar 27 00:06 3 -> /dev/kmem
> lrwx------ 1 root root 64 Mar 27 00:06 4 -> socket:[22]
>
> that "22" looks suspciously like a ssh related issue.
>
> "man proc" tells me field 22 in /proc/<PID>/stat
> is the start time of a process. On my system that gives:
>
> cat /proc/1/stat /proc/20/stat | awk '{print $22}'
> 39
> 655
>
> This would suggest that the rogue init process started only 6
> seconds after the real init process. Also 20 is a quite a low PID,
> though of course I know that wraps around.
>
> Does that give anyone any clues? Can I trust the outputs above?
> Maybe the "changed" root password and the strange process
> are in fact unrelated, one may be an accident and one may have been the
> case for 3+ months! That is of course what worries me ...
>
> Suggestions ....
>
> Kev

This may be trivial to you but ..

Things to try:

1. use lsof to find programs running (this has come in handy for me
after root access was gained as some rootkits - if installed - don't
trojan lsof)

2. check rpm database for any changes to packages

Questions:

Is sshd allowing ssh 1 protocal?

Hints:

I have transfered (known good) commands to the possibly cracked system.
Transfer the "ps" command over and find out what program is using PID
20. It will work as long as the libraries haven't been f'ed up.



Relevant Pages

  • Re: 7.1RC1: system hang
    ... pid ppid pgrp uid state wmesg wchan cmd ... Tracing command vmstat pid 96381 tid 100276 td 0xc756caf0 ...
    (freebsd-stable)
  • Re: how to delete a DLL beeing used by windows?
    ... ListDLLs V2.23 - DLL lister for Win9x/NT ... WINLOGON.EXE pid: 164 ... Command line: winlogon.exe ... > "Dimitriy Braslavskiy" wrote in message ...
    (microsoft.public.win2000.security)
  • Re: IPC
    ... You want to use the system command here ... ... Pid in perl script are different from Pid in bash and so I can't kill them and I can't wait for them. ... 19992 pts/1 00:00:00 example.pl ... 20001 pts/1 00:00:00 sh child process 19993 finished, ...
    (comp.lang.perl.misc)
  • Re: Wait for background processes to complete
    ... trying to use the shell concepts and maximize parallelism). ... the systemcommand - which leaves us back at square one. ... fork, and then do your own wait. ... PID PGID COMMAND ...
    (comp.lang.perl.misc)
  • Re: IPC
    ... >>>....don't return the pid of the subprocess! ... This is a nasty command that attempts to fill up your disk with a file ... Yes, you are correct in that the open command launches a shell process, ...
    (comp.lang.perl.misc)