Strona 1 z 2

usuwanie rootkita na serwerze produkcyjnym

: 19 marca 2010, 19:47
autor: Bastian
Witam.
Na serwerze założyłem nowe konto i na nim (i tylko na nim, na wcześniej założonych nie ma problemu) mam coś takiego:

Kod: Zaznacz cały

grzempa@d104747:~$ ls
ls: unrecognized prefix: do
ls: unparsable value for LS_COLORS environment variable
rkhunter.log
Z tego co wyczytałem w internecie to może być rootkit. Więc przejechałem rkhunteremi w dwóch miejscach mam:

Kod: Zaznacz cały

 Rootkit 'SHV4'...                                          [ Warning! ]

             --------------------------------------------------------------------------------
         Found parts of this rootkit/trojan by checking the default files and directories
         Please inspect the available files, by running this check with the parameter
         --createlogfile and check the log file (current file: /dev/null).
         --------------------------------------------------------------------------------

Kod: Zaznacz cały

   Rootkit 'SHV5'...                                          [ Warning! ]

             --------------------------------------------------------------------------------
         Found parts of this rootkit/trojan by checking the default files and directories
         Please inspect the available files, by running this check with the parameter
         --createlogfile and check the log file (current file: /dev/null).
         --------------------------------------------------------------------------------
W logu mam takie elementy:

Kod: Zaznacz cały

[15:32:03] *** Start scan SHV4 ***
[15:32:03]   - File /etc/ld.so.hash... OK. Not found.
[15:32:03]   - File /lib/libext-2.so.7... OK. Not found.
[B][15:32:03]   - File /lib/lidps1.so... WARNING! Exists.[/B]
[15:32:03]   - File /usr/sbin/xntps... OK. Not found.
[15:32:03]   - Directory /lib/security/.config... OK. Not found.
[15:32:03]   - Directory /lib/security/.config/ssh... OK. Not found.
[15:32:12] *** Start scan SHV5 ***
[B][15:32:12]   - File /etc/sh.conf... WARNING! Exists.[/B]
[15:32:12]   - File /dev/srd0... OK. Not found.
[B][15:32:12]   - Directory /usr/lib/libsh... WARNING! Exists.[/B]
Pytanie, jak się tego pozbyć. Reinstalacja systemu jest ostatecznością bo to jest serwer produkcyjny. No i czy w ogóle to co wyświetla polecenie ,,ls'' ma związek z tymi rootkitami, czy może to są dwie różne rzeczy?

: 19 marca 2010, 21:10
autor: tremor
Dal każdego podejrzanego pliku użyj

Kod: Zaznacz cały

dpkg -S nazwa_pliku
by zidentyfikować do jakiego pakietu należy a następnie daj

Kod: Zaznacz cały

apt-get install --reinstall nazwa_pakietu

: 20 marca 2010, 02:03
autor: lolleq
Kopia danych i postawienie czystego systemu, jedyna pewna na 100% metoda... może nieco paranoiczna - ale skuteczna ;)

: 20 marca 2010, 08:39
autor: Bastian

Kod: Zaznacz cały

grzempa@d104747:~$ sudo dpkg -S lidps1.so
Password:
dpkg: *lidps1.so* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S lidps1
dpkg: *lidps1* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S sh.conf
dpkg: *sh.conf* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S libsh
dpkg: *libsh* nie odnaleziony.
Czyli co moge usuwać przez rm ?

Kod: Zaznacz cały

Kopia danych i postawienie czystego systemu, jedyna pewna na 100% metoda... może nieco paranoiczna - ale skuteczna
Tak jak pisałem wolałbym tego uniknąć, bo dla mnie to weekend w robocie, i jest to serwer produkcyjny

: 20 marca 2010, 11:41
autor: tremor
grzempek pisze:

Kod: Zaznacz cały

grzempa@d104747:~$ sudo dpkg -S lidps1.so
Password:
dpkg: *lidps1.so* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S lidps1
dpkg: *lidps1* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S sh.conf
dpkg: *sh.conf* nie odnaleziony.
grzempa@d104747:~$ sudo dpkg -S libsh
dpkg: *libsh* nie odnaleziony.
Czyli co moge usuwać przez rm ?
Tak sądzę, choć myślę, że wszyscy zgadamy się ze stwierdzeniem lollqa.

: 22 marca 2010, 14:32
autor: Bastian
Przez rm nie daje rady, bo sprytnie ustawia flagi dla wszystkich plików na +ias. Pomaga:

Kod: Zaznacz cały

chattr -V -ias sh.conf

Kod: Zaznacz cały

chattr -RV -ias libsh
rkhunter przechodzi pomyślnie


PS. Moj nickname uległ zmianie, gdyby to kogoś zaskakiwało.

: 22 marca 2010, 22:57
autor: Bastian
A czy ktoś wie jak poradzić sobie z tym:

Kod: Zaznacz cały

user@d104747:~$ ls
ls: unrecognized prefix: do
ls: unparsable value for LS_COLORS environment variable
?

: 22 marca 2010, 23:20
autor: AdeBe
Prawdopodobnie źle określony alias.
Sprawdź co masz w pliku

Kod: Zaznacz cały

~/.bashrc
lub
~/.bash_aliases
jeśli ten drugi istnieje.

: 23 marca 2010, 10:14
autor: Bastian

Kod: Zaznacz cały

user@d104747:~$ cat .bashrc 
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color)
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    ;;
*)
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    ;;
esac

# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
#    . ~/.bash_aliases
#fi

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
export LS_COLORS=fi

Kod: Zaznacz cały

user@d104747:~$ cat .bash_profile 
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs
#umask 022

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
    PATH=~/bin:"${PATH}"
fi

: 23 marca 2010, 22:06
autor: tremor
Po prostu usuń linijkę

Kod: Zaznacz cały

export LS_COLORS=fi
z .bashrc.