cscli scenarios install crowdsecurity/ssh-time-based-bfDetect time-based ssh bruteforce attempts that evade traditional rate limiting with false positive reduction:
cancel_on to cancel bucket if user successfully authenticates
remediation: false)MedianInterval() helper to detect consistent timing patterns (more robust against outliers)crowdsecurity/sshd-success-logs parser for cancel_on functionalityTwo variants:
This scenario complements the standard ssh-bf (capacity 5, leakspeed 10s) and ssh-slow-bf (capacity 10, leakspeed 60s) scenarios with no overlap:
1# ssh time-based bruteforce with false positive reduction2type: conditional3name: crowdsecurity/ssh-time-based-bf4description: "Detect time-based ssh bruteforce attempts that evade rate limiting (with false positive reduction)"5filter: "evt.Meta.service == 'ssh' && evt.Meta.log_type in ['ssh_failed-auth', 'auth_success']"6groupby: evt.Meta.source_ip7capacity: -18cancel_on: "evt.Meta.log_type == 'auth_success'"9condition: |10 let failedAuths = filter(queue.Queue, {#.Meta.log_type == 'ssh_failed-auth'});11 len(failedAuths) >= 4 &&12 MedianInterval(map(failedAuths[-4:], {#.Time})) > duration("10m")13leakspeed: 2h14blackhole: 5m15reprocess: true16labels:17 service: ssh18 behavior: "ssh:bruteforce"19 spoofable: 020 confidence: 321 classification:22 - attack.T111023 label: "SSH Time-Based Bruteforce"24 remediation: false25---26# ssh user-enum time-based with false positive reduction27type: conditional28name: crowdsecurity/ssh-time-based-bf_user-enum29description: "Detect time-based ssh user enum bruteforce attempts (with false positive reduction)"30filter: "evt.Meta.service == 'ssh' && evt.Meta.log_type in ['ssh_failed-auth', 'auth_success']"31groupby: evt.Meta.source_ip32distinct: evt.Meta.target_user33capacity: -134cancel_on: "evt.Meta.log_type == 'auth_success'"35condition: |36 let failedAuths = filter(queue.Queue, {#.Meta.log_type == 'ssh_failed-auth'});37 len(failedAuths) >= 4 &&38 MedianInterval(map(failedAuths[-4:], {#.Time})) > duration("10m")39leakspeed: 2h40blackhole: 5m41reprocess: true42labels:43 service: ssh44 behavior: "ssh:bruteforce"45 spoofable: 046 confidence: 347 classification:48 - attack.T158949 - attack.T111050 label: "SSH Time-Based User Enumeration"51 remediation: false52