5. Hydra modules

stejwes@htb[/htb]$ hydra -h | grep "Supported services" | tr ":" "\n" | tr " " "\n" | column -e

Supported			        ldap3[-{cram|digest}md5][s]	rsh
services			        memcached					rtsp
				            mongodb						s7-300
adam6500			        mssql						sip
asterisk			        mysql						smb
cisco				        nntp						smtp[s]
cisco-enable		        oracle-listener				smtp-enum
cvs				            oracle-sid					snmp
firebird			        pcanywhere					socks5
ftp[s]				        pcnfs						ssh
http[s]-{head|get|post}		pop3[s]						sshkey
http[s]-{get|post}-form		postgres					svn
http-proxy		        	radmin2						teamspeak
http-proxy-urlenum		    rdp				  		    telnet[s]
icq				            redis						vmauthd
imap[s]		        		rexec						vnc
irc				            rlogin						xmpp
ldap2[s]		        	rpcap

For HTTP forms, In this situation there are only two types of http modules interesting for us:

  1. http[s]-{head|get|post}
  2. http[s]-post-form

1= basic http, 2= login forms like php or aspx

When we try to log in with any credentials and don't see any of our input in the URL, and the URL does not change, we know that the web application uses a POST form.

Based on the URL scheme at the beginning, we can determine whether this is an HTTP or HTTPS post-form. If our target URL shows http, in this case, we should use the http-post-form module.
hydra http-post-form -U
[...]
Syntax:
<url>:<form parameters>:<condition string>[:<optional>[:<optional>]
Examples:
 "/login.php:user=^USER^&pass=^PASS^:incorrect"

The third parameter is a failed/successful login attempt string. We cannot log in, so we do not know how the page would look like after a successful login, so we cannot specify a success string to look for.

/login.php:[user parameter]=^USER^&[password parameter]=^PASS^:[FAIL/SUCCESS]=[success/failed string]

To make it possible for hydra to distinguish between success/fail, specify string from source code of page we're using to login. Hydra will examine html of response looking for string provided.

We can specify two different types of analysis that act as a Boolean value.

Type Boolean Value Flag
Fail FALSE F=html_content
Success TRUE S=html_content

If we provide fail - Hydra will look until string is not found in response. If we provide success - opposite.

So, let's look for a unique string so that if it is missing from the response, we must have hit a successful login. This is usually set to the error message we get upon a failed login, like Invalid Login Details. However, in this case, it is a little bit trickier, as we do not get such an error message. So is it still possible to brute force this login form?

The strategy here since the page doesn't change -

  <form name='login' autocomplete='off' class='form' action='' method='post'>

We don't have to provide the entire string. We can use <form name='login'

Thus, syntax becomes:

"/login.php:[user parameter]=^USER^&[password parameter]=^PASS^:F=<form name='login'"