If it is a user controlled Location
header value then there could be a vulnerability.
e.g.
Regarding header injection, from the PHP doc:-
(since [PHP] 4.4.2 and 5.1.2) This function now prevents more than one header to be sent at once as a protection against header injection attacks.
source here.
For unvalidated redirects or forwards, say you had a page URL with another URL as a query string parameter. e.g.
http://www.example.com/redirect.php?url=account.php
If your script blindly redirected to account.php
then an attacker could email a URL to their victim in the form
http://www.example.com/redirect.php?url=http://www.evil.com
or obfuscated as
http://www.example.com/redirect.php?url=%68%74%74%70%3a%2f%2f%77%77%77%2e%65%76%69%6c%2e%63%6f%6d
if a user checks the domain before clicking, it appears to go to your www.example.com
website and appears safe, however as the page redirects to the attacker it is not and it could be a phishing attempt. If they make evil.com
look like example.com
then an unwitting user may not notice until it is too late and they have already entered their credentails.
In your case it looks like the Location
is not user controlled, so you should not be vulnerable to these attacks. However, make sure you call exit
after setting the header so you are not outputting extra unintended content that an attacker may use to their advantage.