Warum gibt hydra keinen gültigen Benutzernamen und kein gültiges Passwort mit einem gültigen angegebenen Benutzernamen und Passwort zurück?

2699
zeta

Ich teste gerade Hydra auf OSX Yosemite, installiert mit Brew

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 

Um HTML-Post zu testen, ist dies der Fall.

Ich habe eine PHP-Datei mit dem Apache-Webserver namens 'index.php' wie folgt:

<?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> 

Es läuft auf meinem Rechner, also um

http://localhost/security/3/php/index.php 

Im Grunde handelt es sich um ein HTML-Formular, in dem die Zeichenfolge "Eingeloggt" ausgegeben wird, wenn die Anmeldung erfolgreich ist. Andernfalls wird die Zeichenfolge "Fehler" ausgegeben.

Ich habe mit user: admin password: r00t im Browser getestet, es stand 'Logged in'. Und ich verwende fehlgeschlagene Anmeldeinformationen, es wurde 'Fehler' angezeigt.

Mit Hydra habe ich jedoch versucht:

hydra -l admin -p r00t localhost http-post-form "/security/3/php/index.php:login_field=^USER^&password_field=^PASS^&go_field=Login:Error"

Ich habe diese Ausgabe erhalten:

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 

Ich bin mir nicht ganz sicher, wo ich mich geirrt habe. Könnte jemand mich bemerken oder vorschlagen?

Die folgenden HTTP-Header sind bei Verwendung des HTTP-Formulars mit dem Browser zu verwenden:

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

Nachdem ich versucht habe, diese Header in Hydra zu konstruieren, stelle ich Folgendes vor:

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" 

Ausgabe

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 

Es scheint nicht zu funktionieren.

0
Ich hatte einige Probleme mit Hydra, wenn es um HTTP-Header ging. Ich bin ein kompletter PHP-Noob, aber müssen Sie eventuell einen Header zusammen mit der Anfrage senden? So etwas wie Content-Type: application / x-www-form-urlencoded. Wenn dies der Fall ist, überprüfen Sie bitte meine Frage zu Hydra: https://security.stackexchange.com/questions/57839/hydra-bruteforce-and-json Michael vor 9 Jahren 0
Ich habe es gerade ausprobiert und es hat für mich funktioniert. Ich benutze jedoch Hydra v7.6. Debuggen Sie Ihren Netzwerkverkehr, um zu sehen, ob er sendet, was Sie von dem erwarteten Host erwarten. SilverlightFox vor 9 Jahren 0
@Michael Schön, danke. Ich werde das überprüfen. zeta vor 9 Jahren 0
@SilverlightFox oh, ok. zeta vor 9 Jahren 0
Warum bearbeiten Sie Ihre Frage nicht, um diese Informationen hinzuzufügen? Es ist nicht sehr einfach in einem Kommentar zu lesen. SilverlightFox vor 9 Jahren 0
@SilverlightFox Entschuldigung, dachte, es sei möglich zu formatieren. jetzt ist es fraglich. Vielen Dank. zeta vor 9 Jahren 0

1 Antwort auf die Frage

0
zeta

Dies war ein behobener Fehler in Release 8.2-pre, da der Changelog https://github.com/vanhauser-thc/thc-hydra/blob/master/CHANGES#L7 beschrieben hat