工具:

Sysmon (sysmon 5.0) ,NXlog(nxlog-ce-2.9.1716.msi) .

Sysmon监控系统并生成windows event log,   NXlog将windows event log传输到syslog服务器。

Sysmon可以监控Process create, Process terminate, Driver loaded, File creation time changed, RawAccessRead, CreateRemoteThread, Sysmon service state changed。

配置:

NXlog配置:

  1. ## This is a sample configuration file. See the nxlog reference manual about the
  2. ## configuration options. It should be installed locally and is also available
  3. ## online at http://nxlog.org/docs/
  4.  
  5. ## Please set the ROOT to the folder your nxlog was installed into,
  6. ## otherwise it will not start.
  7.  
  8. #define ROOT C:\Program Files\nxlog
  9. define ROOT C:\Program Files (x86)\nxlog
  10.  
  11. Moduledir %ROOT%\modules
  12. CacheDir %ROOT%\data
  13. Pidfile %ROOT%\data\nxlog.pid
  14. SpoolDir %ROOT%\data
  15. LogFile %ROOT%\data\nxlog.log
  16.  
  17. <Extension _syslog>
  18. Module xm_syslog
  19. </Extension>
  20.  
  21. <Input in>
  22. Module im_msvistalog
  23. Query <QueryList> <Query Id="0"> <Select Path="Microsoft-Windows-Sysmon/Operational">*</Select> </Query></QueryList>
  24. </Input>
  25.  
  26. <Output out>
  27. Module om_udp
  28. Host security-log.syslogserver.com
  29. Port 639
  30. Exec to_syslog_snare();
  31. </Output>
  32.  
  33. <Route 1>
  34. Path in => out
  35. </Route>

 Sysmon配置:

  1. <Sysmon schemaversion="3.20">
  2.  
  3. <!-- Capture all hashes -->
  4.  
  5. <HashAlgorithms>*</HashAlgorithms>
  6.  
  7. <EventFiltering>
  8.  
  9. <!-- Log all drivers except if the signature -->
  10.  
  11. <!-- contains Microsoft or Windows -->
  12.  
  13. <DriverLoad onmatch="exclude">
  14.  
  15. <Signature condition="contains">Microsoft</Signature>
  16.  
  17. <Signature condition="contains">Windows</Signature>
  18.  
  19. </DriverLoad>
  20.  
  21. <ProcessTerminate onmatch="include" >
  22.  
  23. <Image condition="end with">MsMpEng.exe</Image>
  24.  
  25. </ProcessTerminate>
  26.  
  27. <!-- Log network connection if the destination port equal 443 -->
  28.  
  29. <!-- or 80, and process isn't InternetExplorer -->
  30.  
  31. <!--NetworkConnect onmatch="include">
  32.  
  33. <DestinationPort>443</DestinationPort>
  34.  
  35. <DestinationPort>80</DestinationPort >
  36.  
  37. </NetworkConnect -->
  38.  
  39. <FileCreateTime onmatch="exclude" >
  40.  
  41. <Image condition="end with">chrome.exe</Image>
  42.  
  43. </FileCreateTime>
  44.  
  45. <ImageLoad onmatch="include">
  46.  
  47. <Signed condition="is">false</Signed>
  48.  
  49. </ImageLoad>
  50.  
  51. <!-- Log access rights for lsass.exe or winlogon.exe is not PROCESS_QUERY_INFORMATION -->
  52.  
  53. <ProcessAccess onmatch="exclude">
  54.  
  55. <GrantedAccess condition="is">0x1400</GrantedAccess>
  56.  
  57. </ProcessAccess>
  58.  
  59. <ProcessAccess onmatch="include">
  60.  
  61. <TargetImage condition="end with">lsass.exe</TargetImage>
  62.  
  63. <TargetImage condition="end with">winlogon.exe</TargetImage>
  64.  
  65. </ProcessAccess>
  66.  
  67. <NetworkConnect onmatch="exclude">
  68.  
  69. <Image condition="end with">chrome.exe</Image>
  70.  
  71. <SourcePort condition="is">137</SourcePort>
  72.  
  73. <SourcePortName condition="is">llmnr</SourcePortName>
  74.  
  75. <DestinationPortName condition="is">llmnr</DestinationPortName>
  76.  
  77. </NetworkConnect>
  78.  
  79. <CreateRemoteThread onmatch="include">
  80.  
  81. <TargetImage condition="end with">explorer.exe</TargetImage>
  82.  
  83. <TargetImage condition="end with">svchost.exe</TargetImage>
  84.  
  85. <TargetImage condition="end with">winlogon.exe</TargetImage>
  86.  
  87. <SourceImage condition="end with">powershell.exe</SourceImage>
  88.  
  89. </CreateRemoteThread>
  90.  
  91. </EventFiltering>
  92.  
  93. </Sysmon>

  

测试案例:

安装:

- sysmon -i config.conf 。

- nxlog双击运行,记得启动服务。(NXlog可命令行安装 msiexec /i  nxlog-ce-2.9.1716.msi  AGREETOLIECENSE="yes"    ACCEPT=YES  /qr+)

使用mimikatz抓取hash:

附NXlog完整配置样例:

  1. ## This is a basic configuration file for Windows Server 2008 * 2012
  2. ## to GrayLog2 with GELF support and filtering.
  3. ## See the nxlog reference manual about the configuration options.
  4. ## It should be installed locally and is also available
  5. ## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
  6.  
  7. ## Please set the ROOT to the folder your nxlog was installed into,
  8. ## otherwise it will not start.
  9.  
  10. define ROOT C:\Program Files (x86)\nxlog
  11. # define ROOT C:\Program Files\nxlog
  12.  
  13. Moduledir %ROOT%\modules
  14. CacheDir %ROOT%\data
  15. Pidfile %ROOT%\data\nxlog.pid
  16. SpoolDir %ROOT%\data
  17. LogFile %ROOT%\data\nxlog.log
  18.  
  19. <Extension gelf>
  20. Module xm_gelf
  21. </Extension>
  22.  
  23. <Input pr_mseventlog>
  24. Module im_msvistalog
  25. ReadFromLast True
  26. # http://msdn.microsoft.com/en-us/library/aa385231.aspx
  27. # http://msdn.microsoft.com/en-us/library/ff604025(v=office.14).aspx
  28. # Level 1 (ID=30 Critical) severity level events
  29. # Level 2 (ID=40 Error) severity level events
  30. # Level 3 (ID=50 Warning) severity level events
  31. # Level 4 (ID=80 Information) severity level events
  32. # Level 5 (ID=100 Verbose) severity level events
  33. # All channels are included by default which are listed in the registry under these:
  34. # HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels
  35. # HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\System
  36. #
  37. # <Select Path='Key Management Service'>*</Select></Query>\
  38. # <Select Path='Internet Explorer'>*</Select></Query>\
  39. # <Select Path='HardwareEvents'>*</Select></Query>\
  40. #
  41. Query <QueryList>\
  42. <Query Id="0">\
  43. <Select Path="Security">*</Select>\
  44. <Select Path="System">*[System/Level=4]</Select>\
  45. <Select Path="Application">*[Application/Level=2]</Select>\
  46. <Select Path="Setup">*[System/Level=3]</Select>\
  47. <Select Path='Windows PowerShell'>*</Select>\
  48. </Query>\
  49. </QueryList>
  50.  
  51. # REGEX EXAMPLES:
  52. # "\s" equals one white space character, and ".*" equals any one char
  53. # Line Contains both "bubble" and "gum"
  54. # Search pattern: ^(?=.*?\bbubble\b)(?=.*?\bgum\b).*
  55. # Line does Not Contain "boy"
  56. # Search pattern: ^(?!.*boy).*
  57. # Line Contains "bubble" but Neither "gum" Nor "bath"
  58. # Search pattern: ^(?=.*bubble)(?!.*gum)(?!.*bath).*
  59.  
  60. # Uncomment next line to view all logs, we can view output to help
  61. # create the regex, next line shows my $raw_event data to parse:
  62. # 2013-11-18 15:23:02 INFO 2013-12-18 15:23:01 ahost.adomain.local INFO 62464 UVD Information
  63. # Exec log_info($raw_event) ;
  64. Exec if ($raw_event =~ /INFO\s+62464/) drop();
  65.  
  66. </Input>
  67.  
  68. <Output out>
  69. Module om_udp
  70. Host 10.247.x.x
  71. Port 12201
  72. OutputType GELF
  73. </Output>
  74.  
  75. <Route 1>
  76. Path pr_mseventlog => out
  77. </Route>

  

参考:

http://www.freebuf.com/sectool/122779.html

https://technet.microsoft.com/en-us/sysinternals/dn798348

https://nxlog.co/docs/sysmon/audit-logging-on-windows-with-sysmon-and-nxlog.html

http://www.ilanni.com/?p=595

Sysmon + NXlog构建简单的windows安全监控的更多相关文章

  1. 使用Topshelf组件构建简单的Windows服务

    很多时候都在讨论是否需要了解一个组件或者一个语言的底层原理这个问题,其实我个人觉得,对于这个问题,每个人都有自己的看法,个人情况不同,选择的方式也就会不同了.我个人觉得无论学习什么,都应该尝试着去了解 ...

  2. 使用webstorm+webpack构建简单入门级“HelloWorld”的应用&&引用jquery来实现alert

    使用webstorm+webpack构建简单入门级"HelloWorld"的应用&&构建使用jquery来实现 1.首先你自己把webstorm安装完成. 请参考这 ...

  3. 构建简单的Maven工程,使用测试驱动的方式开发项目

    构建简单的Maven工程很简单,这里写这篇随笔的原因是希望自己能记住几个小点. 一.安装Maven 1.下载maven:https://maven.apache.org/download.cgi 2. ...

  4. 【译】用boosting构建简单的目标分类器

    用boosting构建简单的目标分类器 原文 boosting提供了一个简单的框架,用来构建鲁棒性的目标检测算法.这里提供了必要的函数来实现它:100% MATLAB实现,作为教学工具希望让它简单易得 ...

  5. 刚查了,Z3795不支持EPT,即WP8开发必须的SLAT,看来只能作为简单的WINDOWS备机了

    刚查了,Z3795不支持EPT,即WP8开发必须的SLAT,看来只能作为简单的WINDOWS备机了,也就只能做做文档编辑,脚本编写之类的. 数据来源 http://ark.intel.com/zh-C ...

  6. 三、使用Maven构建简单的java项目

    前边,我刚搭建了Maven环境,还有给大家推荐了学习资源,这个小节,我们来就来,,简单的玩玩maven. 1.所需工具: 1.Eclipse     2.apache-maven-3.3.9   3. ...

  7. 构建简单的 C++ 服务组件,第 1 部分: 服务组件体系结构 C++ API 简介

    构建简单的 C++ 服务组件,第 1 部分: 服务组件体系结构 C++ API 简介 熟悉将用于 Apache Tuscany SCA for C++ 的 API.您将通过本文了解该 API 的主要组 ...

  8. Directx11学习笔记【一】 最简单的windows程序HelloWin

    声明:本系列教程代码有部分来自dx11龙书及dx11游戏编程入门两本书,后面不再说明 首先,在vs2013中创建一个空的解决方案Dx11Demo,以后的工程都会放在这个解决方案下面.然后创建一个win ...

  9. Android 第三课 构建简单的用户界面

    构建简单的用户界面 上一课下一课 该课程教你 创建线性布局 添加文本框 添加字符串资源 添加按钮 使输入框宽度充满整个屏幕 你也应该阅读 布局 Android的图形用户界面通过 View 和 View ...

随机推荐

  1. 【Linux笔记】ldconfig、ldd

    一.ldconfig ldconfig是一个动态链接库管理命令,为了让动态链接库为系统所共享,还需运行动态链接库的管理命令--ldconfig. ldconfig 命令的用途,主要是在默认搜寻目录(/ ...

  2. jingchi.ai 2017.11.25-26 Onsite面试

    时间:2017.11.25 - 11.26 地点:安徽安庆 来回路费报销,住宿报销. day1: 大哥哥问了我一个实际中他们遇到的问题.有n个点,将点进行分块输出,输出各个块的均值点.具体就是100* ...

  3. 【JQuery】JQuery属性

    一.前言         接着上一章的内容,继续本章的学习. 二.内容 $().jquery 返回的字符串包含jquery的版本号 jQuery.fx.interval 改变以毫秒计的动画运行速率 j ...

  4. apache.commons.io.FileUtils的常用操作

    至于相关jar包可以到官网获取 http://commons.apache.org/downloads/index.html package com.wz.apache.fileUtils; impo ...

  5. Jenkins(四)---Jenkins添加密钥对

    一.添加密钥 1.添加git用户和git密码对 ,用于git客户端从gitlab上拉取代码到本地 /** lihaibo 文章内容都是根据自己工作情况实践得出. *版权声明:本博客欢迎转发,但请保留原 ...

  6. Qt ------ 截图、获取鼠标指定的RGB值

    获取RGB值思路:截图,获取图片的(0,0)的RGB值 int x = QCursor::pos().x(); int y = QCursor::pos().y(); // QPixmap pixma ...

  7. Zabbix应用二:Zabbix添加监控主机

    Zabbix添加被监控主机 一.选择中文语言 Zabbox3.0默认支持中文,可以登录后,点击右上角的用户图标,然后在语言中选择中文即可. 二.添加被监控主机 1.选择'配置'->'主机',然后 ...

  8. Unity官方实例教程 Roll-a-Ball

    与unity的transform组件相处的挺久了,最近项目不太忙,决定好好打下unity的基础.那么从Roll-a-Ball这个简单游戏开始吧! 1.先创建一个球体游戏对象,改名为Player,tra ...

  9. 四大开源协议比较:BSD、Apache、GPL、LGPL

    sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&a ...

  10. [Java] 理解JVM之三:垃圾回收机制

    JVM内存中的各个区域都会回收吗? 首先我们知道 Java 栈和本地方法栈在方法执行完成后对应的栈帧就立刻出栈销毁,两者的回收率可以认为是100%:Java 堆中的对象在没有被引用后,即使用完成后会被 ...