TP5.0 控制器漏洞修复 ThinkCMF fetch漏洞修复

一 TP5.0控制器漏洞
重现方式:

     /?s=/admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=rhzzd.php&vars[1][]=$

效果:
会在index.php同级目录下生成rhzzd.php文件
修复:
thinkphp/library/think/App.php module方法 获取控制器名称那行下面 添加:

  if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
      throw new HttpException(404, 'controller not exists:' . $controller);
  }

二 ThinkCmf fetch漏洞
重现方式:

      /?a=fetch&templateFile=public/index&prefix=''&content=die(@file_put_contents('aaabbb.php','45454545'))

效果:
会在index.php同级目录下生成aaabbb.php文件
修复:
application/Common/Controller 将 HomebaseController.class.php 和 AdminbaseController.class.php 类中 display 和 fetch 函数的修饰符改为 protected

你可能感兴趣的:(TP5.0 控制器漏洞修复 ThinkCMF fetch漏洞修复)