完结篇 | Windows事件响应指南

admin 2022年10月26日09:16:45评论52 views字数 8132阅读27分6秒阅读模式


事件响应指南(完结篇)

前排提示: 使用手机预览的时候, 横屏预览更佳~

在我们Blue Team,针对Windows日志分析的场景占绝大多数,Windows 事件日志记录提供了源、用户名、计算机、事件类型和级别等详细信息,并显示应用程序和系统消息的日志,包括错误、信息消息和警告。

多年来,微软不断提高其审计设施的效率和有效性。 现代 Windows 系统可以以最小的系统影响记录大量信息。

一般来说企业会选择一种工具来获取日志,这个工具叫做Security information and event management(SIEM) ,安全,信息和事件管理。

在 Windows 系统上配置足够的日志记录,并在理想情况下将这些日志聚合到 SIEM 或其他日志聚合器中,能够确保我们在SIEM中的搜索语句找到自己想要的日志。

第一篇:【建议收藏】Windows事件分析宝典

第二篇:【Part II】Windows事件分析宝典

进程跟踪

与许多 Linux shell(例如 bash)不同,Windows cmd.exe shell 不保留用户运行的命令的历史记录。这在事件处理程序了解攻击者对受感染主机所采取的操作的能力方面造成了明显的差距。不依赖恶意软件而是使用内置 Windows 的command.exe攻击的兴起只会让这个盲点更具破坏性。虽然在 Windows 的早期阶段,审核进程创建被认为过于系统化

虽然并非每个系统都需要,但在关键系统上启用此功能正日益成为安全意识环境中的标准做法。这需要设置两个单独的组策略设置。首先当然是计算机配置-> Windows 设置-> 安全设置-> 本地策略-> 审核策略-> 审核过程跟踪。启用后,安全日志中的事件 ID 4688 会提供有关已在系统上运行的进程的大量信息:

事件ID 描述 Description
4688 已创建一个新进程。事件描述提供进程ID 和进程名称、创建者进程ID、创建者进程名称和进程命令行(需要单独启用) A new process has been created. The event description provides the Process ID and Process Name, Creator Process ID, Creator Process Name, and Process Command Line (if enabled separately, as outlined earlier in this section).

除了事件 ID 4688,开启进程跟踪还可能导致来自 Windows 过滤平台的与网络连接和侦听端口相关的额外安全日志条目,如下所示:

Windows Filter筛选 (WFP) 事件 ID

事件ID 描述 Description
5031 Windows 防火墙服务阻止应用程序接受网络上的传入连接。 The Windows Firewall Service blocked an application from accepting incoming connections on the network.
5152 WFP 阻止了一个数据包。 The WFP blocked a packet.
5154 WFP 已允许应用程序或服务在端口上侦听传入连接。 The WFP has permitted an application or service to listen on a port for incoming connections.
5156 WFP已允许建立联系。 The WFP has allowed a connection.
5157 WFP 已阻止连接。 The WFP has blocked a connection.
5158 WFP 已允许绑定到本地端口。 The WFP has permitted a bind to a local port.
5159 WFP 已阻止绑定到本地端口。 The WFP has blocked a bind to a local port.

Windows WFP 的事件描述是十分详细的,包括有关本地和远程 IP 和端口号以及所涉及的进程 ID 和进程名称的信息。

可以看出,通过启用流程跟踪审计记录的信息可能具有巨大的价值,但也可能产生大量数据。 在您的测试环境中进行试验,以找到一个平衡点,可以适当地增加生产环境中的安全审计。

附加程序执行记录

如果在我们的环境中配置了 AppLocker(有助于打击攻击者的步骤,应予以考虑),也会生成专用的 AppLocker 事件日志。 这些事件日志显示在应用程序和服务日志MicrosoftWindowsAppLocker 下的事件查看器中,这些事件日志与其他事件日志一起存储在C:WindowsSystem32winevtLogs 中,并具有诸如 Microsoft-Windows-AppLocker%4EXE 和 DLL.evtx。 有单独的日志涵盖可执行文件和动态链接库 (DLL)、Microsoft 安装程序 (MSI) 和脚本、打包应用程序部署和打包应用程序执行。 生成的事件日志将根据 AppLocker 设置为仅审核模式还是阻止模式而有所不同。 可以在这里[1]找到可能适用于你当前的情况的特定事件 ID 的详细信息。

Windows Defender 可疑事件 ID

事件ID 描述 Description
1006 反恶意软件引擎发现了恶意软件或其他可能不需要的软件。 The antimalware engine found malware or other potentially unwanted software.
1007 反恶意软件平台执行了一项操作以保护你的系统免受恶意软件或其他可能不需要的软件的侵害。 The antimalware platform performed an action to protect your system from malware or other potentially unwanted software.
1008 反恶意软件平台尝试执行操作以保护你的系统免受恶意软件或其他可能不需要的软件的侵害,但该操作失败。 The antimalware platform attempted to perform an action to protect your system from malware or other potentially unwanted software, but the action failed.
1013 反恶意软件平台删除了恶意软件和其他可能不需要的软件的历史记录。 The antimalware platform deleted history of malware and other potentially unwanted software.
1015 反恶意软件平台检测到可疑行为。 The antimalware platform detected suspicious behavior.
1116 反恶意软件平台检测到恶意软件或其他可能不需要的软件。 The antimalware platform detected malware or other potentially unwanted software.
1117 反恶意软件平台执行了一项操作以保护您的系统免受恶意软件或其他可能不需要的软件的侵害。 The antimalware platform performed an action to protect your system from malware or other potentially unwanted software.
1118 反恶意软件平台尝试执行操作以保护您的系统免受恶意软件或其他可能不需要的软件的侵害,但该操作失败。 The antimalware platform attempted to perform an action to protect your system from malware or other potentially unwanted software, but the action failed.
1119 反恶意软件平台在尝试对恶意软件或其他可能不需要的软件采取措施时遇到严重错误。 The antimalware platform encountered a critical error when trying to take action on malware or other potentially unwanted software.
5001 实时保护被禁用。 Real-time protection is disabled.
5004 实时保护配置发生变化。 The real-time protection configuration changed.
5007 反恶意软件平台配置已更改。 The antimalware platform configuration changed.
5010 扫描恶意软件和其他可能不需要的软件被禁用。 Scanning for malware and other potentially unwanted software is disabled.
5012 病毒扫描被禁用。 Scanning for viruses is disabled.

可以在这里[2]找到有关 Windows Defender 事件日志记录的其他详细信息。

Windows 漏洞利用保护是 Windows 10 的一项功能,可以针对一系列黑客漏洞利用技术提供出色的防御。 此功能可以保护操作系统和单个应用程序免受常见攻击媒介的侵害,从而在可能导致系统危害的情况下阻止利用。 尽管默认情况下启用了一些漏洞利用保护功能,但由于它们可能会干扰合法软件,因此许多功能被禁用。 启用后,此功能会将其活动记录在 C:WindowsSystem32winevtLogsMicrosoft-Windows-Security-Mitigations%4KernelMode.evtxMicrosoft-Windows-Security-Mitigations%4UserMode.evtx日志文件中。

更多详细信息可以在这里[3]找到。

增强对在您的环境中的系统上运行的进程的可见性的另一个选择是实施 Sysmon,这是 Sysinternals 的一个免费实用程序,现在是 Microsoft 的一部分。 Sysmon 可以在[这里](https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon[4])免费下载。

Sysmon 生成的事件 ID

事件ID 描述 Description
1 进程创建(包括许多详细信息,例如进程ID、可执行文件的路径、可执行文件的哈希、用于启动的命令行、用于启动的用户帐户、父进程ID、父可执行文件的路径和命令行等)。 Process creation (includes many details such as process ID, path to executable, hash of executable, command line used to launch, user account used to launch, parent process ID, path and command line for parent executable, and more).
2 进程更改了文件创建时间。 A process changed a file creation time.
3 网络链接 Network connection.
4 Sysmon服务状态被修改 Sysmon service state changed.
5 进程被终止 Process terminated.
6 已加载驱动程序 Driver loaded.
7 加载记录(在特定进程中加载模块时记录)。 Image loaded (records when a module is loaded in a specific process).
8 CreateRemoteThread(在另一个进程中创建线程)。 CreateRemoteThread (creating a thread in another process).
9 RawAccessRead(使用. 表示法对驱动器数据的原始访问)。 RawAccessRead (raw access to drive data using . notation).
10 ProcessAccess(开放访问另一个进程的内存空间)。 ProcessAccess (opening access to another process's memory space).
11 FileCreate(创建或覆盖文件)。 FileCreate (creating or overwriting a file).
12 创建或删除的注册表项或值。 Registry key or value created or deleted.
13 注册表值修改。 Registry value modification.
14 重命名的注册表项或值。 Registry key or value renamed.
15 FileCreateStreamHash(创建备用数据流)。 FileCreateStreamHash (creation of an alternate data stream).
16 Sysmon 配置更改。 Sysmon configuration change.
17 已创建命名管道。 Named pipe created.
18 命名管道连接。 Named pipe connected.
19 检测到WMIEventFilter 活动。 WMIEventFilter activity detected.
20 检测到WMIEventConsumer 活动。 WMIEventConsumer activity detected.
21 检测到WMIEventConsumerToFilter 活动。 WMIEventConsumerToFilter activity detected.
22 DNS 查询事件(Windows 8 及更高版本) DNS query event (Windows 8 and later)
255 Sysmon错误 Sysmon error

审核 PowerShell 使用

Microsoft 增加了围绕 PowerShell 的可用日志数量,以帮助打击其恶意脚本的使用。同样,必须通过组策略启用这些日志记录工具,特别是在计算机配置 -> 策略 -> 管理模板 -> Windows 组件 -> Windows PowerShell 中。根据所讨论的 Windows 版本,可能提供三种基本的日志记录类别。

  • 模块记录

    • 记录管道执行事件;
    • 记录到事件日志。
  • 脚本块记录

    • 捕获发送到 PowerShell 的去混淆命令;
    • 仅捕获命令,而不是结果输出;
    • 记录到事件日志。
  • 转录

    • 捕获 PowerShell 输入和输出;
    • 不会捕获运行的外部程序的输出,仅捕获 PowerShell;
    • 记录到用户指定位置的文本文件。

启用后,这些日志可以提供有关在系统上使用 PowerShell 的大量信息。如果经常运行大量 PowerShell 脚本,这可能会产生大量数据,因此在将此类更改部署到生产环境之前,请务必测试和调整审计工具以在可见性和负载之间取得平衡。

PowerShell 事件日志条目出现在不同的事件日志中。 在%SystemRoot%System32winevt LogsMicrosoft-Windows-PowerShell%4Operational.evtx中,你可以发现两个特别的事件:

事件ID 描述 Description
4103 显示来自模块日志记录工具的管道执行。包括用于运行命令的用户上下文。如果在本地执行主机名字段将包含控制台,或者如果从远程系统运行将显示。 Shows pipeline execution from the module logging facility. Includes the user context used to run the commands. Hostname field will contain Console if executed locally or will show if run from a remote system.
4104 显示脚本块日志记录条目。捕获发送到PowerShell 的命令,但不捕获输出。仅在首次使用时记录每个块的完整详细信息以节省空间。如果Microsoft 认为活动可疑,将显示为警告级别事件。 Shows script block logging entries. Captures the commands sent to PowerShell, but not the output. Logs full details of each block only on first use to conserve space. Will show as a Warning level event if Microsoft deems the activity Suspicious.

其他条目可以在 %SystemRoot%System32winevtLogsWindows PowerShell.evtx 日志中找到:

事件ID 描述 Description
400 指示命令执行或会话的开始。主机名字段显示是(本地)控制台还是导致执行的远程会话。 Indicates the start of command execution or session. Hostname field shows if (local) Console or the remote session that caused the execution.
800 显示管道执行详细信息。UserID 显示使用的帐户。主机名字段显示是(本地)控制台还是导致执行的远程会话。由于许多恶意脚本使用Base64 对选项进行编码,请检查HostApplication 字段以获取使用-enc 或-EncodedCommand 参数编码的选项。 Shows pipeline execution details. UserID shows account used. Hostname field shows if (local) Console or the remote session that caused the execution. Since many malicious scripts encode options with Base64, check the HostApplication field for options encoded with the -enc or -EncodedCommand parameter.

请记住,PowerShell 远程处理需要经过身份验证的访问,因此还要查找关联的帐户登录和登录事件。

写在最后

感谢各位看到这里, 三篇Windows事件ID分析到此已经完结.三篇主要针对各蓝军的日常分析工作, 但是这仅仅只是冰山一角, 若你们有想要了解的没有事件去整理的, 欢迎添加我的微信:wengchensmile , 我会根据你们提出的主题来进入深入的研究, 如有错误欢迎及时指出.


网络安全日渐渗透入每个人的生活, 不管是来自于哪个行业, 都缺少不了计算机. 网络安全在当局下显得十分重要. 并且随着信息的发展, 许多软件以及数据库或者服务器逐渐上云, 代表着传统物理服务器慢慢走向云端服务器, 在如今, 云安全成为网络安全的另一重要部分. 所以不管是针对Windows还是Linux的日志分析, 在网络安全当中都显得十分重要. 保护网络安全就是保护国家安全, 我们务必努力.

参考资料

[1]


https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/applocker/using-event-viewer-with-applocker

[2]


https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-antivirus/troubleshoot-windows-defender-antivirus

[3]


https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/exploit-protection

[4]


https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon

原文始发于微信公众号(Aaron与安全的那些事):完结篇 | Windows事件响应指南

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月26日09:16:45
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   完结篇 | Windows事件响应指南http://cn-sec.com/archives/1370521.html

发表评论

匿名网友 填写信息