威胁日志

借助威胁日志,您可以审核、验证和分析在网络中检测到的威胁。

若 Cloud 新一代防火墙检测到正在监控进行第 7 层检查的流量存在威胁,则会在原始项目中生成一个日志条目,其中包含威胁的详细信息。如需查看和检查威胁日志,请在 Logs Explorer 中搜索日志 networksecurity.googleapis.com/firewall_threat。您还可以在威胁页面上查看这些威胁日志。

本页介绍了在检测到威胁时生成的威胁日志的格式和结构。

威胁日志格式

Cloud NGFW 会在 Cloud Logging 中,为进出特定可用区的虚拟机 (VM) 实例的受监控流量中检测到的每个威胁创建日志记录条目。日志记录包含在 LogEntry 的 JSON 载荷字段中。

某些日志字段采用多字段格式,在给定字段中包含多段数据。例如,connection 字段采用 Connection 格式,它在单个字段中包含服务器 IP 地址和端口、客户端 IP 地址和端口以及协议号。

下表介绍了威胁日志字段的格式。

字段 类型 说明
connection Connection 一个 5 元组,用于描述与检测到威胁的流量关联的连接参数。
action string 对检测到威胁的数据包执行的操作。此操作可以是安全配置文件中指定的默认操作替换操作
threatDetails ThreatDetails 检测到的威胁的详细信息。
securityProfileGroupDetails SecurityProfileGroupDetails 应用于被拦截流量的安全配置文件组的详细信息。
interceptVpc VpcDetails 与检测到威胁的虚拟机实例关联的虚拟私有云 (VPC) 网络的详细信息。
interceptInstance InterceptInstance 检测到威胁的虚拟机实例的详细信息。

Connection 字段格式

下表介绍了 Connection 字段的格式。

字段 类型 说明
clientIp string 客户端 IP 地址。如果客户端是 Compute Engine 虚拟机,则 clientIp 是主要内部 IP 地址或虚拟机网络接口的别名 IP 范围内的地址。系统不显示外部 IP 地址。日志显示数据包标头上观察到的虚拟机实例的 IP 地址,类似于虚拟机实例上的 TCP 转储。
clientPort integer 客户端端口号。
serverIp string 服务器 IP 地址。如果服务器是 Compute Engine 虚拟机,则 serverIp 是主要内部 IP 地址或虚拟机网络接口的别名 IP 范围内的地址。即使使用外部 IP 地址进行连接,系统也不会显示此地址。
serverPort integer 服务器端口号。
protocol string 连接的 IP 协议

ThreatDetails 字段格式

下表介绍了 ThreatDetails 字段的格式。

字段 类型 说明
id string 唯一的 Palo Alto Networks 威胁标识符。
threat string 检测到的威胁的名称。
description string 检测到的威胁的详细说明。
direction string 流量方向。例如 client_to_serverserver_to_client
application string 与检测到的威胁关联的应用。
severity string 与检测到的威胁关联的严重级别。如需了解详情,请参阅威胁严重级别
detectionTime string 检测到威胁的时间。
category string 检测到的威胁的子类型。例如 CODE_EXECUTION
uriOrFilename string 相关威胁的 URI 或文件名(如果适用)。
type string 检测到的威胁类型。例如 SPYWARE
repeatCount integer 在五秒内出现相同客户端 IP 地址、服务器 IP 地址和威胁类型的会话数。
cves string 与威胁关联的常见漏洞和披露 (CVE) 列表。例如 CVE-2021-44228-Apache Log4j remote code execution vulnerability

SecurityProfileGroupDetails 字段格式

下表介绍了 SecurityProfileGroupDetails 字段的格式。

字段 类型 说明
securityProfileGroupId string 应用于流量的安全配置文件组名称。
organizationId integer 虚拟机实例所属的组织 ID。

VpcDetails 字段格式

下表介绍了 VpcDetails 字段的格式。

字段 类型 说明
vpc string 与被拦截流量关联的 VPC 网络的名称。
projectId string 与 VPC 网络关联的 Google Cloud 项目的名称。

InterceptInstance 字段格式

下表介绍了 InterceptInstance 字段的格式。

字段 类型 说明
projectId string 与被拦截流量关联的 Google Cloud 项目的名称。
vm string 与被拦截流量关联的虚拟机实例的名称。

威胁日志与防火墙日志的关联

当数据包与已启用日志记录的防火墙规则匹配时,Cloud NGFW 会记录 Firewall Rules Logging 条目。此条目包含来源 IP 地址、目标 IP 地址和数据包检查时间等字段。如需查看这些防火墙规则日志,请参阅查看日志

如果您有启用了日志记录的第 7 层检查防火墙政策规则,Cloud NGFW 会先为匹配的数据包记录防火墙规则日志记录条目。然后,将数据包发送到防火墙端点以进行第 7 层检查。防火墙端点会分析数据包是否存在威胁。如果检测到威胁,系统会创建单独的威胁日志。此威胁日志包含威胁类型、威胁来源和威胁目的地等字段。如需查看威胁日志,请参阅查看威胁

您可以比较防火墙规则日志威胁日志中的字段,以确定触发威胁的数据包,并采取适当措施来解决该问题。

例如,您已使用以下设置配置了防火墙政策规则:

  • 来源 IP 地址:192.0.2.0
  • 来源端口:47644
  • 目的地 IP 地址:192.0.2.1
  • 目标端口:80
  • 日志记录:Enabled

如需查看与此规则关联的威胁日志,请前往 Logs Explorer 页面。在查询窗格中,将以下查询粘贴到查询编辑器字段中。

    resource.type="networksecurity.googleapis.com/FirewallEndpoint"
    jsonPayload.source_ip_address="192.0.2.0"
    jsonPayload.source_port="47644"
    jsonPayload.destination_ip_address="192.0.2.1"
    jsonPayload.destination_port="80"
   

查询结果部分会显示以下威胁日志:

    {
      insertId: "0ac7f359-263f-4428-8ded-ac655d8a09db"
      jsonPayload: {
      action: "reset-server"
      alert_severity: "HIGH"
      alert_time: "2023-11-28T19:07:15Z"
      category: "info-leak"
      ▸ cves: [6]
      }
      destination_ip_address: "192.0.2.1"
      destination_port: "80"
      details:
      "This signature detects Microsoft Windows win.ini access attempts. A successful attack could allow an
      attacker to access sensitive information and conduct further attacks."
      direction: "CLIENT_TO_SERVER"
      ip_protocol: "tcp"
      name: "Microsoft Windows win.ini Access Attempt Detected"
      network: "projects/XXXX/global/networks/fwplus-vpc.
      repeat_count: "1"
      security_profile_group:
      "organizations/XXXX/locations/global/securityprofileGroups/XXXX-fwplus-spg"
      source_ip_address: "192.0.2.0"
      source_port: "47644"
      threat_id: "30851"
      type: "vulnerability"
      uri_or_filename:
      logName: "projects/XXXX/logs/networksecurity.googleapis.com%2Ffirewall_threat"
      receiveTimestamp: "2023-11-28T19:08:49.841883684Z"
      ▸ resource: {2}
    }
    timestamp: "2023-11-28T19:08:47.560012184Z"
   

同样,如需查看与此规则关联的防火墙日志,请前往 Logs Explorer 页面。在查询窗格中,将以下查询粘贴到查询编辑器字段中。

    jsonPayload.rule_details.action="APPLY_SECURITY_PROFILE_GROUP"
    jsonPayload.connection.src_ip="192.0.2.0"
    jsonPayload.connection.src_port="47644"
    jsonPayload.connection.dest_ip="192.0.2.1"
    jsonPayload.connection.dest_port="80"
   

查询结果部分会显示以下防火墙日志:

    {
      insertId: "qn82vdg109q3r9"
      jsonPayload: {
      connection: {
      }
      dest_ip: "192.0.2.1"
      dest_port: 80
      protocol: 6
      src_ip: "192.0.2.0"
      src_port: 47644
      disposition: "INTERCEPTED"
      ►instance: {4}
      ▸ remote_instance: {4}
      ▸ remote_vpc: {3}
      rule_details: {
      action: "APPLY_SECURITY_PROFILE_GROUP"
      apply_security_profile_fallback_action: "UNSPECIFIED"
      direction: "INGRESS"
      ▸ ip_port_info: [1]
      ▼
      priority: 6000
      reference: "network: fwplus-vpc/firewallPolicy: fwplus-fwpolicy"
      source_range: [
      1
      0: "192.0.2.0/24"
      target_secure_tag: [
      0: "tagValues/281479199099651"
      ]
      }
      vpc: {
      project_id:XXXX
      subnetwork_name: "fwplus-us-central1-subnet"
      vpc_name: "fwplus-vpc"
      }
      }
      logName: "projects/XXXX/logs/compute.googleapis.com%2Ffirewall",
      receiveTimestamp: "2023-11-28T19:08:46.749244092Z"
      resource: {2}
      timestamp: "2023-11-28T19:08:40.207465099Z"
    }
   

通过查询威胁日志和防火墙日志,您可以查看它们之间的相关性。下表将防火墙日志字段映射到相应的威胁日志字段。

防火墙日志字段 威胁日志字段 说明
src_ip source_ip_address 防火墙日志中的来源 IP 地址与威胁日志中的来源 IP 地址相关联,以便确定潜在威胁的来源
src_port source_port 防火墙日志中的来源端口与威胁日志中的来源端口相关联,以识别潜在威胁中使用的来源端口
dest_ip destination_ip_address 防火墙日志中的目标 IP 地址与威胁日志中的目标 IP 地址相关联,以精确定位潜在威胁的目标
dest_port destination_port 防火墙日志中的目标端口与威胁日志中的目标端口相关联,以识别潜在威胁中使用的目标端口

后续步骤