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:
After that I tried to get familiar with Hydra's options. I figured out that you need the following options:
Code:
-l ""
Code:
-P passwords.txt
Code:
-t 1
Code:
-f
Code:
-v -V
Code:
192.168.2.1
Code:
http-post-form
Code:
/cgi-bin/login.exe:pws=^PASS^:loginpserr.htm
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
Code:
/cgi-bin/login.exe:login=admin&pws=^PASS^:loginpserr.htm
Code:
-L usernames.txt
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
No hay comentarios:
Publicar un comentario