← PHP / Laravel · 目次

PHP-018 / 上級

SSRF:利用者指定 URL へのサーバーリクエスト

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

なぜ問題になるのか?

内部ネットワーク(169.254.169.254 メタデータ、localhost 管理 API)にアクセスできます。

修正方法

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

参考資料