Maison > Article > développement back-end > 测试PHP preg_match()函数信息泄露方法介绍_PHP教程
我们在使用
受影响系统:
PHP PHP
PHP preg_match()函数描述:
PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。
PHP所使用的preg_match()函数从用户输入字符串获得参数,如果所传送的值为数组而不是字符串就会生成警告,警告消息中包含有当前运行脚本的完整路径。
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><span>*来源:David Vieira-Kurz </span></span></span></li> <li> <span>链接:http://marc.info/?</span><span class="attribute">l</span><span>=</span><span class="attribute-value">bugtraq<br></span><span>&</span><span class="attribute">m</span><span>=</span><span class="attribute-value">125415056222332</span><span>&</span><span class="attribute">w</span><span>=</span><span class="attribute-value">2</span><span> </span> </li> <li class="alt"> <span>*</span><span class="tag">></span><span> </span> </li> </ol>
PHP preg_match()函数测试方法:
临时解决方法:
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><span> ?PHP </span></span></span></li> <li><span>if(isset($_GET['page'])) { </span></li> <li class="alt"> <span>if (is_array($</span><span class="attribute">page</span><span> = $_GET['page'])) { </span> </li> <li> <span>$</span><span class="attribute">casted</span><span> = (string)$page; </span> </li> <li class="alt"><span>} else { </span></li> <li> <span>$</span><span class="attribute">page</span><span> = </span><span class="attribute-value">htmlspecialchars</span><span>($_GET<br>['page'],ENT_QUOTES,'UTF-8'); </span> </li> <li class="alt"><span>validate_alpha($page); </span></li> <li><span>} </span></li> <li class="alt"><span>} </span></li> <li><span>function validate_alpha($page) { </span></li> <li class="alt"><span>return preg_match("/^[A-Za-z0-9_-]<br>+$/ ", $page); </span></li> <li> <span>} </span><span class="tag">?></span><span> </span> </li> </ol>
厂商补丁:
目前厂商还没有提供PHP preg_match()函数出现漏洞的相关补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://www.php.net
http://localhost/cms/modules/system/admin.php?fct=users&op[]=
Warning: preg_match() expects parameter 2 to be string, array given in /htdocs/cms/include/common.php on line 105