
Chatwoot v4.19.1 - High: 7.1 - Remote, one click - cross-tenant integration - Slack OAuth callback omits state and binds a tenant to an attacker workspace
Chatwoot builds its Slack authorize URL without an OAuth state, and the callback redeems any code into whichever account the request is scoped to. An attacker who starts the flow against their own Slack workspace can hand the callback URL to a victim administrator and bind that tenant's support inbox to the attacker's Slack.
Class: OAuth state omission / account binding
Reach: Remote, victim administrator interaction
Chatwoot v4.19.1 - caab07a8
| ID | no CVE yet |
| Class | OAuth state omission / account binding |
| Reach | Remote, one click by a logged-in administrator |
| CWE | CWE-352 |
| CVSS | High: 7.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N |
| Product | Chatwoot |
| Affected | v4.19.1 caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82 |
| Auth | attacker needs a Slack workspace, not a Chatwoot account; the victim is a logged-in administrator |
| License | GNU Affero GPL v3.0 |
| Lab | loopback Docker compose; the Slack token exchange is stubbed |
Scope of proof. A real exchange needs a registered Slack app, so lab/slack_stub.rb replaces Slack::Web::Client#oauth_v2_access with a fixed attacker-workspace response. Everything Chatwoot does is real HTTP against the pinned build: the authorize URL it hands the browser, the redemption endpoint, the hook it stores, and the account the hook lands in. The vendor round-trip is simulated. The consequence for the victim tenant is inferred from the stored hook, not observed in Slack.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
| Read the authorize URL the tenant is given | GET /api/v1/accounts/:id/integrations/apps | Recon | Lab-proven. state= absent |
Have an arbitrary code redeemed into the tenant | POST /api/v1/accounts/:id/integrations/slack with {code} | Integrity (tenant binding) | Lab-proven, with the exchange stubbed |
| Bind the tenant to the attacker's Slack workspace | stored Integrations::Hook.access_token | Integrity | Lab-proven. Stored token equals the attacker token |
| Enable the integration and receive its notifications | PATCH /integrations/hooks/:id {status: enabled} | Integrity / confidentiality | Lab-proven that the hook enables; delivery inferred |
Read new-conversation notifications, and with two_way reply into customer threads | Slack app events | Confidentiality / integrity | Inferred from the integration design |
| Take over a tenant that already had Slack connected | allow_multiple_hooks: false | Integrity | Inferred: the new hook replaces the tenant's own |
| Read Chatwoot conversations directly | none | n/a | Closed: the hook only carries Slack API scope |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Recon | Direct Chatwoot data access | The stored credential is a Slack bot token |
| Integrity | Silent binding without the victim | The frontend route consumes ?code= in the victim's browser, so the victim must be logged in and open the link |
| Integrity | Replaying the same code | Slack codes are single-use; the stub does not model that |
| Integrity | Binding to a tenant the attacker cannot name | The redirect URI is account-scoped and the POST needs that account in the path |
The integration catalog builds a button and an action for every app. Slack is special-cased:
# app/models/integrations/app.rb
when 'slack'
client_id = GlobalConfigService.load('SLACK_CLIENT_ID', nil)
"#{params[:action]}&client_id=#{client_id}&redirect_uri=#{self.class.slack_integration_url}"
slack_integration_url is "#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/integrations/slack". The account id is in the redirect URI, and it is the only thing that ties the callback to a tenant. There is no state, no nonce, no server-side record of who started the flow.
The controller then exchanges whatever code arrives:
def create
hook_builder = Integrations::Slack::HookBuilder.new(
account: Current.account, code: params[:code], inbox_id: params[:inbox_id]
)
@hook = hook_builder.perform
end
HookBuilder calls oauth_v2_access and stores the returned token on Current.account. The frontend page at the redirect URI reads props.code on mount and posts it. So the attack is: start OAuth against your own workspace, take the code Slack issues to your redirect, and send the victim .../settings/integrations/slack?code=<yours>. Their browser posts it with their session, and their tenant gets your workspace token.
The comparison is Linear, which is in the same file and does it correctly: encode_state mints a signed token carrying the account id, and the Linear callback decodes it. Slack has no equivalent.
Wrong turns: the Slack app only appears in the catalog when SLACK_CLIENT_SECRET is set, and db:chatwoot_prepare seeds blank SLACK_CLIENT_ID / SLACK_CLIENT_SECRET rows that shadow ENV, so the first lab run saw no Slack app at all. The seed now writes those rows and clears the config cache. The second was the stub itself: slack-ruby-client 2.7.0 defines Slack::Web as a module, not a class, so reopening it as a class crashes Rails at boot.
python3 chatwoot-slack-oauth-state-Abraxas-Labs.py
or:
cd lab
./run.sh
The lab asserts the authorize URL has no state, has the lab client_id, and carries the account-scoped redirect_uri; posts the attacker's code with the admin session; enables the hook; then reads the stored token out of the database through rails runner so the proof does not depend on any HTTP response.
IOC authorize_url=https://slack.com/oauth/v2/authorize?scope=commands,chat:write,...&client_id=lab-slack-client-id&redirect_uri=http://127.0.0.1:28230/app/accounts/1/settings/integrations/slack
IOC state_param_present=false redirect_uri=/app/accounts/1/settings/integrations/slack
IOC redeemed code='lab-attacker-issued-code' hook_id=1 status=False account=1
IOC stored_hook hook_id=1 account=1 status=enabled token='xoxb-lab-attacker-workspace'
IOC tenant_enabled=true hook_bound_to_attacker_workspace=true
SUCCESS CHATWOOT-F3-SLACK-OAUTH-STATE account=1 hook=1 state_absent=true redeemed_without_session=true stored_token=xoxb-lab-attacker-workspace xoxb-lab-attacker-workspace
run.sh tears the stack down on exit.
Generate a random state per initiation, store it server-side against the account and the initiating user, and require it back on the callback before exchanging the code. Linear's encode_state in the same file is the pattern. Reject a callback whose state is missing or does not match the account in the path.
caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82integrations/app.rbintegrations/slack_controller.rblib/integrations/slack/hook_builder.rb