Created
July 10, 2014 10:57
-
-
Save rasmus/d36cb58a5db7f372b4a7 to your computer and use it in GitHub Desktop.
SSH brute force attempts visualized using logstash, elasticsearch and kibana
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "SSH", | |
"services": { | |
"query": { | |
"list": { | |
"0": { | |
"id": 0, | |
"color": "#7EB26D", | |
"alias": "Success", | |
"pin": false, | |
"type": "lucene", | |
"enable": true, | |
"query": "tags:ssh_sucessful_login" | |
}, | |
"1": { | |
"id": 1, | |
"color": "#E24D42", | |
"alias": "Failed", | |
"pin": false, | |
"type": "lucene", | |
"enable": true, | |
"query": "tags:ssh_brute_force_attack" | |
} | |
}, | |
"ids": [ | |
0, | |
1 | |
] | |
}, | |
"filter": { | |
"list": { | |
"0": { | |
"type": "time", | |
"field": "@timestamp", | |
"from": "now-2d", | |
"to": "now", | |
"mandate": "must", | |
"active": true, | |
"alias": "", | |
"id": 0 | |
}, | |
"1": { | |
"type": "querystring", | |
"query": "_missing_:level", | |
"mandate": "must", | |
"active": true, | |
"alias": "", | |
"id": 1 | |
} | |
}, | |
"ids": [ | |
0, | |
1 | |
] | |
} | |
}, | |
"rows": [ | |
{ | |
"title": "Graph", | |
"height": "350px", | |
"editable": true, | |
"collapse": false, | |
"collapsable": true, | |
"panels": [ | |
{ | |
"span": 12, | |
"editable": true, | |
"group": [ | |
"default" | |
], | |
"type": "histogram", | |
"mode": "count", | |
"time_field": "@timestamp", | |
"value_field": null, | |
"auto_int": true, | |
"resolution": 100, | |
"interval": "30m", | |
"fill": 3, | |
"linewidth": 3, | |
"timezone": "browser", | |
"spyable": true, | |
"zoomlinks": true, | |
"bars": true, | |
"stack": true, | |
"points": false, | |
"lines": false, | |
"legend": true, | |
"x-axis": true, | |
"y-axis": true, | |
"percentage": false, | |
"interactive": true, | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
}, | |
"title": "Events over time", | |
"intervals": [ | |
"auto", | |
"1s", | |
"1m", | |
"5m", | |
"10m", | |
"30m", | |
"1h", | |
"3h", | |
"12h", | |
"1d", | |
"1w", | |
"1M", | |
"1y" | |
], | |
"options": true, | |
"tooltip": { | |
"value_type": "cumulative", | |
"query_as_alias": true | |
}, | |
"scale": 1, | |
"y_format": "none", | |
"grid": { | |
"max": null, | |
"min": 0 | |
}, | |
"annotate": { | |
"enable": false, | |
"query": "*", | |
"size": 20, | |
"field": "_type", | |
"sort": [ | |
"_score", | |
"desc" | |
] | |
}, | |
"pointradius": 5, | |
"show_query": true, | |
"legend_counts": true, | |
"zerofill": true, | |
"derivative": false | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "terms", | |
"loadingEditor": false, | |
"field": "src_ip", | |
"exclude": [], | |
"missing": false, | |
"other": false, | |
"size": 10, | |
"order": "count", | |
"style": { | |
"font-size": "10pt" | |
}, | |
"donut": false, | |
"tilt": false, | |
"labels": true, | |
"arrangement": "horizontal", | |
"chart": "table", | |
"counter_pos": "above", | |
"spyable": true, | |
"queries": { | |
"mode": "selected", | |
"ids": [ | |
1 | |
] | |
}, | |
"tmode": "terms", | |
"tstat": "total", | |
"valuefield": "", | |
"title": "Failed attampts from IPs (top 10)" | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "terms", | |
"loadingEditor": false, | |
"field": "username", | |
"exclude": [], | |
"missing": false, | |
"other": false, | |
"size": 30, | |
"order": "count", | |
"style": { | |
"font-size": "10pt" | |
}, | |
"donut": false, | |
"tilt": false, | |
"labels": true, | |
"arrangement": "horizontal", | |
"chart": "pie", | |
"counter_pos": "above", | |
"spyable": true, | |
"queries": { | |
"mode": "selected", | |
"ids": [ | |
1 | |
] | |
}, | |
"tmode": "terms", | |
"tstat": "total", | |
"valuefield": "", | |
"title": "Attempted usernames" | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "column", | |
"loadingEditor": false, | |
"panels": [ | |
{ | |
"loading": false, | |
"sizeable": false, | |
"draggable": false, | |
"removable": false, | |
"span": 10, | |
"height": "150px", | |
"editable": true, | |
"type": "hits", | |
"chart": "list", | |
"arrangement": "horizontal", | |
"style": { | |
"font-size": "10pt" | |
}, | |
"counter_pos": "above", | |
"donut": false, | |
"tilt": false, | |
"labels": true, | |
"spyable": true, | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
} | |
}, | |
{ | |
"loading": false, | |
"sizeable": false, | |
"draggable": false, | |
"removable": false, | |
"span": 10, | |
"height": "150px", | |
"editable": true, | |
"type": "trends", | |
"ago": "1d", | |
"arrangement": "vertical", | |
"reverse": false, | |
"spyable": true, | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
}, | |
"style": { | |
"font-size": "14pt" | |
} | |
} | |
], | |
"title": "Details" | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "map", | |
"loadingEditor": false, | |
"map": "world", | |
"colors": [ | |
"#A0E2E2", | |
"#265656" | |
], | |
"size": 500, | |
"exclude": [], | |
"spyable": true, | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
}, | |
"field": "geo_country_code", | |
"title": "MAP" | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "terms", | |
"loadingEditor": false, | |
"field": "geo_country_code", | |
"exclude": [], | |
"missing": false, | |
"other": false, | |
"size": 10, | |
"order": "count", | |
"style": { | |
"font-size": "10pt" | |
}, | |
"donut": false, | |
"tilt": false, | |
"labels": true, | |
"arrangement": "horizontal", | |
"chart": "table", | |
"counter_pos": "above", | |
"spyable": true, | |
"queries": { | |
"mode": "selected", | |
"ids": [ | |
1 | |
] | |
}, | |
"tmode": "terms", | |
"tstat": "total", | |
"valuefield": "", | |
"title": "Countries" | |
}, | |
{ | |
"error": false, | |
"span": 4, | |
"editable": true, | |
"type": "bettermap", | |
"loadingEditor": false, | |
"field": "geoip.location", | |
"size": 10000, | |
"spyable": true, | |
"tooltip": "src_ip", | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
} | |
} | |
], | |
"notice": false | |
}, | |
{ | |
"title": "Events", | |
"height": "350px", | |
"editable": true, | |
"collapse": false, | |
"collapsable": true, | |
"panels": [ | |
{ | |
"title": "All events", | |
"error": false, | |
"span": 12, | |
"editable": true, | |
"group": [ | |
"default" | |
], | |
"type": "table", | |
"size": 100, | |
"pages": 5, | |
"offset": 0, | |
"sort": [ | |
"@timestamp", | |
"desc" | |
], | |
"style": { | |
"font-size": "9pt" | |
}, | |
"overflow": "min-height", | |
"fields": [ | |
"timestamp", | |
"src_ip", | |
"username", | |
"message", | |
"geo_json" | |
], | |
"localTime": true, | |
"timeField": "@timestamp", | |
"highlight": [], | |
"sortable": true, | |
"header": true, | |
"paging": true, | |
"spyable": true, | |
"queries": { | |
"mode": "all", | |
"ids": [ | |
0, | |
1 | |
] | |
}, | |
"field_list": true, | |
"status": "Stable", | |
"trimFactor": 300, | |
"normTimes": true, | |
"all_fields": false | |
} | |
], | |
"notice": false | |
} | |
], | |
"editable": true, | |
"failover": false, | |
"index": { | |
"interval": "day", | |
"pattern": "[logstash-]YYYY.MM", | |
"default": "NO_TIME_FILTER_OR_INDEX_PATTERN_NOT_MATCHED", | |
"warm_fields": true | |
}, | |
"style": "dark", | |
"panel_hints": true, | |
"pulldowns": [ | |
{ | |
"type": "query", | |
"collapse": true, | |
"notice": false, | |
"query": "*", | |
"pinned": true, | |
"history": [ | |
"tags:ssh_brute_force_attack", | |
"tags:ssh_sucessful_login", | |
"tags:(ssh_brute_force_attack ssh_sucessful_login)", | |
"", | |
"\"Failed password for invalid user\"", | |
"Failed password for invalid user", | |
"program:mDNSResponder", | |
"_missing_:level", | |
"*", | |
"not level" | |
], | |
"remember": 10, | |
"enable": true | |
}, | |
{ | |
"type": "filtering", | |
"collapse": true, | |
"notice": false, | |
"enable": true | |
} | |
], | |
"nav": [ | |
{ | |
"type": "timepicker", | |
"collapse": false, | |
"notice": false, | |
"status": "Stable", | |
"time_options": [ | |
"5m", | |
"15m", | |
"1h", | |
"6h", | |
"12h", | |
"24h", | |
"2d", | |
"7d", | |
"30d" | |
], | |
"refresh_intervals": [ | |
"5s", | |
"10s", | |
"30s", | |
"1m", | |
"5m", | |
"15m", | |
"30m", | |
"1h", | |
"2h", | |
"1d" | |
], | |
"timefield": "@timestamp", | |
"now": true, | |
"filter_id": 0, | |
"enable": true | |
} | |
], | |
"loader": { | |
"save_gist": false, | |
"save_elasticsearch": true, | |
"save_local": true, | |
"save_default": true, | |
"save_temp": true, | |
"save_temp_ttl_enable": true, | |
"save_temp_ttl": "30d", | |
"load_gist": true, | |
"load_elasticsearch": true, | |
"load_elasticsearch_size": 20, | |
"load_local": true, | |
"hide": false | |
}, | |
"refresh": false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
syslog { | |
type => "syslog" | |
} | |
} | |
filter { | |
grok { | |
type => "syslog" | |
match => ["message", "Failed password for (invalid user |)%{USERNAME:username} from %{IP:src_ip} port %{BASE10NUM:port} ssh2"] | |
add_tag => "ssh_brute_force_attack" | |
} | |
grok { | |
type => "syslog" | |
match => ["message", "Accepted password for %{USERNAME:username} from %{IP:src_ip} port %{BASE10NUM:port} ssh2"] | |
add_tag => "ssh_sucessful_login" | |
} | |
geoip { | |
source => "src_ip" | |
} | |
} | |
output { | |
elasticsearch_http { | |
host => "localhost" | |
port => "9200" | |
index => "logstash-%{+YYYY.MM}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Greatly inspired by https://gist.github.com/juanje/3081998