Hello Susui,
I have tested your configuration and it works perfectly. After eight failed authentication attempts, the manager blocks that IP.
Have you restarted the manager to apply the configuration?
How did you do the test? In my case:
# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.216 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.426 ms
--- 10.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1030ms
# ssh 10.0.0.1
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
ro...@10.0.0.1: Permission denied (publickey,password).
t# ssh 10.0.0.1
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
ro...@10.0.0.1: Permission denied (publickey,password).
# ssh 10.0.0.1
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
ro...@10.0.0.1: Permission denied (publickey,password).
# ssh 10.0.0.1
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
Permission denied, please try again.
ro...@10.0.0.1's password:
ro...@10.0.0.1: Permission denied (publickey,password).
# ssh 10.0.0.1
ro...@10.0.0.1's password:
** Alert 1660641596.28781: - syslog,sshd,authentication_failed,gdpr_IV_35.7.d,gdpr_IV_32.2,gpg13_7.1,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,pci_dss_10.2.4,pci_dss_10.2.5,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,
2022 Aug 16 11:19:56 cabrera-Machine->/var/log/auth.log
Rule: 5760 (level 5) -> 'sshd: authentication failed.'
Src IP: 10.0.0.99
Src Port: 35184
User: root
Aug 16 11:19:56 cabrera-Machine sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2
** Alert 1660641598.29743: - syslog,sshd,authentication_failures,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_SI.4,nist_800_53_AU.14,nist_800_53_AC.7,pci_dss_11.4,pci_dss_10.2.4,pci_dss_10.2.5,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,
2022 Aug 16 11:19:58 cabrera-Machine->/var/log/auth.log
Rule: 5763 (level 10) -> 'sshd: brute force trying to get access to the system. Authentication failed.'
Src IP: 10.0.0.99
Src Port: 35186
User: root
Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2
Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2
Aug 16 11:19:56 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2
Aug 16 11:19:55 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2
Aug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2
Aug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2
Aug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2
Aug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2
** Alert 1660641598.31002: - ossec,active_response,pci_dss_11.4,gpg13_4.13,gdpr_IV_35.7.d,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,tsc_CC7.4,
2022 Aug 16 11:19:58 test-agent->/var/ossec/logs/active-responses.log
Rule: 651 (level 3) -> 'Host Blocked by firewall-drop Active Response'
2022/08/16 11:19:58 active-response/bin/firewall-drop: {"version":1,"origin":{"name":"node01","module":"wazuh-execd"},"command":"add","parameters":{"extra_args":[],"alert":{"timestamp":"2022-08-16T11:19:58.434+0200","rule":{"level":10,"description":"sshd: brute force trying to get access to the system. Authentication failed.","id":"5763","mitre":{"id":["T1110"],"tactic":["Credential Access"],"technique":["Brute Force"]},"frequency":8,"firedtimes":1,"mail":false,"groups":["syslog","sshd","authentication_failures"],"gdpr":["IV_35.7.d","IV_32.2"],"hipaa":["164.312.b"],"nist_800_53":["SI.4","AU.14","AC.7"],"pci_dss":["11.4","10.2.4","10.2.5"],"tsc":["CC6.1","CC6.8","CC7.2","CC7.3"]},"agent":{"id":"000","name":"test-agent"},"manager":{"name":"test-agent"},"id":"1660641598.29743","previous_output":"Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2\nAug 16 11:19:56 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2\nAug 16 11:19:55 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2\nAug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2\nAug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2\nAug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2\nAug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2","full_log":"Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2","predecoder":{"program_name":"sshd","timestamp":"Aug 16 11:19:57","hostname":"test-agent"},"decoder":{"parent":"sshd","name":"sshd"},"data":{"srcip":"10.0.0.99","srcport":"35186","dstuser":"root"},"location":"/var/log/auth.log"},"program":"active-response/bin/firewall-drop"}}
version: 1
origin.name: node01
origin.module: wazuh-execd
command: add
parameters.extra_args: []
parameters.alert.timestamp: 2022-08-16T11:19:58.434+0200
parameters.alert.rule.level: 10
parameters.alert.rule.description: sshd: brute force trying to get access to the system. Authentication failed.
parameters.alert.rule.id: 5763
parameters.alert.rule.mitre.id: ["T1110"]
parameters.alert.rule.mitre.tactic: ["Credential Access"]
parameters.alert.rule.mitre.technique: ["Brute Force"]
parameters.alert.rule.frequency: 8
parameters.alert.rule.firedtimes: 1
parameters.alert.rule.mail: false
parameters.alert.rule.groups: ["syslog", "sshd", "authentication_failures"]
parameters.alert.rule.gdpr: ["IV_35.7.d", "IV_32.2"]
parameters.alert.rule.hipaa: ["164.312.b"]
parameters.alert.rule.nist_800_53: ["SI.4", "AU.14", "AC.7"]
parameters.alert.rule.pci_dss: ["11.4", "10.2.4", "10.2.5"]
parameters.alert.rule.tsc: ["CC6.1", "CC6.8", "CC7.2", "CC7.3"]
parameters.alert.agent.id: 000
parameters.alert.agent.name: test-agent
parameters.alert.manager.name: test-agent
parameters.alert.id: 1660641598.29743
parameters.alert.previous_output: Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2
Aug 16 11:19:56 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2
Aug 16 11:19:55 test-agent sshd[28745]: Failed password for root from 10.0.0.99 port 35184 ssh2
Aug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2
Aug 16 11:19:54 test-agent sshd[28708]: Failed password for root from 10.0.0.99 port 35182 ssh2
Aug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2
Aug 16 11:19:52 test-agent sshd[28660]: Failed password for root from 10.0.0.99 port 35180 ssh2
parameters.alert.full_log: Aug 16 11:19:57 test-agent sshd[28786]: Failed password for root from 10.0.0.99 port 35186 ssh2
parameters.alert.predecoder.program_name: sshd
parameters.alert.predecoder.timestamp: Aug 16 11:19:57
parameters.alert.predecoder.hostname: test-agent
parameters.alert.decoder.parent: sshd
parameters.alert.decoder.name: sshd
parameters.alert.data.srcip: 10.0.0.99
parameters.alert.data.srcport: 35186
parameters.alert.data.dstuser: root
parameters.alert.location: /var/log/auth.log
parameters.program: active-response/bin/firewall-drop
# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
^C
--- 10.0.0.1 ping statistics ---
11 packets transmitted, 0 received, 100% packet loss, time 10224ms
The IP has been blocked.
How did you simulate the attack?
Regards,
Juan Cabrera