【Part II】Windows事件分析宝典

admin 2022年10月26日14:34:25评论77 views字数 8071阅读26分54秒阅读模式

Windows日志分析宝典|事件响应指南(中)

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

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

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

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

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

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

访问共享对象

攻击者经常利用有效凭据通过用户创建或管理共享来远程访问数据。这样做会生成如上所述的帐户登录和登录事件,但我们也同样可以通过导航到计算机配置 -> 策略 -> Windows 设置 -> 安全设置 -> 高级审核策略配置 -> 在组策略管理控制台中启用其他日志记录审计策略 -> 对象访问 -> 审计文件共享。启用后,以下事件 ID 将记录在安全日志中:

网络共享事件ID:

事件ID 描述 Description
5140 访问了网络共享对象。事件条目提供访问对象的帐户的帐户名称和源地址。请注意,此条目将显示共享已被访问,但不会显示共享中的哪些文件已被访问。来自单个帐户的大量此类事件可能表明该帐户正在用于收集或映射网络上的数据。 A network share object was accessed. The event entry provides the account name and source address of the account that accessed the object. Note that this entry will show that the share was accessed but not what files in the share were accessed. A large number of these events from a single account may be an indicator of an account being used to harvest or map data on the network.
5142 添加了网络共享对象。 A network share object was added.
5143 修改了网络共享对象。 A network share object was modified.
5144 网络共享对象已删除。 A network share object was deleted.
5145 检查网络共享对象以查看是否可以授予客户端所需的访问权限。仅当权限在文件共享级别被拒绝时才会记录失败。如果在NTFS 级别拒绝许可,则不记录任何条目。 A network share object was checked to see whether client can be granted desired access. Failure is only logged if the permission is denied at the file share level. If permission is denied at the NTFS level then no entry is recorded.

如果通过计算机配置 -> 策略 -> Windows 设置 -> 安全设置 -> 高级审核策略配置 -> 审核策略 -> 对象访问 -> 审核详细文件共享,在组策略管理控制台中启用了详细文件共享审核, 那么每个共享中被访问的每个文件都将生成一个事件 ID 5145 日志。那么在这种情况下, 我们可以想象,这种级别的日志记录可能会产生大量结果。

启动网络共享访问的系统还可能在注册表项中显示连接的证据。

NTUSERSoftwareMicrosoftWindowsCurrentVersionExplorerMountPoints2 

计划任务日志

如果在任务计划程序应用程序中启用历史记录,通过事件查看器或使用 wevtutil 命令, %SystemRoot%System32winevtLogsMicrosoft-Windows-TaskScheduler%4Operational 日志将记录活动与本地系统上的计划任务相关如下:

计划任务活动事件ID

事件ID 描述 Description
106 已创建计划任务。该条目显示计划任务的用户帐户以及用户分配给任务的名称。记录的日期和时间显示计划任务的时间。查找关联的事件ID 200 和201 可以获取更多的信息 Scheduled Task Created. The entry shows the user account that scheduled the task and the name the user assigned to the task. The Logged date and time show when the task was scheduled. Look for the associated Event ID 200 and 201 for additional information.
140 计划任务已更新。该条目显示更新任务的用户帐户和任务名称。记录的日期和时间显示任务的更新时间。查找关联的事件ID 200 和201 可以获取更多的信息 Scheduled Task Updated. The entry shows the user account that updated the task and the name of the task. The Logged date and time show when the task was updated. Look for the associated Event ID 200 and 201 for additional information.
141 计划任务已删除。该条目显示删除任务的用户帐户和任务名称。 Scheduled Task Deleted. The entry shows the user account that deleted the task and the name of the task.
200 计划任务已执行。显示任务名称和磁盘上已运行的可执行文件的完整路径(列为操作)。将此与关联的事件ID 106 相关联可以获取更多的信息(账户) Scheduled Task Executed. Shows the task name and the full path to the executable on disk that was run (listed as the Action). Correlate this with the associated Event ID 106 to determine the user account that scheduled the task.
201 计划任务完成。显示任务名称和磁盘上已运行的可执行文件的完整路径(列为操作)。将此与关联的事件ID 106 可以获取更多的信息(账户) Scheduled Task Completed. Shows the task name and the full path to the executable on disk that was run (listed as the Action). Correlate this with the associated Event ID 106 to determine the user account that scheduled the task.

此外,以下对象访问审核部分,了解相关联记录的与计划任务相关的其他事件 ID。

对象访问审计

默认情况下不启用对象访问审计,但应在敏感(数据敏感或者应用程序敏感)系统上启用。为此,只需使用本地安全策略将安全设置 -> 本地策略 -> 审核策略 -> 审核对象访问权限设置为启用成功和失败。

对象访问审计事件存储在安全日志中。如果启用了对象访问审计,计划任务会获得额外的日志记录。与计划任务相关的事件 ID 是:

事件ID 描述 Description
4698 已创建计划任务。事件描述包含在主题部分中创建任务的用户帐户。计划任务的XML 详细信息也记录在任务描述部分下的事件描述中,并包括任务名称。 A scheduled task was created. The event description contains the user account that created the task in the Subject section. XML details of the scheduled task are also recorded in the event description under the Task Description section and includes the Task Name.
4699 已删除计划任务。事件描述的主题部分包含删除任务的帐户名称以及任务名称。 A scheduled task was deleted. The Subject section of the event description contains the Account Name that deleted the task as well as the Task Name.
4700 已启用计划任务。其他的相关信息需要参阅事件ID 4698。 A scheduled task was enabled. See Event ID 4698 for additional details.
4701 计划任务被禁用。其他的相关信息需要参阅事件ID 4698。 A scheduled task was disabled. See Event ID 4698 for additional details.
4702 计划任务已更新。启动更新的用户出现在事件描述的主题部分。修改后的任务详细信息列在事件描述的XML 中。你需要与此任务的先前事件ID 4702 或4698 条目进行比较,以确定进行了哪些更改。其他的相关信息需要参阅事件ID 4698。 A scheduled task was updated. The user who initiated the update appears in the Subject section of the event description. The details of the task after its modification are listed in the XML in the event description. Compare with previous Event ID 4702 or 4698 entries for this task to determine what changes were made. See Event ID 4698 for additional details.

除了计划任务外,我们还经常审核单个文件对象的对象访问权限。除了如前所述启用审核对象访问的成功和/或失败选项外,要审核对单个文件或文件夹的访问,同样还需要在文件或文件夹的属性中明确设置审核规则

通过选择"安全"选项卡,单击"高级",选择"审核"选项卡,然后设置审核类型和应为其设置审核的用户帐户,即可打开对话框。详细说明可以在这里找到:https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/apply-a-basic-audit-policy-on-a-file-or-folder

对于使用系统对象(例如文件)的进程,它必须获得该对象的句柄。启用审核后,下面描述的事件 ID 可用于通过跟踪对这些对象的句柄的颁发和使用来查看对重要文件和文件夹的访问。

对象句柄事件 ID


事件ID 描述 Description
4656 请求了对象的句柄。当一个进程试图获得一个被审计对象的句柄时,就会创建这个事件。请求句柄的对象的详细信息和分配给句柄的句柄ID 列在事件描述的对象部分中。 A handle to an object was requested. When a process attempts to gain a handle to an audited object, this event is created. The details of the object to which the handle was requested and the handle ID assigned to the handle are listed in the Object section of the event description.
4657 修改了注册表值。事件描述中列出了负责打开句柄的用户帐户和进程。. A registry value was modified. The user account and process responsible for opening the handle are listed in the event description. .
4658 对象的句柄已关闭。事件描述中列出了负责打开句柄的用户帐户和进程。要确定对象本身,需要关联前面具有相同句柄ID 的事件ID 4656。 The handle to an object was closed. The user account and process responsible for opening the handle are listed in the event description. To determine the object itself, refer to the preceding Event ID 4656 with the same Handle ID.
4660 删除了一个对象。事件描述中列出了负责打开句柄的用户帐户和进程。要确定对象本身,需要关联前面具有相同句柄ID 的事件ID 4656。 An object was deleted. The user account and process responsible for opening the handle are listed in the event description. To determine the object itself, refer to the preceding Event ID 4656 with the same Handle ID.
4663 试图访问一个对象。当进程尝试与对象交互时记录此事件,而不仅仅是获取对象的句柄。这可用于帮助确定可能对对象执行了哪些类型的操作(例如,只读或修改数据)。有关其他详细信息,需要关联事件ID 4656。 An attempt was made to access an object. This event is logged when a process attempts to interact with an object, rather than just obtain a handle to the object. This can be used to help determine what types of actions may have been taken on an object (for example, read only or modify data). See Event ID 4656 for additional details.

从 Windows 8/Server 2012 开始,还可以通过到计算机配置 -> 策略 -> Windows 设置 -> 安全设置 -> 高级审计策略配置 -> 审计策略 -> 对象访问,在组策略管理控制台中启用额外的日志记录 - > 审核可移动存储。

启用后,每当帐户访问可移动存储上的文件系统对象时,Windows 将创建额外的事件 ID 4663 条目。这有助于识别用户具体在什么时候将数据复制到外部媒体或从外部媒体复制数据。

审计政策变更

当审计策略更改时,它会影响调查人员和事件处理人员可用的证据,无论更改是由攻击者恶意完成还是由管理员合法完成。Windows 系统在这些更改发生时可以很好地记录这些更改。用于此审核的事件 ID 是 4719:

4719 – 系统审计策略已更改。审计策略更改部分将列出对审计策略所做的特定更改。事件描述的主题部分可能会显示进行更改的帐户,但通常(例如通过组策略进行更改时)此部分仅报告本地系统的名称。

1102 – 无论审核策略中的设置如何,如果安全事件日志被清除,事件 ID 1102 将被记录为新的空白日志中的第一个条目。我们可以在条目的详细信息中告知清除日志的用户帐户的名称。如果清除系统日志,则会在系统日志中生成 ID 为 104 的类似事件。

审核 Windows 服务

许多攻击依赖 Windows 服务来远程执行命令或维护系统的持久性。虽然到目前为止我们提到的大多数事件都可以在安全事件日志中找到,但 Windows 会在系统事件日志中记录与服务启动和停止相关的事件。以下事件通常值得注意:

  • 6005 – 事件日志服务已启动。这将在系统启动时以及手动启动系统时发生。由于事件日志服务对安全至关重要,因此它获取的是自己的事件 ID。

  • 6006 – 事件日志服务已停止。虽然这显然发生在系统关闭或重新启动时,但在其他时间发生可能表明恶意企图避免记录活动或修改日志。

  • 7034 – 服务意外终止。事件描述将显示服务的名称,并可能显示该服务崩溃的次数。

  • 7036 – 服务已停止或启动。虽然事件日志服务有自己的事件 ID,但其他服务记录在相同的事件 ID 下。

  • 7040 - 服务的启动类型已更改。事件描述将显示被更改的服务的名称并描述所做的更改。

  • 7045 – 系统安装了一项服务。服务名称可在事件描述的"服务名称"字段中找到,相关可执行文件的完整路径可在"服务文件名称"字段中找到。这可能是一个特别重要的事件,因为许多工具(例如 psexec)在远程系统上创建服务以执行命令。

如果在 GPO 中启用了高级审核策略配置 > 系统审核策略 > 系统 > 审核安全系统扩展,Windows 10 和 Server 2016/2019 系统还会在安全事件日志中记录事件 ID 4697。

无线局域网审计

Windows 维护一个专用于无线局域网 (WLAN) 活动的事件日志,并且由于恶意接入点是中间人攻击和恶意软件攻击的常见攻击媒介,因此可能值得查看具有 Wifi的设备上的异常连接 WiFi 功能,尤其是那些允许离开环境的功能。该日志位于 %SystemRoot%System32winevtLogsMicrosoft-Windows-WLAN-AutoConfig%4Operational.evtx。比较值得关注的事件ID是:

Wi-Fi 连接事件 ID

事件ID 描述 Description
8001 WLAN 服务已成功连接到无线网络。事件描述提供连接模式,指示这是基于配置的配置文件(和关联的配置文件名称)的自动连接还是手动连接。接入点的SSID、它的认证机制和它的加密机制也被记录下来。 WLAN service has successfully connected to a wireless network. The event description provides the Connection Mode indicating if this was an automatic connection based on a configured profile (and the associated Profile Name) or a manual connection. The SSID of the access point, its authentication mechanism, and its encryption mechanism are also recorded.
8002 WLAN 服务无法连接到无线网络。再次,事件描述将包含连接模式、关联的配置文件名称和SSID 以及失败原因字段。 WLAN service failed to connect to a wireless network. Once again, the event description will contain the Connection Mode, associated Profile Name, and the SSID along with a Failure Reason field.

尚未完结

结语

  • 感谢各位师傅看到这里, 创作不易, 排版不易, 建议收藏(吃灰)
  • 如果您想联系我, 可以直接添加我的微信号ID: wengchensmile, 来技术交流.
  • 我们下期再见!


原文始发于微信公众号(Aaron与安全的那些事):【Part II】Windows事件分析宝典

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月26日14:34:25
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   【Part II】Windows事件分析宝典http://cn-sec.com/archives/1368511.html

发表评论

匿名网友 填写信息