From: ksharpe at kharysharpe dot com
Operating system: ALL
PHP version: 5.1.4
PHP Bug Type: Feature/Change Request
Bug description: Validating $_SERVER tampering
Description:
------------
I would like to propose a solution that will allow to test whether
$_SERVER (or similar ) predefined variables have been changed since PHP
initialized them.
string predefinedVarHash(string predefinedVar)
PHP at runtime, after variables have been initialized/loaded, would store
the serialized hash of the predefined variable that could be later
retrieved by the above function.
Reproduce code:
---------------
e.g.
<?php
$md5Hash = predefinedVarHash("SERVER");
if ($md5Hash !== md5(serialize($_SERVER)))
die('$_SERVER changed');
else
echo '$_SERVER has not been changed';
?>
Expected result:
----------------
This would allow us to validate the information stored in the variable,
while still allowing us to legitimately change the value of $_SERVER or
other predefind variables.
--
Edit bug report at http://bugs.php.net/?id=38171&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38171&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38171&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38171&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38171&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38171&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38171&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38171&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38171&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38171&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38171&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38171&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38171&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38171&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38171&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38171&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38171&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38171&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38171&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38171&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38171&r=mysqlcfg