收集 HackerOne 日志

支持的平台:

本文档介绍了如何配置 HackerOne 以使用 Webhook 将日志推送到 Google Security Operations。

HackerOne 是一个漏洞协调和 bug 赏金平台,可将组织与安全研究人员联系起来,以识别和修复安全漏洞。该平台提供 bug 赏金计划、漏洞披露计划、渗透测试以及整个软件开发生命周期中的持续安全测试。

准备工作

  • 确保您满足以下前提条件:

  • Google SecOps 实例

  • 采用专业版或企业版层级的 HackerOne 计划(Webhook 仅适用于这些层级)

  • 具备对 HackerOne 计划设置的管理员权限

  • 对 Google Cloud Console 的访问权限(用于创建 API 密钥)

在 Google SecOps 中创建 Webhook Feed

创建 Feed

  1. 依次前往 SIEM 设置> Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称(例如 HackerOne Webhook)。
  5. 选择 Webhook 作为来源类型
  6. 选择 HackerOne 作为日志类型
  7. 点击下一步
  8. 为以下输入参数指定值:
    • 拆分分隔符:留空。每个 webhook 请求都包含一个 JSON 事件。
    • 资产命名空间资产命名空间
    • 注入标签:要应用于此 Feed 中事件的标签
  9. 点击下一步
  10. 最终确定界面中查看新的 Feed 配置,然后点击提交

生成并保存密钥

创建 Feed 后,您必须生成用于身份验证的密钥:

  1. 在 Feed 详情页面上,点击生成密钥
  2. 系统会显示一个包含密钥的对话框。
  3. 复制并妥善保存此密钥。

重要提示:密钥只会显示一次,之后无法再检索。如果密钥丢失,您必须生成新的密钥。

获取 Feed 端点网址

  1. 前往相应 Feed 的详细信息标签页。
  2. 端点信息部分,复制 Feed 端点网址
  3. 网址格式为:

    https://malachiteingestion-pa.googleapis.com/v2/unstructuredlogentries:batchCreate
    

    或者,对于区域级端点:

    https://<REGION>-malachiteingestion-pa.googleapis.com/v2/unstructuredlogentries:batchCreate
    
  4. 保存此网址以供后续步骤使用。

  5. 点击完成

创建 Google Cloud API 密钥

Chronicle 需要 API 密钥才能进行身份验证。在 Google Cloud Console 中创建受限 API 密钥。

创建 API 密钥

  1. 前往 Google Cloud 控制台的“凭据”页面
  2. 选择您的项目(与您的 Google SecOps 实例关联的项目)。
  3. 点击创建凭据 > API 密钥
  4. 系统会创建一个 API 密钥,并在对话框中显示该密钥。
  5. 点击修改 API 密钥以限制密钥。

限制 API 密钥

  1. API 密钥设置页面中:
    • 名称:输入一个描述性名称(例如 Chronicle HackerOne Webhook API Key)。
  2. API 限制下:
    1. 选择限制密钥
    2. 选择 API 下拉菜单中,搜索并选择 Google SecOps API(或 Chronicle API)。
  3. 点击保存
  4. 从页面顶部的 API 密钥字段复制 API 密钥值。
  5. 安全地保存 API 密钥。

配置 HackerOne webhook

构建网络钩子网址

将 Google SecOps 端点网址、API 密钥和密钥合并为一个网址。API 密钥和密钥都必须作为查询参数附加。

网址格式

```none
<ENDPOINT_URL>?key=<API_KEY>&secret=<SECRET_KEY>
```

示例

```none
https://malachiteingestion-pa.googleapis.com/v2/unstructuredlogentries:batchCreate?key=AIzaSyD...&secret=abcd1234...
```

替换以下内容: - <ENDPOINT_URL>获取 Feed 端点网址部分中的 Feed 端点网址。 - <API_KEY>创建 Google Cloud API 密钥部分中的 Google Cloud API 密钥。 - <SECRET_KEY>生成并保存密钥部分中的密钥。

重要提示:请勿将 Google SecOps 密钥放在 HackerOne 的 Secret 字段中。HackerOne Secret 字段用于 HMAC 载荷签名验证(X-H1-Signature 标头),这是一种与 Google SecOps Webhook 身份验证不同的机制。将 Google SecOps Secret 放置在 HackerOne 的 Secret 字段中会导致 403 Forbidden 错误,因为 HackerOne 不会将该值作为 Google SecOps 身份验证凭据传递。请改为在 Payload 网址 中将 keysecret 都附加为查询参数。

在 HackerOne 中创建 webhook

  1. 登录 HackerOne,然后前往您的计划。
  2. 前往互动,点击要配置的计划对应的 Kebab 菜单,然后点击设置
  3. 依次前往自动化 > Webhook
  4. 点击新建 Webhook
  5. 提供以下配置详细信息:
    • 载荷网址:粘贴包含 API 密钥和 Secret 的完整网址(例如 https://malachiteingestion-pa.googleapis.com/v2/unstructuredlogentries:batchCreate?key=AIzaSyD...&secret=abcd1234...)。
    • Secret:将此字段留
  6. 选择您希望哪些事件触发 Webhook。选择以下任一选项:
    • 向我发送所有内容:所有事件都会触发网络钩子。
    • 让我指定各个事件:选择要发送到 Google SecOps 的特定事件。
  7. 点击 Add webhook

测试网络钩子

  1. 在网络钩子配置页面中,点击测试请求,向配置的载荷网址发送示例请求。
  2. 验证响应是否为 HTTP 200
  3. 点击相应 Webhook 即可查看详细信息。
  4. 最近的传送部分下,验证最近的传送是否显示成功状态 (HTTP 200)。
  5. 点击任意传送,即可查看 POST 有效载荷请求。

如果您收到错误: - HTTP 403:验证 API 密钥和密钥是否已正确附加为载荷网址中的查询参数。确认 HackerOne Secret 字段为空。 - HTTP 401:验证 API 密钥是否有效且仅限于 Google SecOps API。 - HTTP 404:验证端点网址是否正确,是否包含完整路径 (/v2/unstructuredlogentries:batchCreate)。

在 Google SecOps 中验证数据注入

  1. 在 Google SecOps 中,依次前往 SIEM 设置 > Feed
  2. 找到您的 HackerOne 网络钩子 Feed。
  3. 查看状态列(应为有效)。
  4. 检查收到的事件数(应会递增)。
  5. 检查上次成功启动时间时间戳(应为最近的时间)。

Webhook 限制和最佳实践

请求限制

| Limit | Value |
|-------|-------|
| **Max request size** | 4 MB |
| **Max QPS (queries per second)** | 15,000 |
| **Request timeout** | 30 seconds |
| **Retry behavior** | Automatic with exponential backoff |

UDM 映射表

日志字段 UDM 映射 逻辑
attributes.cleared、attributes.rules_of_engagement_signed、attributes.identity_verified、attributes.background_checked、attributes.citizenship_verified、attributes.residency_verified、type、attributes.title、attributes.main_state、attributes.state、relationships.reporter.data.type、relationships.reporter.data.attributes.reputation、relationships.reporter.data.attributes.signal、relationships.reporter.data.attributes.impact、relationships.reporter.data.attributes.disabled、relationships.reporter.data.attributes.profile_picture.62x62、relationships.reporter.data.attributes.profile_picture.82x82、relationships.reporter.data.attributes.profile_picture.110x110、relationships.reporter.data.attributes.profile_picture.260x260、relationships.reporter.data.attributes.hackerone_triager、relationships.program.data.id、relationships.program.data.type、relationships.program.data.attributes.handle、relationships.severity.data.type、relationships.severity.data.attributes.rating、relationships.severity.data.attributes.author_type、relationships.severity.data.attributes.calculation_method、relationships.weakness.data.id、relationships.weakness.data.type、relationships.weakness.data.attributes.name、relationships.weakness.data.attributes.description、relationships.weakness.data.attributes.external_id、relationships.structured_scope.data.id、relationships.structured_scope.data.type、relationships.structured_scope.data.attributes.asset_type、relationships.structured_scope.data.attributes.eligible_for_bounty、relationships.structured_scope.data.attributes.eligible_for_submission、relationships.structured_scope.data.attributes.instruction、relationships.structured_scope.data.attributes.max_severity、relationships.structured_scope.data.attributes.confidentiality_requirement、relationships.structured_scope.data.attributes.integrity_requirement、relationships.structured_scope.data.attributes.availability_requirement、relationships.inboxes.data.id、relationships.inboxes.data.type、relationships.inboxes.data.attributes.name、relationships.inboxes.data.attributes.type additional.fields 合并为键值对标签
时间戳 metadata.event_timestamp 使用日期过滤器解析,格式为 yyyy-MM-dd'T'HH:mm:ss.SSSZ
metadata.event_type 如果 has_principal 为 true,则设置为“STATUS_UPDATE”;如果 has_principal_user_user 为 true,则设置为“USER_UNCATEGORIZED”;否则设置为“GENERIC_EVENT”
id metadata.product_log_id 直接复制值
relationships.structured_scope.data.attributes.asset_identifier principal.asset.asset_id 以“ASSET:”为前缀
attributes.email_alias principal.user.email_addresses 已合并
relationships.reporter.data.id principal.user.employee_id 直接复制值
relationships.reporter.data.attributes.name principal.user.first_name 直接复制值
attributes.username, relationships.reporter.data.attributes.username principal.user.user_display_name 如果 relationships.reporter.data.attributes.username 不为空,则取该值;否则取 attributes.username
relationships.severity.data.attributes.user_id principal.user.userid 直接复制值
relationships.severity.data.id security_result.rule_id 直接复制值
relationships.severity.data.attributes.max_severity security_result.severity 已转换为大写
attributes.vulnerability_information security_result.summary 直接复制值

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。