viernes, 27 de junio de 2008

Instalacion y configuracion de una Honeypot

Lo primero que vamos a hacer es instalar el paquete honeyd
#apt-get install honeyd

Los principales archivos que se instalan son los siguientes
/etc/init.d/honeyd
/etc/logrotate.d/honeyd
/etc/default/honeyd
/usr/lib/honeyd
/usr/share/honeyd
/usr/share/doc/honeyd
/usr/include/honeyd
/usr/bin/honeyd


ahora pasamos ala configuracion de nuestra honeypot y este seria el archivo de configuracion

############################
#Configuration du réseau virtuel utilisé
route entry 10.0.0.1
route 10.0.0.1 link 10.2.0.0/24
route 10.0.0.1 add net 10.3.0.0/16 10.3.0.1 latency 8ms bandwidth 10Mbps
route 10.3.0.1 link 10.3.0.0/24
route 10.3.0.1 add net 10.3.1.0/24 10.3.1.1 latency 7ms loss 0.5
route 10.3.1.1 link 10.3.1.0/24

############################
# Création d'un profil template
create template
set template personality "Microsoft Windows XP Professional SP1"
set template uptime 1728650
set template maxfds 35
# For a complex IIS server
add template tcp port 80 "sh /usr/share/honeyd/scripts/win32/web.sh"
add template tcp port 22 "/usr/share/honeyd/scripts/test.sh $ipsrc $dport"
add template tcp port 23 proxy $ipsrc:23
add template udp port 53 proxy 141.211.92.141:53
set template default tcp action reset
# Use this if you are not running honeyd as 'honeyd' user:
# Debian-specific (use nobody = 65534 instead of 32767)
# set template uid 65534 gid 65534

############################
#Création d'un profil default
create default
set default default tcp action block
set default default udp action block
set default default icmp action block

############################
#Création d'un profil router
create router
set router personality "Cisco 1601R router running IOS 12.1(5)"
set router default tcp action reset
add router tcp port 22 "/usr/share/honeyd/scripts/test.sh"
#add router tcp port 23 "/usr/share/honeyd/scripts/router-telnet.pl"
add router tcp port 23 "/usr/share/honeyd/scripts/telnet/fake.pl"

###########################
#On démarre les hotes en spécifiant l'IP et le profil
bind 10.3.0.1 router
bind 10.3.1.1 router
bind 10.3.1.12 template
bind 10.3.1.11 template
bind 10.3.1.10 template
set 10.3.1.11 personality "Microsoft Windows NT 4.0 SP3"
set 10.3.1.10 personality "IBM AIX 4.2"


Para poner en marcha la red virtual más arriba tendremos que declarar un camino (real) en la tabla de enrutamiento para llegar a ella. La passerelle utilisée pour cette route sera l'interface loopback (localhost) afin de ne pas perturber le réseau existant. El puente utilizado para esta ruta va a proporcionar una interfaz loopback (localhost) con el fin de no perturbar la red existente.

route add -net 10.0.0.0 netmask 255.0.0.0 gw localhost

Para
probar esta configuración nos Honeyd primer lanzamiento en modo interactivo ejecutando el
comando a continuación en una consola

#honeyd -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf
-i lo 10.0.0.0/8


gold@deb ~# honeyd -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
Honeyd V1.5b Copyright (c) 2002-2004 Niels Provos
honeyd[3676]: started with -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
honeyd[3676]: listening on lo: ip and (dst net 10.0.0.0/8)

esto es lo que deveria salir si todo a marchado bien ahora lo paramos con ctrl+c
y vamos a funcionar nuestra honeypot como demonio

Para ello vamos a cambiar el archivo de configuración del diablo. editaremos el fichero
#pico /etc/default/honeyd
Como primer paso, tenemos que cambiar la constante RUN para iniciar el demonio

RUN="yes"

A continuación, indicar la interfaz utilizada y el rango de direcciones IP de la red:
INTERFACE="eth0"
NETWORK=10.0.0.0/8

A continuación, iniciar el demonio Honeyd con el comando
 /etc/init.d/honeyd start / Etc / init.d / honeyd inicio 
Si no hay ningun error nos debe salir lo siguiente
Starting Honeyd daemon: honeyd.

para emular los servicios corriendo en una maquina virtual. honeyd permite el uso de unos scripts.
los ejemplos de estos scripts se encuentran en el directorio

/usr/share/honeyd/scripts


conesto vamos a probar ke la honey esta funcionado

honeyd -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
Honeyd V1.5b Copyright (c) 2002-2004 Niels Provos
honeyd[3753]: started with -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
honeyd[3753]: listening on lo: ip and (dst net 10.0.0.0/8)


ahora vamos a probar haciendo un ping
# ping 10.3.0.1
PING 10.3.0.1 (10.3.0.1) 56(84) bytes of data.
64 bytes from 10.3.0.1: icmp_seq=1 ttl=63 time=10.0 ms
64 bytes from 10.3.0.1: icmp_seq=2 ttl=63 time=10.0 ms
64 bytes from 10.3.0.1: icmp_seq=3 ttl=63 time=10.0 ms
64 bytes from 10.3.0.1: icmp_seq=4 ttl=63 time=10.0 ms
64 bytes from 10.3.0.1: icmp_seq=5 ttl=63 time=10.0 ms
64 bytes from 10.3.0.1: icmp_seq=6 ttl=63 time=10.0 ms


y este seria el resultado de la honeyd respondiendo al ping

# honeyd -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
Honeyd V1.5b Copyright (c) 2002-2004 Niels Provos
honeyd[3753]: started with -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
honeyd[3753]: listening on lo: ip and (dst net 10.0.0.0/8)
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249

ahora vamos a probar utilizando un scrip de simulacion de sevicios

# telnet 10.3.0.1 23
Trying 10.3.0.1...
Connected to 10.3.0.1.
y la honeyd debe responder al telnet de la siguiente manera

honeyd -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
Honeyd V1.5b Copyright (c) 2002-2004 Niels Provos
honeyd[3753]: started with -d -p /etc/honeypot/nmap.prints -l /var/log/honeypot/honeyd.log -f /etc/honeypot/honeyd.conf -i lo 10.0.0.0/8
honeyd[3753]: listening on lo: ip and (dst net 10.0.0.0/8)
honeyd[3753]: Sending ICMP Echo Reply: 10.3.0.1 -> 192.168.0.249
honeyd[3753]: Connection request: tcp (192.168.0.249:1584 - 10.3.0.1:23)
honeyd[3753]: Connection established: tcp (192.168.0.249:1584 - 10.3.0.1:23) <-> /usr/share/honeyd/scripts/telnet/fake.pl



y asi damos terminada la configuracion de esta honeypot y podemos ver que los
resultados fueron satisfactorios con base en las perspectivas que teniamos sobre el tema.

No hay comentarios: