← PHP / Laravel 목차

PHP-017 / 기초

오픈 리다이렉트 (redirect($request->input('next')))

A01:2021 Broken Access Control · CWE-601 URL Redirection to Untrusted Site

왜 문제가 될까요?

피싱 페이지로 사용자를 보낸다.

이렇게 수정하세요

php
$next = $request->input('next');
return redirect()->intended('/home');  // 또는 내부 경로만 허용
// 검사: parse_url($next, PHP_URL_HOST) 가 null 이고 '/'로 시작할 때만

더 읽기