Skip to content

MIR0805

TaintedHeader

User-controlled input reaches header(), risking response splitting or an open redirect.

<?php
header('Location: ' . $_GET['next']); // TaintedHeader

Validate the value against an allowlist, or redirect only to known paths.

<?php
$allowed = ['/home', '/account'];
header('Location: ' . (in_array($_GET['next'], $allowed, true) ? $_GET['next'] : '/home'));