Chatwoot, a shared bot hands its token to any tenant admin
Chatwoot v4.19.1 renders the raw AgentBot record on the inbox agent-bot view instead of AgentBotPresenter. An administrator attaches a global bot to their own inbox, reads its access token, and uses it to read and write another tenant's conversations. Labbed against the pinned release. No CVE yet.
- Name
- Chatwoot, a shared bot hands its token to any tenant admin
- Type
- 0-day analysis
- CVE
- n/a
- CVE Risk
- high
- Disclosure Status
- public
- Vendor
- Chatwoot
- Affected
- Chatwoot v4.19.1 caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82. Needs an administrator account on an instance that has a global AgentBot.
- Published
- 13 Nov 2026
- Updated
- 13 Nov 2026
- Tags
- 0-day, chatwoot, rails, agentbot, token, cwe-200, cwe-863, multi-tenant, authenticated
The shared bot handed out its password
I am @abraxas_null. The proof of concept is on GitHub: abraxas/chatwoot-agentbot-global-token (loopback client). The lab stack is lab/: Dockerfile, docker-compose.yml, run.sh, poc.py. Authorized lab only. It talks to loopback.
Chatwoot lets a support team put a bot in front of an inbox. One kind of bot is created inside an account. The other kind belongs to no account at all: a global bot, shared across the instance. Administrators can attach either kind to their own inbox. When they attach a global bot and then open the inbox's agent-bot panel, the API returns the bot's API token in plain text. The token is the bot's login. A bot is admitted to every account where it has an inbox, so the token opens conversations in tenants the attacker has never seen.
This is the short version for anyone who has not read a Rails controller lately: a customer administrator asks the app "which bot is on my inbox", and the app answers with the bot's password. The panel was only supposed to say which bot it is.
This is Chatwoot v4.19.1 (caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82, 24 October 2026). No CVE yet. CWE-200 / CWE-863. 8.7 High (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N). The scope change is the whole argument: the credential crosses a tenant boundary.
Why Chatwoot
I had been through a run of infrastructure hunts where the answer kept being "the operator turned it on". Grafana, Prometheus, PostgreSQL, Kafka. Chatwoot was the other shape: a Rails monolith with real tenants, real roles, and a vendor that sells the multi-tenant deployment as a product. Multi-tenant Rails is where authorization bugs live, because every controller has to remember which account it is in, and one of them eventually does not.
The tree is large but readable. Accounts, account users, inboxes, contacts, conversations, messages, integrations, help-centre portals, agent bots, Captain. DeviseTokenAuth for sessions and API tokens. Pundit for policy objects. Sidekiq for the asynchronous half. A Vue dashboard on top.
I split the surface into thirty areas and read each one against its policy object, then re-diffed every candidate against origin/develop. The tag is 202 commits behind develop as I write this, and ten of the roughly twenty candidates I liked were already fixed upstream. That is the normal ratio. A finding that is fixed on develop but unreleased is not a finding you announce as new.
The skip list
Chatwoot publishes advisories, so the first job is knowing what is already out. On the pin, these were closed:
- The WhatsApp and Twilio webhook signature work.
- The HMAC binding on help-centre article previews.
- The platform-user token scope.
- The
associated_article_idportal check. - The automation rule team-email check.
- The Dyte integration IDOR and the widget contact merge.
- The draft-article visibility gap.
Four public advisories exist for the product and none of them is this. The Bandwidth SMS webhook, which I also labbed, is a different report; its fix landed and was reverted, which is its own story.
Surfaces that returned nothing
Most of the tree behaved. SLA policy attachment validates that the policy belongs to the account. Campaign inbox_id is checked against the account. Portal inbox_id, contact-inbox inbox_id, and assignment-policy inbox_id all have the same account-membership validator. The SQL layer is binds and casts and allowlists across 38 sinks. Help-centre article category_id and category parentage are unscoped, which is a lower-severity content-injection bug and a separate note.
Agent bots were interesting because they are the one object that deliberately spans accounts. A global bot is not a mistake in the data model; it is a feature. The question was whether every view of that object respected the one field the model tries to hide.
The leftover
Every agent-bot view in the product wraps the record in AgentBotPresenter. Create, index, show, update, reset secret, reset access token, avatar. The presenter does one job:
# app/presenters/agent_bot_presenter.rb
def access_token
return if account_id.blank?
Current.account.id == account_id ? super&.token : nil
endaccount_id.blank? is the global bot. That branch is the entire reason the presenter exists. The inbox view does not use it:
# app/controllers/api/v1/accounts/inboxes_controller.rb
def agent_bot
@agent_bot = @inbox.agent_bot
end# app/views/api/v1/accounts/inboxes/agent_bot.json.jbuilder
json.agent_bot do
json.partial! 'api/v1/models/agent_bot', formats: [:json], resource: @agent_bot if @agent_bot.present?
endThe partial itself is careful. It gates the token on Current.account_user&.administrator?. So a normal agent on the inbox gets the bot's name and nothing else. An administrator gets the token. The gate was written for "only admins should see secrets", not "this secret belongs to no tenant".
Attaching the bot is a normal admin action. POST /api/v1/accounts/:id/inboxes/:inbox/set_agent_bot looks the bot up through AgentBot.accessible_to(Current.account), which is where(account_id: [nil, account.id]). The global bot is in scope by design. InboxPolicy#set_agent_bot? is administrator-only, and the admin is an administrator of their own account, so the write lands on their own inbox and passes every check.
Then the token does the rest. AccessTokenAuthHelper accepts it as api_access_token and sets Current.user to the bot. EnsureCurrentAccountHelper#account_accessible_for_bot? admits the bot to any account where agent_bot_inboxes has a row, and the bot's inbox rows are instance-wide. ConversationPolicy#show? returns true for any AgentBot. BOT_ACCESSIBLE_ENDPOINTS covers conversation show, create, update, messages, and labels.
Wrong turns
Two, both useful.
First I assumed the agent-bot list endpoint leaked the token too, since it returns the same records. It does not. The list uses the presenter, and the lab prints listed_token=None to keep me honest.
Then I assumed the attacker needed to own a bot, attach it, and read its own token, which would be a nothing-bug. The interesting object is the global bot, which only exists on instances that share one. That is exactly the deployment the vendor sells, and it is the case the presenter was written for.
The lab keeps both as controls, plus the obvious one: the attacker's own user token cannot read the victim conversation. That request returns 401. The leaked bot token returns 200.
What an attacker can do
The attacker is an administrator of any account on the instance. On Chatwoot Cloud, that is any customer who can create or administer a workspace.
| 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. Token absent |
| Attach the global bot to an inbox they control | POST /api/v1/accounts/:id/inboxes/:inbox/set_agent_bot |
Integrity (config change) | Lab-proven |
| Read the bot's API token | GET /api/v1/accounts/:id/inboxes/:inbox/agent_bot |
Recon (credential) | Lab-proven. 24 characters |
| Read another tenant's conversation | GET /api/v1/accounts/:victim/conversations/:id as the bot |
Recon (message content) | Lab-proven. Witness returned |
| Post into another 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 labels |
Integrity | Inferred from BOT_ACCESSIBLE_ENDPOINTS |
| Find the other tenants the bot serves | agent_bot_inboxes rows |
Recon | Inferred |
Stays closed
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Recon | Victim inbox read by the attacker's user token | Account-scoped policy. Lab returns 401 |
| Recon | Token on every other agent-bot view | AgentBotPresenter |
| Recon | Token for a non-administrator member | Administrator gate in the partial |
| Integrity | Attaching a bot to another tenant's inbox | set_agent_bot writes to Current.account inboxes only |
| Integrity | Creating a global bot from the dashboard | No UI or API path; bots are created inside an account |
The availability axis is empty. Nothing here deletes or blocks. It is a read and a write inside someone else's support queue, which is worse in a way that does not show up in an uptime graph.
The lab
Two tenants, one global bot, one witness. The seed creates Attacker Co and Victim Co, an inbox in each, a victim conversation whose message body is VICTIM-SECRET-CONVERSATION-BODY, and a bot with account_id: nil attached to the victim inbox. A global bot cannot be created from the dashboard, so the seed does it through rails runner, which is also how an instance ends up with one.
Postgres 16 with pgvector, Redis 7, Puma, Sidekiq, and the pinned release image. The PoC logs in as both administrators, lists the bots, attaches the global bot to the attacker's inbox, reads the token, then uses the token to read the victim conversation and post a message into it. The victim session reads that message back, so the write is confirmed from the other side.
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-BODYrun.sh tears the stack down on exit. Two Chatwoot stacks fit an 8 GB Docker VM; a third starves Postgres.
The fix
The narrow fix is the presenter, one line in the jbuilder:
json.partial! 'api/v1/models/agent_bot', formats: [:json],
resource: AgentBotPresenter.new(@agent_bot) if @agent_bot.present?The durable fix is a scope on the write. Refuse set_agent_bot for a bot whose account_id is neither the current account nor nil by policy, and for the nil case either keep the attach but hide the token everywhere, or make global bots opt-in per account. The presenter is what makes the token unreadable. The scope is what stops the next view from making the same mistake.
References
- chatwoot/chatwoot
caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82 inboxes_controller.rbagent_bot_presenter.rb_agent_bot.json.jbuilder- CWE-200 · CWE-863
Abraxas Labs abraxaslabs.tech · github.com/abraxas · @abraxas_null · abraxas.null@proton.me