TL;DR
Hydra can struggle with non-ASCII characters in usernames and passwords. This guide shows how to configure Hydra to handle UTF-8 encoding correctly, allowing you to brute force logins even when they contain special characters.
Solution Guide
- Understand the Problem: Hydra often defaults to using ASCII encoding. When it encounters non-ASCII characters (like é, ü, or Chinese characters), it can misinterpret them, leading to failed login attempts or incorrect password testing.
- Check Your Target System’s Encoding: Before you start, determine the character encoding used by the target system for usernames and passwords. Common encodings include UTF-8, ISO-8859-1, and others. You may need to consult documentation or test with known credentials containing special characters.
- Configure Hydra for UTF-8: The key is to tell Hydra to use UTF-8 encoding. This is done using the
-eoption.hydra -l username -P /path/to/passwordlist -t 4 -e utf-8 target_serviceReplace
usernamewith your target username,/path/to/passwordlistwith the path to your password list file,4with the number of threads andtarget_servicewith the service you are attacking (e.g., ssh://192.168.1.1). - Ensure Your Password List is UTF-8 Encoded: Make sure your password list file itself is saved in UTF-8 encoding.
- Linux/macOS: Use a text editor like
nano,vimorgeditand save the file with UTF-8 encoding. You can also use thefilecommand to verify:file -i /path/to/passwordlistThe output should include “charset=utf-8”. If not, convert it using
iconv:iconv -f ISO-8859-1 -t UTF-8 /path/to/passwordlist > /path/to/passwordlist_utf8.txt - Windows: Use a text editor like Notepad++ and save the file with UTF-8 encoding (usually found in the Encoding menu).
- Linux/macOS: Use a text editor like
- Test with a Known Credential: Create a small password list containing just one known valid credential that *includes* non-ASCII characters. This verifies your configuration.
- Run Hydra: Execute the Hydra command with the
-e utf-8option and your UTF-8 encoded password list. Monitor the output for successful logins.hydra -l username -P /path/to/passwordlist_utf8.txt -t 4 -e utf-8 target_service - Troubleshooting: If you still encounter issues:
- Double-check the target system’s encoding.
- Verify that your password list is *actually* UTF-8 encoded using the
file -icommand (Linux/macOS). - Ensure there are no unexpected characters or formatting issues in your password list.