domingo, 4 de mayo de 2014

Auditoria WIFI - Solución a fixed channel -1

Recientemente me he puesto de nuevo con el tema de las auditorías WIFI, he rescatado mi viejo portátil y para mejorar la capacidad de escaneo me compré una tarjeta inalámbrica con una antena apaña, pero como siempre, algo nuevo trae siempre problemas, y esta vez vinieron con el maldito problema de la fijación de canal, o fixed channel = -1.

Buscando información se trata sobretodo de bugs debido a determinados drivers, que hacen que la interface que crea el airmon-ng se ponga al canal -1, distinto al de tu AP objetivo, lo que hace que la reinyección sea imposible, pero aquí traigo algunas soluciones.

Como siempre mencionar que todo esto lo he probado en mi equipo (Ubuntu 10.04 -  TP-LINK TL-WN722N), desconozco si funcionará en otros, aunque por lo que he leído parece que en muchas ocasiones solventa los problemas.

Como mi sistema es un tanto antiguo estoy usando compat-wireless, (anterior versión del ahora backport), que permite compilar solo la parte de wireless del núcleo de linux, la versión que me solventaba lo del -1 ha sido la 3.7.1, podéis probar con distintas versiones a ver si se os arregla (seguid el link de lista de releases que podéis encontrar al final del post). Debajo tenéis un script que se baja y lo compila añadiendo el parche adecuado, si queréis otra cambiad la URL y listo.

Para versiones posteriores a la v3.3-rc1-2, no es necesario aplicar el parche del -1, por eso la línea de channel-negative-one esta comentada.
También esta comentada la parte de modificar el initramfs, en versiones anteriores había un bug que se solucionaba a pelo modificándolo a mano, de ahí el gedit y las instrucciones.
wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.7.1/compat-drivers-3.7.1-1.tar.bz2
tar -jxf compat-drivers-3.7.1-1.tar.bz2
cd compat-drivers-3.7.1-1
wget http://patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch
#wget http://patches.aircrack-ng.org/channel-negative-one-maxim.patch
patch -p1 < mac80211.compat08082009.wl_frag+ack_v1.patch #patch ./net/wireless/chan.c channel-negative-one-maxim.patch #gedit scripts/update-initramfs #*** FIND LINE 13: KLIB=/lib/modules/2.6.31-wl/build #*** REPLACE WITH: KLIB=/lib/modules/$(uname -r)/build #./script/driver-select
make
sudo make install
sudo make wlunload

Si se os queda en otro número que no sea -1, la única manera que he conseguido de arreglarlo ha sido dejar de usar airmon-ng (si es que se le puede llamar arreglarlo) y usar directamente el iw-if config, debajo tenéis un script que os pone la interfaz en modo monitor en el channel correspondiente que paséis por parámetro.

#!/bin/bash
# this script is to change the channel of the wireless card to the one specified, then puts it in monitor mode.
# make sure you uncheck enable wireless in nm-applet before continuing (this script will have no effect otherwise)
# note that if you are using airmon-ng you may want to manually remove all of the monitor devices it has created. (you don't need them)
# to do this run "airmon-ng stop mon0" and if you had more then run "airmon-ng stop mon1" etc.

# this script has undefined consequences if the commands fail (no error checking)
# it would be good idea to run each of the commands listed here separately to make sure they all work before making use of this script
# note that this is just sequence of commands which I would normally run manually on my system, they may not work on yours.
# also you need to run the script as root

#change this to the interface you wish to change
IFACE="wlan0"

ifconfig $IFACE down
iwconfig $IFACE mode managed
ifconfig $IFACE up
iwconfig $IFACE channel $@
ifconfig $IFACE down
iwconfig $IFACE mode monitor
ifconfig $IFACE up

# this will be displayed on you terminal:
iwconfig $IFACE
# if the frequency hasn't changed then the script didn't work

#here is a list of channels and frequencies so that you know if your channel is set right:
#1 2.412
#2 2.417
#3 2.422
#4 2.427
#5 2.432
#6 2.437
#7 2.442
#8 2.447
#9 2.452
#10 2.457
#11 2.462
# frequencies are in GHz
# there are 13 channels in Europe apparently, I assume that they would be:
#12 2.467
#13 2.472
# but I am reading this off an American table, so i'm not sure
# here it is:
# http://www.cisco.com/en/US/docs/wireless/technology/channel/deployment/guide/Channel.html#wp134132

Y esto es todo en este penco tutorial, pero no hay tiempo para más!

Un saludo

Referencias
Información sobre el FIX para fixed channel -1
http://ubuntuforums.org/showthread.php?t=1598930
Tutorial de aircrack para parchear el compat-wireless y de uso
http://www.aircrack-ng.org/doku.php?id=compat-wireless
Web Backport
http://drvbp1.linux-foundation.org/~mcgrof/rel-html/backports/
Lista de releases compat-wireless/backport
https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.14/
Lista de parches de aircrack
http://patches.aircrack-ng.org/

No hay comentarios:

Publicar un comentario

Ponte un nombre aunque sea falso, que Anó-nimo queda mu feo :(