Skip to content

Security: Server-Side Request Forgery (SSRF) in /api/fetch - #511

Closed
tomaioo wants to merge 1 commit into
OpenModelDB:mainfrom
tomaioo:fix/security/server-side-request-forgery-ssrf-in-api-
Closed

Security: Server-Side Request Forgery (SSRF) in /api/fetch#511
tomaioo wants to merge 1 commit into
OpenModelDB:mainfrom
tomaioo:fix/security/server-side-request-forgery-ssrf-in-api-

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Security: Server-Side Request Forgery (SSRF) in /api/fetch

Problem

Severity: Critical | File: src/pages/api/fetch.ts:L6

The /api/fetch endpoint takes a URL from the user request body and fetches it server-side without any validation. An attacker can use this to force the server to make requests to internal network resources (e.g., http://localhost, http://169.254.169.254), potentially exposing internal services or cloud metadata.

Solution

Implement a strict allowlist of permitted domains or URL patterns (e.g., only allowing specific external domains that the application needs to fetch from). Reject any requests pointing to internal or link-local IP addresses.

Changes

  • src/pages/api/fetch.ts (modified)

The `/api/fetch` endpoint takes a URL from the user request body and fetches it server-side without any validation. An attacker can use this to force the server to make requests to internal network resources (e.g., `http://localhost`, `http://169.254.169.254`), potentially exposing internal services or cloud metadata.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@joeyballentine

Copy link
Copy Markdown
Contributor

Fixed this in #513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants