[PR #18962] [CLOSED] Fix SSRF vulnerability in web fetch endpoint (GHSA-c6xv-rcvw-v685) #11833

Closed
opened 2025-11-11 19:58:16 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/18962
Author: @teorepo
Created: 11/6/2025
Status: Closed

Base: mainHead: fix/ssrf-ghsa-c6xv-rcvw-v685


📝 Commits (1)

  • 1235ca8 Fix SSRF vulnerability in web fetch endpoint (GHSA-c6xv-rcvw-v685)

📊 Changes

4 files changed (+284 additions, -0 deletions)

View changed files

📝 backend/open_webui/config.py (+19 -0)
📝 backend/open_webui/main.py (+6 -0)
backend/open_webui/retrieval/ssrf_protection.py (+207 -0)
📝 backend/open_webui/routers/retrieval.py (+52 -0)

📄 Description

Description

This PR fixes the SSRF (Server-Side Request Forgery) vulnerability reported in GHSA-c6xv-rcvw-v685.

Changes

  • Add SSRF protection module with configurable blocklists
  • Block cloud metadata endpoints by default (AWS, GCP, Azure, Alibaba, Oracle, DigitalOcean)
  • Add protocol restrictions (HTTP/HTTPS only)
  • Add DNS resolution validation
  • Maintain backward compatibility with optional IP range blocking via environment variables

Security Impact

Fixes CWE-918: Server-Side Request Forgery vulnerability that could allow attackers to access internal network resources and cloud metadata endpoints.

Testing

  • Blocks AWS metadata (169.254.169.254)
  • Blocks GCP metadata (metadata.google.internal)
  • Blocks Azure metadata endpoints
  • Allows legitimate external URLs
  • Custom hostname blocklist functionality
  • Custom IP range blocklist functionality
  • Protection can be toggled via ENABLE_SSRF_PROTECTION env variable

Configuration

Admins can customize the protection via environment variables:

ENABLE_SSRF_PROTECTION=true
SSRF_BLOCKED_HOSTNAMES=evil.com,internal.corp.com
SSRF_BLOCKED_IP_RANGES=127.0.0.0/8,::1/128,192.168.0.0/16,10.0.0.0/8

Backward Compatibility

  • Protection is enabled by default for security
  • Private IP ranges (localhost, 192.168.x.x, 10.x.x.x) are NOT blocked by default to maintain compatibility
  • Admins can enable stricter blocking via configuration

Reported-by: @teorepo
Security: Fixes GHSA-c6xv-rcvw-v685 (CWE-918)

contributor license agreement


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/18962 **Author:** [@teorepo](https://github.com/teorepo) **Created:** 11/6/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/ssrf-ghsa-c6xv-rcvw-v685` --- ### 📝 Commits (1) - [`1235ca8`](https://github.com/open-webui/open-webui/commit/1235ca8a4f8d983336ec288df04de148bd9afafd) Fix SSRF vulnerability in web fetch endpoint (GHSA-c6xv-rcvw-v685) ### 📊 Changes **4 files changed** (+284 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+19 -0) 📝 `backend/open_webui/main.py` (+6 -0) ➕ `backend/open_webui/retrieval/ssrf_protection.py` (+207 -0) 📝 `backend/open_webui/routers/retrieval.py` (+52 -0) </details> ### 📄 Description ## Description This PR fixes the SSRF (Server-Side Request Forgery) vulnerability reported in GHSA-c6xv-rcvw-v685. ### Changes - Add SSRF protection module with configurable blocklists - Block cloud metadata endpoints by default (AWS, GCP, Azure, Alibaba, Oracle, DigitalOcean) - Add protocol restrictions (HTTP/HTTPS only) - Add DNS resolution validation - Maintain backward compatibility with optional IP range blocking via environment variables ### Security Impact Fixes CWE-918: Server-Side Request Forgery vulnerability that could allow attackers to access internal network resources and cloud metadata endpoints. ### Testing - ✅ Blocks AWS metadata (169.254.169.254) - ✅ Blocks GCP metadata (metadata.google.internal) - ✅ Blocks Azure metadata endpoints - ✅ Allows legitimate external URLs - ✅ Custom hostname blocklist functionality - ✅ Custom IP range blocklist functionality - ✅ Protection can be toggled via `ENABLE_SSRF_PROTECTION` env variable ### Configuration Admins can customize the protection via environment variables: ```bash ENABLE_SSRF_PROTECTION=true SSRF_BLOCKED_HOSTNAMES=evil.com,internal.corp.com SSRF_BLOCKED_IP_RANGES=127.0.0.0/8,::1/128,192.168.0.0/16,10.0.0.0/8 ``` Backward Compatibility - Protection is enabled by default for security - Private IP ranges (localhost, 192.168.x.x, 10.x.x.x) are NOT blocked by default to maintain compatibility - Admins can enable stricter blocking via configuration Reported-by: @teorepo Security: Fixes GHSA-c6xv-rcvw-v685 (CWE-918) contributor license agreement --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 19:58:16 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#11833