Banner 1

Mostrando entradas con la etiqueta hydra. Mostrar todas las entradas
Mostrando entradas con la etiqueta hydra. Mostrar todas las entradas

Using hydra to bruteforce a router with cgi-bin/[xy] authentication

0 comentarios
I recently started playing around with Hydra and tried to hack my router. After searching the forum and googleing around a while I noticed that there are only some howto's for routers that have http-auth authentication. That is, when you go to 192.168.2.1 e.g. and before showing anything you have to enter login and password in a popup. My router (T-Com Sinus 154 DSL Basic 3) and many others I've dealt with so far work differently. When I want to login to my router, I have to go to 192.168.2.1, a web interface with a password field shows up, and I have to enter the password which is then checked by /cgi-bin/login.exe via http-post.

It was quite tricky to find out how to use this authentication with hydra, so I guess there are some of you that can benefit from this. I'll describe how I did it, so you can adapt the method and use it with your own router.

First of all I examined the login page of the web interface. Be sure to look at the frame source and not the frameset. You should see the form and the action, here's what I saw:

The form is defined as:

Code:
Somewhere in the form there will be the field that takes the password:

Code:
This is probably the most important data you need. You need to write down the field name ("pws" in my case). The size attribute comes in very handy too because it tells us that the password's max length is 12 characters.

After that I tried to get familiar with Hydra's options. I figured out that you need the following options:

Code:
-l ""
Sets the login name. In the end I don't need a login name but hydra gets kind of pissed when you don't pass something, so I gave an empty string.

Code:
-P passwords.txt
The wordlist to use for the password

Code:
-t 1
1 task only, not really neccesary, I just wanted to make sure Hydra doesn't choke on too many requests

Code:
-f
Hydra shall stop when a working password is found

Code:
-v -V
be verbose. and even more. I skipped that in the final version but it's ok for debugging

Code:
192.168.2.1
the victim's ip

Code:
http-post-form
the method to use

Code:
/cgi-bin/login.exe:pws=^PASS^:loginpserr.htm
This is the most important part. Here we tell Hydra what to pass the passwords to. The argument consists of three parts separated by ":".

The first part is the script that takes the POST data, we found that in the frame source above.

The second part is the field name of the password field with an added =^PASS^. ^PASS^ is the variable that hydra substitutes with the passwords in the wordlist.

The third part is the "incorrect" condition. Hydra has to find out somehow if the current password that was send to the router is correct or not. You have to find a string that is actually IN A NEGATIVE RESPONSE from the router. As we don't have the password yet we can't know what the router will send if the password is correct, therefore we have to check if it is NOT, which we can find out easily. To find out what the router sends back to hydra I used Wireshark.

Open up wireshark, go to the router login page, start capturing and then login with a wrong password. After that, stop capturing and apply a "http" filter. You will see the POST data sent from hydra to the router (you should also see the "pws=blabla" in the details, that's where hydra sends the passwords from the wordlist). Below that you'll find the router answer. In my case it says something like "This page has moved to loginpserr.htm" packed in some basic HTML. So I used the string loginpserr.htm to validate the .. uhm... faultyness. OMFG %-]

Hydra will consider a password as CORRECT when the router answer DOES NOT contain the given string. So be sure to take an expression that somehow sounds like "incorrect" oder "wrong". If you took "the" for example, and the POSITVE response would be something like "the password you entered was correct", hydra will not recognize it as correct but incorrect.

Here's the complete example:

Code:
hydra -l "" -P passwords.txt -t 1 -f -v -V 192.168.2.1 http-post-form /cgi-bin/login.exe:pws=^PASS^:loginpserr.htm
If your router does not only need a password but also a username, you can easily add the according login name to the last part. So if you need to send the field "login" or whatever it is called in your case with the value "admin" as the only username you could use

Code:
/cgi-bin/login.exe:login=admin&pws=^PASS^:loginpserr.htm
When you need to try a whole username list then you can specify the list via

Code:
-L usernames.txt
and

Code:
/cgi-bin/login.exe:login=^USER^&pws=^PASS^:loginpserr.htm

Ok, looks like I've just finished my very first howto, hope you like it. Please let me know if this works for you. Have fun! =)

RaginRob

fuente:http://forums.remote-exploit.org/showthread.php?t=14910

Buscando passwords inseguros con Hydra

0 comentarios

Es sabido que las contraseñas son uno de los puntos más débiles que existe en la seguridad informática, ya que una mala definición de estos facilita tanto ataques por ingeniería social como basados en un diccionario. Estos últimos se concretan en combinar una serie de nombres de usuario (login) contra una lista de contraseñas hasta acertar, lo que naturalmente requiere de tiempo de operación y conforme pasa el tiempo, más recursos de los equipos involucrados. En esta ocasión veremos una aplicación por demás sencilla y al mismo tiempo, versátil, denominada simplemente 'THC-Hydra'.

THC-Hydra entra en la categoría de programas network logon cracker, creado por The Hackers Choice (THC), grupo de expertos en seguridad que han liberado en sus diez años de existencia diversas herramientas y documentos, entre los que se encuentra esta, que es soportada en Unix, Windows (con Cywin) y Palm. Dos características que llaman la atención de este programa son:

  1. Es extremadamente rápido, aún leyendo diccionarios muy grandes.
  2. Soporta múltiples protocolos, como Telnet, HTTP, FTP, SSH, POP3, ICQ, LDAP y muchos más.

A continuación veremos los prodecimientos de instalación y uso, donde se utilizó la versión THC-Hydra 4.7 en un equipo con Fedora Core 2.

Instalación.

  1. Descargar el paquete desde http://thc.org/thc-hydra/ y descompactarlo.
  2. Entrar en la carpeta y ejecutar './configure'.
  3. Ejecutar 'make'.
  4. Cambiar al superusuario y ejecutar en la misma carpeta 'make install'.

Durante la instalación se crea tanto la versión en línea de comandos como el GUI, aunque este último en ocasiones falla, pero no es crítico.

Utilización.

  1. Línea de comandos. Desde una terminal (no se requiere ser el superusuario) se pueden realizar escaneos diversos, usando la siguiente sintaxis, que se puede consultar a detalle con teclear 'hydra --help'.
      hydra [[[-l LOGIN|-L ARCHIVO] [-p PASS|-P ARCHIVO]] [-C ARCHIVO]]
    [-e ns] servidor servicio
    Algunos ejemplos de esto serían:
     # Prueba un password con el root de MySQL localmente
    hydra localhost mysql -l root -p passwd

    # Prueba una lista de usuarios y passwords contra un FTP remoto
    hydra 192.64.2.14 ftp -L usuarios.txt -P passwd.txt

    # Prueba una lista de usuarios y passwords en un servicio de correo
    # incluyendo el mismo login y contraseñas en blanco
    hydra 192.64.2.6 pop3 -L usuarios.txt -P passwd.txt -e ns
  2. Interfase gráfica. Naturalmente es más sencilla de usar, sólo debemos teclear 'xhydra' en la línea de comandos, lo que inicia una interfase como la siguiente, donde explicamos brevemente los puntos más relevantes.
    Configuración del objetivo

    Fig. 1. Definimos el destino o destinos de los ataques, el puerto en caso de usar uno no convencional y el protocolo.
    Listas de logins y passwords

    Fig. 2. Puede ser un sólo nombre de usuario y password o una lista de cada uno, se recomienda buscar tanto el login igual a la contraseña como aquellas que estén en blanco.
    Especificaciones de desempeño

    Fig. 3. Especificamos el número de ataques en paralelo y si deseamos detenerlo después de un tiempo de no conectarse; también se configura la salida a través de un proxy server.
    Inicio del ataque

    Fig. 4. Inicia el ataque y nos despliega los resultados de la búsqueda.

Diccionarios de usuarios/passwords. Existen algunas listas de palabras comunes usadas como contraseñas, como la recopilada por George Shaffer, que incluye algunas muy comunes o muy malas, aunque en principio cualquier listado de palabras puede dar resultados. Los nombres de usuario son variados, pero dependiendo de la plataforma, existen algunos invariables, como estos ejemplos.

# Listado de nombres de usuario comunes
admin
administer
administrator
monitor
root
webmaster
postmaster
# Listado de passwords comunes
password
passwd
123456

Otras consideraciones. Siempre debemos notificar a los administradores respecto a estas pruebas, ya que es posible que un servicio sea bloqueado y hacemos muchas pruebas en paralelo o por mucho tiempo.

Mejores prácticas para la administración de contraseñas.

Estas son algunas recomendaciones para mantener nuestras contraseñas.

  • Utilizar una combinación de caractéres que recordemos, que incluya letras, números y caractéres especiales, excepto los latinos (letras acentuadas, eñe).
  • Utilizar letras en mayúsculas y minúsculas.
  • Darle una extensión mínima de 7 caractéres.
  • Cambiarla cada cierto tiempo. Tres meses es un buen promedio.

Esta es una lista de aquello que NO debemos hacer al definir una contraseña.

  • No utilizar sólo letras o números.
  • No utilizar palabras reconocibles, aún cuando se invierta su sentido o cambien letras por números.
  • No utilizar información personal.
  • No utilizar el mismo password para todos los equipos/servicios.
  • No escribir las contraseñas en un papel y si es en medio eléctronico, aplicarle algún tipo de encriptación.
  • No proporcionarla verbal o electrónicamente.

Diccionarios de passwords por defecto de diversas aplicaciones. Estas son suministradas por los mismos administradores de las aplicaciones, no sólo para que otros las conozcan, sino para impulsar su actualización.

Verificación del nivel de seguridad de un password. Permiten identificar el nivel de seguridad que proporciona una contraseña determinada.

Herramientas similares. Estas aplicaciones tiene un acercamiento diferente pero realizan igualmente la verificación de passwords en diversas aplicaciones y protocolos mediante ataques por diccionario.

fuente: http://www.mexicoextremo.com.mx/content/view/482/62/
Powered by Bad Robot
Helped by Blackubay