Write-up to Password Spraying

Write-up to Password Spraying #

Task #

The password is known but not the username. This is a realistic task, if one assumes that many people assuming that many use a password that is too weak.

The task gives me a password, a range of valid usernames (500 pieces) and I am supposed to find the password. To make matters worse, the password changes every 60 minutes. Furthermore, only 10 invalid login attempts are possible, otherwise you are blocked for 10min by fail2ban.

Procedure #

  1. Search for a tool that iterates username and keeps password constant.
  2. Read Fail2Ban documentation to find out if it works like a ReverseProxy or if it reads log files and thus reads log files and thus reacts delayed.
  3. Look for a tool that can change IP addresses (Tor?). The Fail2ban service blocks sender IPs.
  4. Search vulnerability database to find ways against fail2ban. Possibly crashes from the tool are useful for our purposes (see point 2).

Tools #

  1. To point 1 in the procedure Hydra or Medusa offer themselves. A tutorial for this can be found at redteamtutorials.com. can be found. Hydra also has a UI that can be used.
  2. According to documentation it scans the log files. files, which may allow an attack by fast iteration.

    It scans log files and detects patterns which correspond to possible breaking attempts and then performs actions. Most of the time, it consists of adding a new rule in a firewall chain and sending an e-mail notification to the system administrator.

  3. Hydra can accept a proxy list. At 500 attempts / 10 about 50 proxies are needed. There are many proxy lists on the internet which are sufficient for our purposes.
  4. There is also a tool Proxychain that can override the network functions can be overridden and used.
  5. With Excel / LibreOffice a list of usernames can be created (Autoincrement function).

Implementation #

I use proxychain. Partially it can’t resolve the DNS and this can be done at the expense of privacy by commenting out the proxy_dns parameter in /etc/proxychains4.conf. can be disabled.

  1. start Tor - no special configuration needed
  2. check proxychain config in /etc/proxychains4.conf, if socks4 9050 is entered in [ProxyList]. is entered. 3.
  3. create a list of usernames and save it (e.g. as usernames.txt). Can be created with Excel/libreOffice.
  4. configure Hydra command via UI and then copy for console (http) proxychains4 -f proxychains4_2.conf hydra -t 64 -s 80 -v -V -I -L /root/usernames.txt -p password -f -m / pwspray.vm.vuln.land http-get.
  5. configure hydra command via UI and then copy it for console (ftp) torsocks hydra -t 4 -s 21 -v -V -w 360 -I -L /root/usernames_ftp.txt -p password -f -m / pwspray.vm.vuln.land ftp. To Note that -t 4 will only open 4 connections at a time.
  6. configure hydra command via UI and then copy for console (ssh) torsocks hydra -t 2 -s 22 -v -V -w 360 -I -L /root/usernames.txt -p password -f -m / pwspray.vm.vuln.land ssh. Note that is -t 2 which will open only 2 connections at a time.
  7. submit result

Conclusion #

The whole proxy setup is quite tedious and error-prone. Generally it is not recommended using the Tor Service but the Tor Browser with integrated Tor.

Calendar September 21, 2021