Chatwoot, SSO walks past the second factor
Chatwoot v4.19.1 returns from the SSO sign-in path before the password path's MFA check. A valid sso_auth_token produces a full session for an MFA-enrolled user with no TOTP prompt, and skips enforced enrolment on the same account. The password path is gated, which is the control. Labbed. No CVE yet.
- Name
- Chatwoot, SSO walks past the second factor
- Type
- 0-day analysis
- CVE
- n/a
- CVE Risk
- high
- Disclosure Status
- public
- Vendor
- Chatwoot
- Affected
- Chatwoot v4.19.1 caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82. Needs a valid sso_auth_token for a user on an account with MFA enrolled or enforced.
- Published
- 13 Nov 2026
- Updated
- 13 Nov 2026
- Tags
- 0-day, chatwoot, rails, sso, mfa, cwe-287, authentication
The early return
I am @abraxas_null. The proof of concept is on GitHub: abraxas/chatwoot-sso-mfa-bypass (loopback client). The lab stack is lab/: Dockerfile, docker-compose.yml, run.sh, poc.py. Authorized lab only. It talks to loopback.
Two-factor authentication exists for one case: the password is already gone. Someone phished it, read it out of a browser, or found it in a dump. The second factor is the thing that still stands between them and the account.
Chatwoot's sign-in controller has two ways in. One takes a password and runs the MFA gate. The other takes an SSO token and returns several lines earlier, before the gate is reached. A valid sso_auth_token becomes a full session for a user who has TOTP enabled, with no challenge. The same path also skips enforced enrolment, so a user the organisation requires to enrol never sees the setup screen.
The token is the precondition, and it is why the score is not higher. The bug is that holding it is enough.
This is Chatwoot v4.19.1 (caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82, 24 October 2026). No CVE yet. CWE-287 / CWE-304. 8.1 High (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).
Why this one
The previous three findings were authorization: a view that skipped a presenter, a webhook with no signature, a write that took a foreign id. This one is the authentication stack, which is a different kind of reading. Controllers that branch on the request shape are where a control gets skipped, because the branch decides which controls run at all.
Chatwoot's sessions controller is a Devise override with a chain of early returns. That shape is honest and easy to audit once you stop reading it top to bottom and start asking what each return skips.
The chain
def create
return handle_mfa_setup_verification if mfa_setup_verification_request?
return handle_mfa_verification if mfa_verification_request?
return handle_sso_authentication if sso_authentication_request?
return if password_pre_auth_intercepted?
super
endpassword_pre_auth_intercepted? is the only caller of the MFA decision:
def password_pre_auth_intercepted?
user = find_user_for_authentication
return false unless user
if user.mfa_enabled?
handle_mfa_required(user)
return true
end
if user.mfa_enforcement_pending?
handle_mfa_setup_required(user)
return true
end
false
endThe SSO branch returns one line above it. handle_sso_authentication resolves the token, then calls create_token, sign_in and render_create_success directly. Between the token check and the session there is no question about otp_required_for_login?, and no question about whether the account enforces enrolment.
The enforcement guard does exist. It is wired to a callback that does not run here:
before_action :enforce_mfa!, if: :authenticate_by_access_token?That condition is true for API requests carrying an access token. A fresh SSO login is not one, so the guard never fires. mfa_enforcement_applies? exempts only the saml provider, which is the detail that convinced me this is a gap rather than a policy: OAuth providers were meant to be in scope, and the exemption list names the one provider that was deliberately left out.
Wrong turns
The first PoC expected a 403 from the guard. It got a 200 with access-token, client and uid headers, which is a session. The lab now proves the session is usable rather than trusting the status code: it calls GET /api/v1/profile with the returned headers and matches the email in the body. A 200 that does not authenticate would fail the run.
The second was assuming a wrong token would still pass some of the way. It returns 401. The token lookup is Redis-backed and real, so the bypass needs a token that was actually minted. The lab keeps that as a control.
The third was the password path itself. I wanted the control to be the same account and the same user, so the only variable is the path. run.sh seeds three administrators on one account with enforce_mfa = true:
| User | Provider | MFA state | Password login | SSO login |
|---|---|---|---|---|
control@ |
password | enrolled | 206 mfa_required |
n/a |
oauth@ |
OAuth | enrolled | 206 mfa_required |
200, session |
pending@ |
OAuth | not enrolled | 206 mfa_setup_required |
200, no setup |
The first row is the control that matters. On the same account, the same policy, the password path stops and asks. The SSO path does not.
What an attacker can do
The attacker holds a valid sso_auth_token for the target user. Tokens are minted into a redirect URL by the OAuth callback and by generate_sso_link, and they live five minutes. Getting one means an intercepted redirect, a leaky referrer, a shared link, or a compromised identity provider. Each of those is a plausible way to lose the first factor, and each is exactly what TOTP is for.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
| Sign in as an MFA-enrolled user with no TOTP | POST /auth/sign_in with {email, sso_auth_token} |
Integrity (session) | Lab-proven. 200 plus usable headers |
| Skip enforced MFA enrolment | the same path for a user with no second factor | Integrity (policy) | Lab-proven. 200, no mfa_setup_required |
| Reach any API the user can reach | GET /api/v1/profile and beyond |
Depends on the user | Lab-proven for profile |
| Obtain the token | OAuth callback, generate_sso_link, intercepted redirect |
Recon | Inferred; five-minute lifetime |
| Escalate to super-admin tooling | the user's role | Depends on the user | Not tested |
| Use an expired or random token | Mfa::TokenService lookup |
n/a | Closed: lab returns 401 |
Stays closed
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Integrity | Password login without TOTP | password_pre_auth_intercepted? returns 206 mfa_required |
| Integrity | Password login without enrolment | 206 mfa_setup_required |
| Integrity | Forged SSO token | Redis-backed lookup; 401 |
| Integrity | SAML users in enforced accounts | mfa_enforcement_applies? exempts saml deliberately |
| Recon | Session without a token | The SSO branch requires params[:sso_auth_token].present? |
The impact is the user's role, which is why the score is 8.1 rather than critical. On Chatwoot Cloud that is usually an agent; on a self-hosted instance with SSO wired to a directory, it can be an administrator.
The lab
One tenant with enforce_mfa = true and the three administrators above. run.sh mints the two SSO tokens with rails runner immediately before the PoC runs, because they expire after five minutes. The PoC does the two password controls, the bad-token control, then the two SSO logins, and proves each session with a profile call.
IOC control_password status=206 mfa_required=True
IOC control_pending_password status=206 mfa_setup_required=True
IOC control_bad_sso_token status=401
IOC mfa_enrolled_user_sso status=200 token_issued=true profile_status=200
IOC mfa_pending_user_sso status=200 enrolment_skipped=true profile_status=200
SUCCESS CHATWOOT-F5-SSO-MFA-BYPASS account=1 enforce_mfa=True control_password_mfa_required=true control_enrolment_required=true sso_mfa_enrolled_user_session=true sso_enrolment_skipped=true SSO-BYPASSES-MFArun.sh tears the stack down on exit.
The fix
Run the MFA decision before the SSO branch, or inside handle_sso_authentication once the token has resolved the user:
return handle_mfa_required(user) if user.mfa_enabled?
return handle_mfa_setup_required(user) if user.mfa_enforcement_pending?Both paths should converge on sign_in_mfa_user after the second factor. The guard's authenticate_by_access_token? condition is how this slipped through, so the check belongs on the user and the account policy, not on whichever callback happens to run. A regression test that posts a valid SSO token for an enrolled user and expects 206 would have caught it; the existing specs cover the password path only.
References
- chatwoot/chatwoot
caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82 devise_overrides/sessions_controller.rbmfa_enforcement_guard.rbdevice_verification_guard.rb- CWE-287 · CWE-304
Abraxas Labs abraxaslabs.tech · github.com/abraxas · @abraxas_null · abraxas.null@proton.me