收集 HackerOne 日志
本文档介绍了如何配置 HackerOne,以使用网络钩子将日志推送到 Google Security Operations。
HackerOne 是一个漏洞协调和 bug 悬赏平台,可将组织与安全研究人员联系起来,以识别和修复安全漏洞。该平台在整个软件开发生命周期中提供 bug 奖励计划、漏洞披露计划、渗透测试和持续安全测试。
准备工作
确保您满足以下前提条件:
Google SecOps 实例
具有专业版或企业版层级的 HackerOne 计划(Webhook 仅适用于这些层级)
对 HackerOne 计划设置的管理员权限
拥有对 Google Cloud Console 的访问权限(用于创建 API 密钥)
在 Google SecOps 中创建 webhook Feed
创建 Feed
- 依次前往设置 > 数据管理 > Feed。如果您使用的是仅 SIEM 平台,请依次前往设置 > Feed。
- 点击添加新新闻信息流。
- 在下一页上,点击配置单个 Feed。
- 在 Feed 名称字段中,输入 Feed 的名称(例如
HackerOne Webhook)。 - 选择 Webhook 作为来源类型。
- 选择 HackerOne 作为日志类型。
- 点击下一步。
- 为以下输入参数指定值:
- 拆分定界符:留空。每个 webhook 请求都包含一个 JSON 事件。
- 资产命名空间:资产命名空间
- 注入标签:要应用于此 Feed 中事件的标签
- 点击下一步。
- 在最终确定界面中查看新的新闻信息流配置,然后点击提交。
生成并保存密钥
创建 Feed 后,您必须生成用于身份验证的密钥:
- 在 Feed 详情页面上,点击生成密钥。
- 系统会显示一个对话框,其中包含密钥。
- 复制并妥善保存密钥。
重要提示:密钥只会显示一次,之后无法检索。如果丢失,您必须生成新的密钥。
获取 Feed 端点网址
- 前往该 Feed 的详细信息标签页。
- 在端点信息部分,复制 Feed 端点网址。
网址格式为:
https://{region}-chronicle.googleapis.com/v1/{parent}/logs:import其中,
{region}是 Google SecOps 实例所在的区域(例如us、europe或asia-southeast1),{parent}是资源路径,格式为projects/<PROJECT_ID>/locations/<LOCATION>/instances/<INSTANCE_ID>/logTypes/<LOG_TYPE>。保存此网址,以便在后续步骤中使用。
点击完成。
创建 Google Cloud API 密钥
Chronicle 需要使用 API 密钥进行身份验证。在 Google Cloud Console 中创建受限 API 密钥。
创建 API 密钥
- 前往 Google Cloud 控制台凭据页面。
- 选择您的项目(与您的 Google SecOps 实例关联的项目)。
- 点击创建凭证 > API 密钥。
- 系统会创建 API 密钥,并在对话框中显示。
- 点击修改 API 密钥以限制密钥。
限制 API 密钥
- 在 API 密钥设置页面中:
- 名称:输入一个描述性名称(例如
Chronicle HackerOne Webhook API Key)。
- 名称:输入一个描述性名称(例如
- 在 API 限制下:
- 选择限制密钥。
- 在选择 API 下拉菜单中,搜索并选择 Google SecOps API(或 Chronicle API)。
- 点击保存。
- 从页面顶部的 API 密钥字段中复制 API 密钥值。
安全地保存 API 密钥。
配置 HackerOne 网络钩子
构建网络钩子网址
将 Google SecOps 端点网址、API 密钥和密钥组合成一个网址。API 密钥和密钥都必须作为查询参数附加。
网址格式:
```none
<ENDPOINT_URL>?key=<API_KEY>&secret=<SECRET_KEY>
```
示例:
```none
https://{region}-chronicle.googleapis.com/v1/{parent}/logs:import?key=AIzaSyD...&secret=abcd1234...
```
替换以下内容:
- <ENDPOINT_URL>:获取 Feed 端点网址部分中的 Feed 端点网址。
- <API_KEY>:创建 Google Cloud API 密钥部分中的 Google Cloud API 密钥。
- <SECRET_KEY>:生成并保存密钥部分中的密钥。
重要提示:请勿将 Google SecOps 密钥放入 HackerOne 的密钥字段中。HackerOne Secret 字段用于 HMAC 载荷签名验证(X-H1-Signature 标头),这是一种独立于 Google SecOps webhook 身份验证的机制。将 Google SecOps 密钥放入 HackerOne 的密钥字段会导致 403 Forbidden 错误,因为 HackerOne 不会将该值作为 Google SecOps 身份验证凭证传递。而是应将 key 和 secret 作为查询参数附加到载荷网址中。
在 HackerOne 中创建 webhook
- 登录 HackerOne,然后前往您的计划。
- 前往互动,点击要配置的计划对应的三点状菜单,然后点击设置。
- 依次前往自动化 > Webhook。
- 点击新建 webhook。
- 提供以下配置详细信息:
- 载荷网址:粘贴上述包含 API 密钥和 Secret 的完整网址。例如
https://{region}-chronicle.googleapis.com/v1/{parent}/logs:import?key=AIzaSyD...&secret=abcd1234...。 - 密钥:将此字段留空。
- 载荷网址:粘贴上述包含 API 密钥和 Secret 的完整网址。例如
- 选择您希望触发 webhook 的事件。选择以下任一选项:
- Send me everything(向我发送所有内容):所有事件都会触发 webhook。
- 让我指定个别事件:选择要发送到 Google SecOps 的特定事件。
点击 Add webhook。
测试 webhook
- 在 webhook 配置页面中,点击测试请求,向配置的载荷网址发送示例请求。
- 验证响应是否为 HTTP 200。
- 点击您的 webhook 以查看详细信息。
- 在近期传送部分下,验证近期传送是否显示成功状态 (HTTP 200)。
- 点击任意传送记录,即可查看 POST 载荷请求。
如果您收到错误:
- HTTP 403:请验证 API 密钥和密钥是否已作为查询参数正确附加到载荷网址中。确认 HackerOne Secret 字段为空。
- HTTP 401:验证 API 密钥是否有效,并且仅限于 Google SecOps API。- HTTP 404:验证端点网址是否正确,并且包含完整路径 (/v1/{parent}/logs:import)。
在 Google SecOps 中验证注入
- 在 Google SecOps 中,依次前往设置 > 数据管理 > Feed。如果您使用的是仅 SIEM 平台,请依次前往设置 > Feed。
- 找到您的 HackerOne webhook feed。
- 查看状态列(应为有效)。
- 检查收到的事件计数(应该在递增)。
- 查看上次成功启动时间时间戳(应为最近的时间)。
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 专业人士的解答。