/

CVE-2026-48555

Severity:

HIGH RISK

(7.4)

SSRF in Spatie Laravel Media Library addMediaFromUrl()

CVE-2026-48555

Deferred

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Arbitrary Outbound HTTP Requests / SSRF

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Spatie Laravel Media Library versions before 11.23.0 contain a server-side request forgery (SSRF) vulnerability in the addMediaFromUrl() method, which allows user-controlled URLs to be fetched by the server.

An attacker can abuse this behavior to make the application issue arbitrary outbound HTTP requests, potentially targeting internal services or cloud metadata endpoints that are not directly reachable from the internet.

Affected context

This vulnerability arises in applications using Spatie Laravel Media Library where user input is passed directly or indirectly to addMediaFromUrl() in InteractsWithMedia.php.

It becomes relevant when:

  • User-supplied URLs are accepted for adding media from remote locations.
  • There is no strict allowlist, network segmentation, or URL validation applied before invoking addMediaFromUrl().
  • The application server has network access to internal services (e.g., internal APIs, databases with HTTP interfaces, admin panels, or cloud instance metadata endpoints).

In such deployments, the library can be leveraged as an HTTP client to pivot into internal or otherwise restricted network locations.

Exploit preconditions

  • Attack surface: Application endpoints or flows that call addMediaFromUrl() with data derived from user-controlled input (e.g., forms, APIs, file-upload dialogs that accept URLs).
  • Required access: Ability to submit or influence the URL parameter used by addMediaFromUrl(); this can be unauthenticated or authenticated depending on how the host application exposes the feature.
  • Trigger point: A server-side call to addMediaFromUrl() that performs an outbound HTTP request to the user-provided URL without sufficient validation or restriction.
  • Why exploitation is possible: The library trusts the supplied URL and forwards it to an HTTP client, allowing requests to arbitrary schemes, hosts, or IP addresses reachable from the server, including internal or non-public endpoints, without enforcing a safe network boundary.

Why this happens

The underlying bug class is server-side request forgery (SSRF), as described in CWE-918.

The addMediaFromUrl() method accepts URLs derived from user input and initiates outbound HTTP requests without adequately constraining the destination.

From an abstract perspective, this is an insecure pattern where:

  • Untrusted input is directly embedded into a network request.
  • There is no robust allowlist of permitted hosts or networks.
  • URL-parsing and scheme/host validation either do not exist or are insufficient to prevent access to internal resources.

As a result, the application server becomes an unintended HTTP proxy capable of reaching targets that users cannot directly access.

Potential impact

  • The application may be used to send HTTP requests to internal network services (e.g., internal APIs, admin dashboards, monitoring systems).
  • Attackers could query cloud metadata services to retrieve credentials, tokens, or other sensitive configuration.
  • Internal HTTP-based services can be probed for open ports, endpoints, or misconfigurations, aiding further attack chains.
  • Sensitive data reachable over HTTP (status pages, diagnostics, configuration endpoints) may be exposed to remote attackers.
  • If internal endpoints allow state-changing operations via HTTP, attackers could trigger unintended actions (e.g., configuration changes, job executions) through crafted requests.

General mitigation guidance

Effective mitigation centers on tightening trust boundaries for outbound HTTP requests and restricting URL inputs:

  • Introduce a strict allowlist of permitted domains or hosts that addMediaFromUrl() can contact, and enforce it before any request is issued.
  • Apply robust URL validation that:
  • Resolves hostnames and rejects private, loopback, link-local, and non-routable IP ranges.
  • Restricts to expected schemes (typically http/https) and disallows others.
  • Implement network-level controls such as firewall rules, egress filters, or service meshes to prevent the application server from reaching sensitive internal or metadata addresses.
  • Treat all URLs as untrusted input:
  • Normalize and re-parse them server-side.
  • Avoid passing user-supplied URLs directly into HTTP clients without sanitization or policy checks.
  • Where possible, design the application to minimize reliance on user-provided remote URLs, preferring controlled upload mechanisms or curated sources.

How teams detect issues like this

Organizations can identify and monitor SSRF risks through a combination of code-centric and operational measures:

  • Static analysis and code review:
  • Search for usages of addMediaFromUrl() and similar APIs that accept URLs from request parameters or user-controlled sources.
  • Flag patterns where URLs are passed directly from controllers, request DTOs, or form fields into outbound HTTP clients without validation.
  • Review for absence of allowlists or IP range checks around outbound request construction.
  • Security testing and fuzzing:
  • Perform dynamic application security testing (DAST) using crafted URLs targeting internal IP ranges (e.g., 127.0.0.1, 169.254.169.254, RFC1918 ranges) to observe server behavior.
  • Use test environments with instrumented logging to detect unexpected internal or metadata requests.
  • Policy and tooling:
  • Enforce secure coding guidelines that prohibit direct use of untrusted URLs in HTTP clients.
  • Leverage automated code review tools or CI hooks that identify SSRF patterns, particularly around media or file fetching functionality.

Sources

SourceLink
github.comgithub.com/spatie/laravel-medialibrary/commit/608ea03703d3887c46434f5dda6af56de6346aba
github.comgithub.com/spatie/laravel-medialibrary/pull/3939
github.comgithub.com/spatie/laravel-medialibrary/releases/tag/11.23.0
vulncheck.comvulncheck.com/advisories/spatie-laravel-media-library-ssrf-via-addmediafromurl

Frequently asked

questions

Yes, if an internet-facing endpoint allows users to supply URLs that are passed to addMediaFromUrl(), a remote attacker can attempt SSRF by providing carefully crafted URLs. Exploitability is constrained by how the feature is exposed and what network destinations are reachable from the server.

The attacker needs the ability to influence the URL parameter used by addMediaFromUrl(). This might be unauthenticated (e.g., a public form that accepts remote media URLs) or require authentication (e.g., an admin-only feature), depending on the host application's design.

The most robust fix is to introduce a strict outbound request policy:

  • Allow only specific, trusted hosts or domains for addMediaFromUrl().
  • Implement URL and IP validation before performing any request.
  • Combine application-level controls with network-level egress restrictions so that even unexpected calls cannot reach sensitive internal services.

To prevent SSRF, treat all user-supplied URLs as untrusted, enforce domain and network allowlists, and ensure that outbound HTTP requests cannot reach internal or metadata endpoints by default. Incorporate SSRF checks into secure coding standards, perform regular code reviews focusing on outbound HTTP usage, and use automated analysis tools to flag risky patterns early in the development lifecycle.

Find out what's already
exploitable in your codebase.