关于$_REQUEST['GLOBALS']的一些分析

当php.ini里面的register_globals=on时,各种变量都被注入代码,例如来自 HTML 表单的请求变量。再加上 PHP 在使用变量之前是无需进行初始化的。那么就有可能导致不安全,假如有人恶意发出这么一个get请求"http://yourdomain/unsafe.php?GLOBALS=",那么就会清除$GLOBALS变量的值而导致不安全。所以我们可以这样子写

if ((isset($_REQUEST['GLOBALS']) OR isset($_FILES['GLOBALS'])) AND ini_get('register_globals')) { 
        die(globals overwrite attempted.);
 }

猜你喜欢

转载自blog.csdn.net/xiaoxinshuaiga/article/details/80212445
今日推荐