Check Output for Multiple Hosts
In this step, you will learn how to interpret the output from Hydra when attacking multiple hosts. Hydra's output provides valuable information about the success or failure of the attack attempts.
When Hydra successfully cracks a password, it will display the credentials in the following format:
[<service>] host: <host> login: <username> password: <password>
For example:
[ssh] 192.168.1.100:22 login: root password: password
This indicates that Hydra successfully cracked the SSH password for the user root
on the host 192.168.1.100
, and the password is password
.
When Hydra fails to crack a password, it will typically display an error message such as "Login failed" or "Invalid credentials".
Let's analyze the output from the previous steps.
-
Re-run the Hydra command from the previous step:
hydra -L ~/project/users.txt -P ~/project/passwords.txt -t 4 -M ~/project/targets.txt ssh
-
Examine the output. You will likely see a series of "Login failed" or "Invalid credentials" messages for each target host. This is because the username and password you are using are likely incorrect.
The output might look something like this:
Hydra v9.6 (c) 2024 by van Hauser/THC - use freely but only for legal purposes.
Hydra starting at 2024-10-27 10:00:00
[DATA] 1 task, 3 servers, 1 userfiles, 1 passfiles -> max 1 task per 1 server, overall 1 task per attack
[DATA] attacking ssh://192.168.1.100:22
[STATUS][ssh] 192.168.1.100:22 - Login failed for user 'root'
[DATA] attacking ssh://192.168.1.101:22
[STATUS][ssh] 192.168.1.101:22 - Login failed for user 'root'
[DATA] attacking ssh://192.168.1.102:22
[STATUS][ssh] 192.168.1.102:22 - Login failed for user 'root'
Hydra finished.
If Hydra were to successfully crack a password, you would see a line similar to the example shown above, indicating the successful credentials.
-
To better illustrate a successful login, let's create a scenario where Hydra is more likely to succeed. This requires a vulnerable SSH server. Since we don't have one readily available, we'll modify the targets.txt
file to point to localhost
and attempt to log in as the current user. This will still likely fail, but it's the closest we can get to a "successful" scenario without a dedicated vulnerable target.
First, add 127.0.0.1
to your targets.txt
file:
echo "127.0.0.1" >> ~/project/targets.txt
Now, try to crack the SSH password for the current user (labex) on localhost. You'll need to know the password for the labex
user. If you haven't set one, you can try leaving the password list empty, which will attempt a null password.
hydra -l labex -P ~/project/passwords.txt -t 4 -M ~/project/targets.txt ssh
Note: This will likely still fail unless you have a very simple password for the labex
user or have allowed passwordless SSH login.
Even if the attack fails, the key takeaway is understanding how to interpret Hydra's output. Look for the lines that indicate successful logins, and pay attention to the error messages to understand why attacks are failing.
In this step, you have learned how to check the output from Hydra when attacking multiple hosts and how to interpret the results. This is a crucial skill for understanding the success or failure of your password cracking attempts.