open-webui/backend/open_webui/utils
Classic298 5e7244ab8b fix: gate OAuth profile picture MIME at ingestion + storage layer
Three defense-in-depth gaps from GHSA-3wgj-c2hg-vm6q that the v0.9.5
serving-side fix didn't address:

1. _process_picture_url (utils/oauth.py): MIME was inferred from the
   URL extension via mimetypes.guess_type, the upstream Content-Type
   was discarded, and there was no allowlist. An SVG picture URL
   produced data:image/svg+xml;base64,... in the user's
   profile_image_url. Switch to the upstream Content-Type and gate it
   against PROFILE_IMAGE_ALLOWED_MIME_TYPES (the same env var the
   serving endpoint already uses); fall back to /user.png if the MIME
   isn't in the allowlist. Also pass allow_redirects=AIOHTTP_CLIENT_
   ALLOW_REDIRECTS on the aiohttp session.get — the existing
   validate_url() only checks the initial URL, redirects to internal
   targets would otherwise still be followed (same class as the
   rh5x-h6pp-cjj6 cluster, sixth call site).

2. update_user_profile_image_url_by_id (models/users.py): SQLAlchemy
   write path bypassed the Pydantic form validators, so anything
   stored via OAuth or any other non-form caller landed in the column
   unchallenged. Run validate_profile_image_url at the storage layer
   before the assignment.

3. insert_new_user (models/users.py): same gap on the new-user path
   used by Auths.insert_new_auth (OAuth signup, LDAP). Same
   storage-layer call to validate_profile_image_url, falling back to
   /user.png if the supplied value doesn't pass.

The serving-endpoint allowlist landed in v0.9.5 already broke the
exploit chain matte1782 demonstrated (browser never receives
Content-Type: image/svg+xml), but bad data was still being written
to the DB and the upstream MIME was never trusted. These three
fixes harden the ingestion + storage layers so future serving paths
or DB readers don't have to assume the column is clean.

Reported by matte1782 in GHSA-3wgj-c2hg-vm6q.

Co-authored-by: matte1782 <matte1782@users.noreply.github.com>
2026-05-10 21:52:16 +02:00
..
access_control refac 2026-05-11 02:12:38 +09:00
images refac 2026-04-15 10:17:40 -07:00
mcp refac 2026-04-24 17:04:47 +09:00
telemetry refac 2026-04-24 15:00:47 +09:00
actions.py refac: async db 2026-04-12 14:22:11 -05:00
anthropic.py chore: format 2026-04-14 17:27:31 -05:00
asgi_middleware.py Enhance CommitSessionMiddleware to allow health probes to bypass session management, ensuring faster and more reliable responses. (#24384) 2026-05-09 04:46:00 +09:00
audit.py refac 2026-04-12 16:25:01 -05:00
auth.py chore: format 2026-04-12 18:12:59 -05:00
automations.py refac 2026-05-09 04:17:58 +09:00
calendar.py feat: calendar 2026-04-19 19:15:05 +09:00
channels.py refac 2026-03-17 17:58:01 -05:00
chat.py refac 2026-05-09 04:36:43 +09:00
code_interpreter.py refac 2026-05-09 21:05:49 +09:00
embeddings.py refac: async db 2026-04-12 14:22:11 -05:00
files.py fix: prevent redirect-based SSRF and enforce collecton write access (#24524) 2026-05-11 01:09:15 +09:00
filter.py refac 2026-04-24 18:20:10 +09:00
groups.py refac: async db 2026-04-12 14:22:11 -05:00
headers.py chore: format 2026-05-09 15:25:27 +09:00
logger.py refac 2026-04-10 10:15:55 -07:00
middleware.py chore: format 2026-05-11 02:51:59 +09:00
misc.py refac 2026-05-09 15:46:33 +09:00
models.py refac 2026-05-09 01:13:16 +09:00
oauth.py fix: gate OAuth profile picture MIME at ingestion + storage layer 2026-05-10 21:52:16 +02:00
payload.py refac 2026-05-09 04:17:58 +09:00
pdf_generator.py refac 2026-03-17 17:58:01 -05:00
plugin.py chore: format 2026-05-09 15:25:27 +09:00
rate_limit.py refac 2026-03-17 17:58:01 -05:00
redis.py refac 2026-04-24 15:21:52 +09:00
response.py refac 2026-04-24 16:31:02 +09:00
sanitize.py refac 2026-03-17 17:58:01 -05:00
security_headers.py refac 2026-04-20 09:10:48 +09:00
session_pool.py refac 2026-04-14 01:17:39 -05:00
task.py refac 2026-05-09 04:17:58 +09:00
tools.py refac 2026-05-09 21:05:49 +09:00
validate.py refac 2026-05-11 02:25:11 +09:00
webhook.py refac 2026-04-20 08:34:15 +09:00