Get a Pentest and security assessment of your IT network.

Cyber Security

Hydra Bruteforce Guide

TL;DR

This guide shows you how to use Hydra to try and guess passwords for various services. It’s a powerful tool, but remember that using it against systems you don’t have permission to test is illegal.

What is Hydra?

Hydra is a parallelized login cracker. It supports many different protocols (like SSH, FTP, HTTP, etc.) and can try various username/password combinations quickly. It’s often used in penetration testing but can also be misused.

Prerequisites

  • Linux: Hydra is best suited for Linux environments (Kali Linux is a popular choice).
  • Hydra Installed: You’ll need to have Hydra installed. Use your distribution’s package manager. For example, on Debian/Ubuntu:
    sudo apt update
    sudo apt install hydra
  • Target Information: You need the IP address or hostname of the target system and the service you want to attack (e.g., SSH port 22).
  • Wordlist: A text file containing a list of potential usernames and passwords. Common wordlists are available online, but creating your own tailored lists is more effective.

Step-by-step Guide

  1. Basic SSH Bruteforce: This example attempts to brute-force an SSH login.
    hydra -l  -P   ssh
    • Replace <username> with the target username (or use a wordlist for usernames too).
    • Replace <password_list.txt> with the path to your password list file.
    • Replace <target_ip> with the IP address or hostname of the target system.
  2. Specifying a Port: If SSH is running on a non-standard port (e.g., 2222):
    hydra -l  -P   ssh -p 2222
  3. Using Multiple Threads: Increase the number of threads for faster cracking (be careful not to overload the target system).
    hydra -l  -P   ssh -t 16
    • The -t option sets the number of threads (e.g., 16).
  4. Bruteforcing FTP: Example for brute-forcing an FTP login.
    hydra -l  -P   ftp
  5. Bruteforcing HTTP Basic Authentication:
    hydra -l  -P   http-post-form "/login.php:username=^USER^&password=^PASS^":method=POST
    • Replace /login.php with the actual login form URL.
    • Adjust the POST parameters if needed (check the website’s source code).
  6. Using a Username Wordlist: If you have separate wordlists for usernames and passwords:
    hydra -L  -P   ssh
    • Replace <username_list.txt> with the path to your username list file.
  7. Saving Results: Redirect output to a file for later analysis.
    hydra -l  -P   ssh > results.txt
  8. Help and Options: Use the -h option to see all available options.
    hydra -h

Important Considerations

  • Legality: Always get permission before testing any system. Unauthorized access is illegal.
  • Rate Limiting: Many systems have rate limiting in place to prevent brute-force attacks. Be mindful of this and adjust your thread count accordingly.
  • Account Lockout: Repeated failed login attempts can lock accounts.
  • Wordlist Quality: The effectiveness of Hydra depends heavily on the quality of your wordlists. Use common passwords, variations, and any known information about the target system.
  • cyber security measures like two-factor authentication will prevent this attack from working.
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation