Chatwoot v4.19.1 - High: 8.7 - Remote admin - token disclosure / cross-tenant object access - inbox agent-bot view returns a global AgentBot access token
A Chatwoot administrator can attach an instance-wide AgentBot to their own inbox, then read that bot's API token from the inbox view. The token is meant to stay hidden because the bot belongs to no tenant. With it, the attacker reads and writes conversations in every other tenant that uses the same bot.
Class: Token disclosure / cross-tenant object access Reach: Remote, authenticated account administrator
Chatwoot v4.19.1 - caab07a8
| ID | no CVE yet |
| Class | Token disclosure / cross-tenant object access |
| Reach | Remote (administrator of any account) |
| CWE | CWE-200 / CWE-863 |
| CVSS | High: 8.7 CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N |
| Product | Chatwoot |
| Affected | v4.19.1 caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82 |
| Auth | administrator of any account on the instance |
| License | GNU Affero GPL v3.0 |
| Lab | loopback Docker compose; Postgres, Redis, Puma, Sidekiq |
The score assumes multi-tenant hosting, which is Chatwoot's own deployment model: one instance, many customer accounts, each with its own administrators. On a single-tenant install there is no boundary for the token to cross, and the same request only hands an operator a credential they could already read from the console.
Starts as an administrator of any account. GET /api/v1/accounts/:id/agent_bots already lists global bots, but the presenter blanks their token. The inbox view does not use the presenter.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
| See the global bot in the tenant list | GET /api/v1/accounts/:id/agent_bots | Recon | Lab-proven. listed_token=None |
| Attach the global bot to an inbox the attacker controls | POST /api/v1/accounts/:id/inboxes/:inbox/set_agent_bot | Integrity (config change) | Lab-proven. InboxPolicy#set_agent_bot? is administrator-only; AgentBot.accessible_to admits account_id IS NULL |
| Read the bot's access token | GET /api/v1/accounts/:id/inboxes/:inbox/agent_bot | Recon (credential) | Lab-proven. leaked_token_len=24 |
| Read a victim tenant's conversation | GET /api/v1/accounts/:victim/conversations/:id with api_access_token | Recon (message content) | Lab-proven. Witness returned |
| Post into a victim tenant's conversation | POST /api/v1/accounts/:victim/conversations/:id/messages | Integrity (customer-visible message) | Lab-proven. Victim session reads it back |
| Change status, priority, assignee, labels | PATCH conversation, POST /conversations/:id/labels | Integrity | Inferred from BOT_ACCESSIBLE_ENDPOINTS; same token and policy |
| Enumerate other tenants served by the bot | agent_bot_inboxes rows | Recon | Inferred. The bot is admitted to every account where it has an inbox |
| Negative control: attacker's own user token on the victim conversation | GET victim conversation with the user's access-token | n/a | Lab-proven. 401 |
| Negative control: token in the list view | GET /agent_bots | n/a | Lab-proven. access_token absent |
| Negative control: non-administrator account member | same inbox view | n/a | Source-proven. The partial gates the field on Current.account_user&.administrator? |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Recon | Victim inbox read by the attacker's user token | InboxPolicy#show? is account-scoped; lab returns 401 |
| Recon | Token on every other agent-bot view | AgentBotPresenter blanks it when account_id is blank |
| Recon | Token for a non-administrator member | Current.account_user&.administrator? in the partial |
| Integrity | Attaching a bot to another tenant's inbox | set_agent_bot writes only to Current.account inboxes |
| Integrity | Creating a global bot from the dashboard | No UI or API path; bots are created inside an account |
I pinned v4.19.1 (caab07a8) and read the inbox controller against the agent-bot controller. Every agent-bot view wraps the record in AgentBotPresenter. The inbox view hands the raw record to the partial:
# app/controllers/api/v1/accounts/inboxes_controller.rb
def agent_bot
@agent_bot = @inbox.agent_bot
end
The presenter exists to hide one thing:
# app/presenters/agent_bot_presenter.rb
def access_token
return if account_id.blank?
Current.account.id == account_id ? super&.token : nil
end
account_id.blank? is exactly the global-bot case. The partial still gates on administrator, so a regular agent gets the record without the token. An administrator gets the token.
Wrong turns: I first assumed the bot list leaked it too, which it does not; and I assumed the attacker needed a bot of their own, when the global bot is the one that crosses tenants. The lab keeps both as controls.
python3 chatwoot-agentbot-global-token-Abraxas-Labs.py
or:
cd lab
./run.sh
Brings up Postgres 16 with pgvector, Redis 7, Puma and Sidekiq from chatwoot/chatwoot:v4.19.1, seeds two tenants and a global bot, then drives the API over loopback on 127.0.0.1:28210. run.sh tears the stack down on exit.
IOC listed_bots=1 global_bot_id=1 listed_token=None
IOC attached global_bot=1 to inbox=1
IOC leaked_token_prefix=FV94xdoC1mAL token_len=24
IOC control attacker_user_reads_victim status=401
IOC bot_token_read status=200 account=2 conversation=1
IOC bot_token_write status=200 victim_confirms=true
SUCCESS CHATWOOT-F1-AGENTBOT-TOKEN account=1 inbox=1 global_bot=1 leaked_token_len=24 read_victim_account=2 conversation=1 VICTIM-SECRET-CONVERSATION-BODY
The token is 24 characters because Chatwoot's has_secure_token default length is 24. The value changes per seed; only the shape is fixed.
Pass the presenter in app/views/api/v1/accounts/inboxes/agent_bot.json.jbuilder:
json.agent_bot do
json.partial! 'api/v1/models/agent_bot', formats: [:json],
resource: AgentBotPresenter.new(@agent_bot) if @agent_bot.present?
end
A second layer is worth having: refuse set_agent_bot for bots whose account_id is not the current account, unless the instance deliberately shares that bot. The presenter is the narrow fix; the scope is the durable one.
caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82inboxes_controller.rbagent_bot_presenter.rb_agent_bot.json.jbuilderGNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.
Abraxas Labs [email protected]