|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-03-19 19:16 UTC] rasmus@php.net
[2013-03-19 19:16 UTC] rasmus@php.net
-Status: Open
+Status: Analyzed
[2013-03-19 19:38 UTC] dm@php.net
[2013-03-19 20:58 UTC] rasmus@php.net
[2013-03-22 16:56 UTC] dm@php.net
[2013-03-22 16:59 UTC] rasmus@php.net
-Package: Apache2 related
+Package: Documentation problem
[2016-06-20 15:27 UTC] cmb@php.net
[2016-06-20 15:27 UTC] cmb@php.net
-Status: Analyzed
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2016-06-20 15:27 UTC] cmb@php.net
[2020-02-07 06:07 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 22:00:01 2025 UTC |
Description: ------------ `HTTP_HOST` is the value from `Host` header, which can, naturally, be spoofed. On the other hand, `SERVER_NAME` and `SERVER_PORT` should reflect real values. I've tested some configurations and on majority you can at least change/spoof `SERVER_PORT`. This can lead to security issues since these environment variables are often trusted. Test script: --------------- <?php $ch = curl_init('http://smchiptuning.com/http_host.php'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: 127.0.0.1:1337')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); echo curl_exec($ch); curl_close($ch); /** http_host.php <?php var_dump($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']); */ Expected result: ---------------- string(16) "smchiptuning.com" string(2) "80" Actual result: -------------- string(9) "127.0.0.1" string(4) "1337"