open-webui/backend/open_webui
Classic298 f5e110fbee
fix: enforce message ownership in group/DM channel update + delete endpoints (#24506)
* fix: enforce message ownership in group/DM channel update + delete endpoints

`update_message_by_id` (channels.py:1348) and `delete_message_by_id`
(channels.py:1550) branch on `channel.type`. The `else` branch (standard
channels) correctly enforces `message.user_id != user.id` ownership before
mutating, but the `if channel.type in ['group', 'dm']` branch only checked
`is_user_channel_member` — channel membership alone, with no message
ownership verification.

Effect on group/DM channels: any verified member of the conversation could:

- overwrite another member's message content while the server preserved
  `user_id=victim`, producing tampered content that renders to other
  members as the original author's authentic post (integrity + authenticity);
- silently delete another member's messages, removing them from
  conversation history without trace (integrity).

Reproduced end-to-end against v0.9.4 with three users (attacker, victim,
viewer) sharing a group channel: attacker overwrites victim's message and
deletes another, viewer reads the tampered content as victim-authored.

Two patches, identical shape, mirror the `else` branch's existing
ownership semantics:

- `update_message_by_id` group/DM branch: add
  `if user.role != 'admin' and message.user_id != user.id: raise 403`
  immediately after the `is_user_channel_member` check.
- `delete_message_by_id` group/DM branch: same.

The standard-channel branch is unchanged (it already enforced ownership).
Admins remain able to moderate any message, matching the existing semantic
in the standard-channel branch.

Reports consolidated under GHSA-wwhq-cx22-f7vv (earliest live filing of the
group/DM-specific variant). Same gap previously surfaced and partially
fixed under GHSA-jxwr-g6r6-j3fx (which addressed the standard-channel
branch only) — this completes the cohort.

* chore: trim comments
2026-05-11 01:03:39 +09:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal chore: format 2026-05-09 15:25:27 +09:00
migrations chore: format 2026-05-09 15:25:27 +09:00
models Merge pull request #24486 from Classic298/fix/notes-is-pinned-typeerror 2026-05-09 20:56:06 +09:00
retrieval fix: reject parser-confusing chars in validate_url to close SSRF bypass (#24534) 2026-05-11 00:57:48 +09:00
routers fix: enforce message ownership in group/DM channel update + delete endpoints (#24506) 2026-05-11 01:03:39 +09:00
socket refac 2026-05-09 15:21:31 +09:00
static chore: format 2026-04-19 22:45:54 +09:00
storage refac 2026-04-12 19:08:30 -05:00
test refac 2026-03-17 17:58:01 -05:00
tools chore: format 2026-05-09 15:25:27 +09:00
utils refac 2026-05-09 21:05:49 +09:00
__init__.py refac 2026-05-09 02:38:08 +09:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py fix: gate public sharing of calendars behind sharing.public_calendars permission (#24493) 2026-05-09 23:18:51 +09:00
constants.py chore: format 2026-04-14 17:27:31 -05:00
env.py refac 2026-05-09 21:05:49 +09:00
functions.py refac 2026-05-09 04:17:58 +09:00
main.py chore: format 2026-05-09 15:25:27 +09:00
tasks.py refac 2026-03-17 17:58:01 -05:00