Chatwoot v4.19.1 - High: 7.5 - Remote unauthenticated - message injection - Bandwidth SMS webhook accepts unsigned callbacks and routes by body, not path
Chatwoot's Bandwidth SMS callback has no authentication. Anyone who can reach the instance can post a fake inbound text and Chatwoot creates the contact, the conversation and the customer message in whichever SMS inbox the body names. The fix for this shipped and was reverted.
Class: Missing authentication on a webhook Reach: Remote, unauthenticated
Chatwoot v4.19.1 - caab07a8
| ID | no CVE yet |
| Class | Missing authentication on a webhook |
| Reach | Remote, no credentials |
| CWE | CWE-306 / CWE-345 |
| CVSS | High: 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| Product | Chatwoot |
| Affected | v4.19.1 caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82, also current develop |
| Auth | none |
| License | GNU Affero GPL v3.0 |
| Lab | loopback Docker compose; Postgres, Redis, Puma, Sidekiq |
No account is needed. The only requirement is network reach to the instance and the phone number of an SMS inbox, which is often a public support line.
| Privilege | Method / sink | Recon / integrity / availability | Lab-proven or inferred |
|---|---|---|---|
| Create a contact and conversation in the tenant | POST /webhooks/sms/:phone_number with _json[0].to naming the channel | Integrity | Lab-proven |
| Choose the sender identity the agent sees | _json[0].message.from | Integrity | Lab-proven. Two different numbers accepted |
| Fill the inbox with attacker-written customer messages | same, repeated | Availability (queue pollution) | Lab-proven |
| Trigger automation rules and bots on the fake inbound message | message_created listeners | Integrity | Inferred from source |
| Push outbound SMS to attacker-chosen numbers through an automation or auto-reply | Channel::Sms send path | Integrity, and cost | Inferred from source |
| Rewrite delivery state of a real outbound message | _json[0].type=message-failed with a known message.id | Integrity (reporting) | Inferred from source |
| Read existing conversations or contacts | none | n/a | Not reachable from this sink |
| Inject into WhatsApp, Twilio, Line or Telegram channels | their own controllers | n/a | Closed: those verify signatures |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Recon | Reading the tenant's data | The callback only writes; there is no read response |
| Recon | Enumerating inboxes | The body must name a phone number; a wrong number is a silent no-op |
| Integrity | WhatsApp, Twilio, Line, Telegram inbound | Those controllers verify a signature or token |
| Integrity | Authenticated SMS send | POST /conversations/:id/messages still needs an agent session |
I read every webhooks/* controller and checked each one for a before_action. app/controllers/webhooks/sms_controller.rb is six lines with none:
class Webhooks::SmsController < ActionController::API
def process_payload
Webhooks::SmsEventsJob.perform_later(params['_json']&.first&.to_unsafe_hash)
head :ok
end
end
The job resolves the channel from the body, not from the path:
channel = Channel::Sms.find_by(phone_number: params[:to])
The route is post 'webhooks/sms/:phone_number' (config/routes.rb:724), and the path value is never read. The body decides which tenant gets the message.
The interesting part is the history. A fix landed as #16546 and was reverted by 4893b4919 revert: "fix(webhooks): authenticate bandwidth sms callbacks" (#16577). So the pin and develop both take unauthenticated callbacks. The pre-revert spec shows the exact array shape Bandwidth sends, which is what the lab replays.
Wrong turns: my first attempt posted a JSON object, and Rails wrapped it under the object's own keys, so the controller saw nothing. Bandwidth posts an array, Rails wraps a non-hash body under _json, and params['_json'].first is the event. The lab posts a bare array for that reason, and posts to an unrelated phone number in the path to show the path is ignored.
python3 chatwoot-sms-webhook-unauth-Abraxas-Labs.py
or:
cd lab
./run.sh
Postgres 16 with pgvector, Redis 7, Puma and Sidekiq from chatwoot/chatwoot:v4.19.1. The seed creates one tenant with a Bandwidth SMS inbox on +15550001111 and nothing else. The PoC posts two unauthenticated arrays with different from numbers and then reads the tenant back with a normal admin session.
IOC victim account=1 sms=+15550001111 conversations_before=0
IOC unauthenticated_post status=200 path_number=00000000000 body_to=+15550001111
IOC conversation_id=1 status=open inbox_id=1
IOC message_id=1 type=0 sender_phone=+15559990000 content='SMS-INJECTED-WITNESS'
IOC second_injection conversation=2 sender=+15557770000
SUCCESS CHATWOOT-F2-SMS-WEBHOOK account=1 inbox=1 path_number_ignored=true conversation=1 message=1 witness=SMS-INJECTED-WITNESS SMS-INJECTED-WITNESS
run.sh tears the stack down on exit.
Restore #16546: authenticate the callback with per-channel credentials (HTTP basic with the Bandwidth username and password the channel already stores), or verify Bandwidth's request signature. The revert should not have shipped without a replacement. A per-instance shared secret is not enough here, because the body chooses the tenant.
caab07a8f00032d5205b5a5d7e2eb0ba2f3d2d82sms_controller.rbsms_events_job.rb4893b4919GNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.
Abraxas Labs [email protected]