Esse foi um bug fixo na versão 8.2-pre, como o log de alterações descrito link
Estou apenas experimentando a hydra no OSX Yosemite, instalada com bebida
brew info hydra
hydra: stable 8.0 (bottled), HEAD
https://www.thc.org/thc-hydra/
/usr/local/Cellar/hydra/8.0_1 (14 files, 1.2M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/hydra.rb
==> Dependencies
Build: pkg-config ✔
Required: openssl ✔
Optional: libidn ✘, libssh ✘, pcre ✔, gtk+ ✘
==> Options
--with-gtk+
Build with gtk+ support
--with-libidn
Build with libidn support
--with-libssh
Build with libssh support
--with-pcre
Build with pcre support
--HEAD
install HEAD version
para testar post de formulário em html, este é o caso.
Eu tenho o arquivo php sendo executado com o servidor da web apache chamado 'index.php' da seguinte forma:
<?php
$login = 'admin';
$password = 'r00t';
?>
<html>
<head>
<title>PHP Form Auth</title>
</head>
<body>
<?php
if (isset($_POST['go_field']))
{
if ($_POST['login_field'] == $login && $_POST['password_field'] == $password)
{
echo 'Logged in';
}
else
{
echo 'Error';
}
}
else
{
?>
<form method="POST">
<input type="text" name="login_field" /> Login <br />
<input type="password" name="password_field" /> Password <br />
<input type="submit" name="go_field" value="Login" />
</form>
<?php
}
?>
</body>
Ele está sendo executado na minha máquina, ou seja,
http://localhost/security/3/php/index.php
Basicamente, é um formulário html que imprime a string 'Logged in' se o login for bem-sucedido, caso contrário, imprimirá a string 'Error'.
Eu testei usando user: admin password: r00t no navegador, ele disse 'Logged in'. E eu uso credencial com falha, ele disse 'Erro'
No entanto, com a hydra, tentei:
hydra -l admin -p r00t localhost http-post-form "/security/3/php/index.php:login_field=^USER^&password_field=^PASS^&go_field=Login:Error"
Eu recebi esta saída:
Hydra v8.0 (c) 2014 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (http://www.thc.org/thc-hydra) starting at 2014-12-03 21:58:40
[DATA] max 1 task per 1 server, overall 1 tasks, 1 login try (l:1/p:1), ~1 try per task
[DATA] attacking service http-post-form on port 80
1 of 1 target completed, 0 valid passwords found
Hydra (http://www.thc.org/thc-hydra) finished at 2014-12-03 21:58:41
Não sei bem onde estava errado. Alguém poderia me notar ou sugerir?
A seguir, cabeçalhos http quando uso o formulário http com o navegador:
POST /security/3/php/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/security/3/php/
Cookie: __vjstorage=%7B%7D
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 52
login_field=admin&password_field=r00t&go_field=Login
Depois que eu tentei construir esses cabeçalhos em hydra, eu emito:
hydra -v -V -l admin -p r00t -s 80 localhost http-post-form "/security/3/php/index.php:login_field=^USER^&password_field=^PASSWORD^&go_field=Login:Error:H=Host: localhost:H=User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0:H=Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8:H=Accept-Language: en-US,en;q=0.5:H=Accept-Encoding: gzip, deflate:H=Referer: http://localhost/security/3/php/:H=Cookie: __vjstorage=%7B%7D:H=Connection: keep-alive:H=Content-Type: application/x-www-form-urlencoded:H=Content-Length: 52"
Saída
Hydra v8.0 (c) 2014 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (http://www.thc.org/thc-hydra) starting at 2014-12-05 17:33:10
[DATA] max 1 task per 1 server, overall 1 tasks, 1 login try (l:1/p:1), ~1 try per task
[DATA] attacking service http-post-form on port 80
[VERBOSE] Resolving addresses ... done
[ATTEMPT] target localhost - login "admin" - pass "r00t" - 1 of 1 [child 0]
[STATUS] 1.00 tries/min, 1 tries in 00:01h, 1 todo in 00:01h, 1 active
[STATUS] 0.50 tries/min, 1 tries in 00:02h, 1 todo in 00:01h, 1 active
[STATUS] 0.33 tries/min, 1 tries in 00:03h, 1 todo in 00:01h, 1 active
Não parece funcionar.
Esse foi um bug fixo na versão 8.2-pre, como o log de alterações descrito link