← PHP / Laravel · Contents

PHP-018 / Advanced

SSRF: server requests a user-specified URL

A10:2021 Server-Side Request Forgery · CWE-918 SSRF

Why is this a problem?

Internal networks are accessible, including 169.254.169.254 metadata and localhost administration APIs.

How to fix it

php
$endpoint = config('integrations.endpoints')[$serviceId] ?? null;
abort_if($endpoint === null, 422);
Http::withoutRedirecting()->get($endpoint);

Further reading