一、sysmon告警介紹
sysmon提供21種事件告警:
Event ID 1:進程創(chuàng)建
Event ID 2:進程更改文件創(chuàng)建時間
Event ID 3:網(wǎng)絡連接
Event ID 4:sysmon服務狀態(tài)變更
Event ID 5:進程終止
Event ID 6:驅(qū)動程序加載
Event ID 7:映像加載
Event ID 8:遠程連接線程創(chuàng)建
Event ID 9:內(nèi)存讀取
Event ID 10:進程允許訪問
Event ID 12:注冊表事件(鍵值配置)
Event ID 13: 注冊表事件(項目創(chuàng)建和刪除)
Event ID 14:注冊表事件(鍵值鍵名修改)
Event ID 15:創(chuàng)建文件留事件
Event ID 17:管道事件(管道創(chuàng)建)
Event ID 18:管道事件(管道連接)
Event ID 19:WMI事件(WMI事件過濾動作執(zhí)行)
Event ID 20:WMI事件(WMI事件注冊動作執(zhí)行)
Event ID 21:WMI事件(WMI事件綁定過濾器動作執(zhí)行)
Event ID 255:錯誤
二明垢、監(jiān)控設計
①:Windows機器固定周期從內(nèi)網(wǎng)搭建網(wǎng)站獲取配置腳本毒费,并每周進行一次Sysmon64.exe?-c?的更新乡恕,以實現(xiàn)自動同步配置的需求(bat腳本+Windows周期任務實現(xiàn))
②:winlogbeat收集sysmon日志并將日志輸出到logstash中
③:?logstash進行篩選洼滚,remove掉不需要的項(根據(jù)需要調(diào)整速梗,筆者只監(jiān)控告警id 3網(wǎng)絡連接枚碗、id 4 sysmon服務狀態(tài)變更、id 8 遠程連接線程創(chuàng)建和id 255 錯誤)
④:ES提供數(shù)據(jù)查詢功能簇爆,logstash的email插件提供告警功能
⑤:通過Python腳本郵件合并癞松、篩選發(fā)現(xiàn)的威脅項
環(huán)境要求:sysmon部署環(huán)境需要是win7及以上爽撒,win2008 R2及以上入蛆。
三、sysmon+winlogbeat一鍵部署
https://github.com/Hudi233/sysmonwinlogbeat
四硕勿、logstash配置
input? {
????????beats {
????????????????port =>?5044
????????}
}
filter {
? ? ? ? if?[event_data][DestinationIp] !~?"^100\.|^10\."?and [event_data][DestinationIp] =~?"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"?{
????????????????geoip {
????????????????????????source =>?"[event_data][DestinationIp]"
????????????????????????fields => ["city_name",?"country_name"]
????????????????????????database =>?"./ELK/logstash-6.4.0/GeoLite2-City.mmdb"
????????????????}
????????}
????????if?[event_data][DestinationIp] =~?"^100\.|^10\.|^127\.0\.0\.1"?{
????????????????drop { }
????????}
}
output {
????????elasticsearch {
????????????????hosts =>?"127.0.0.1:9200"
????????????????index =>?"sysmon"
????????}
????????if?[event_data][DestinationIp] !~?"^100\.|^10\.|^127\.0\.0\.1"?{
????????????????email {
????????????????????????to =>?'xxx@xxx.com'
????????????????????????from =>?'xxx@xxx.com'
????????????????????????subject =>?'Alert - %{event_id}'
????????????????????????body =>?"Content:\n%{message}\n%{geoip}"
????????????????????????address =>?'xxx.com'
????????????????????????authentication =>?"plain"
????????????????????????password =>?'***'
????????????????????????username =>?'xxx@xxx.com'
????????????????}
????????}
}