PHP-079 / 中級
シンボリックリンク追跡による任意ファイル露出(public storage link)
なぜ問題になるのか?
アップロードディレクトリに作成した symlink が /etc を指す場合があります。
修正方法
php
$real = realpath($path);
abort_unless($real && str_starts_with($real, realpath(storage_path('app/uploads'))), 404);