适用所有用UC整合

阿里云提示漏洞:

discuz中的/api/uc.php存在代码写入漏洞,导致黑客可写入恶意代码获取uckey,..........

 

漏洞名称:Discuz uc.key泄露导致代码注入漏洞


补丁文件:/api/uc.php

补丁来源:云盾自研

 

解决方法:
找到文件/api/uc.php​ 中的以下代码:

$configfile = substr($configfile, -2) == '?>' ? substr($configfile, 0, -2) : $configfile;

大概216行,替换成以下:

$configfile = preg_replace("/define\('UC_API',\s*'.*?'\);/i", "define('UC_API', '".addslashes($UC_API)."');", $configfile);

更新代码后,在阿里云后台这条漏洞后面点“验证一下”,即可看到这条漏洞补上就没有了

 

 

 

 


 科普一下:PHP addslashes() 函数


 在每个双引号(")前添加反斜杠:

<?php 
$str = addslashes('Shanghai is the "biggest" city in China.');
echo($str); 
?> 

结果:Shanghai is the \"biggest\" city in China.

 

相关文章:

  • 2021-09-10
  • 2021-11-29
  • 2022-12-23
  • 2021-09-27
  • 2021-05-21
  • 2021-05-02
  • 2021-10-17
猜你喜欢
  • 2021-11-28
  • 2022-03-05
  • 2022-12-23
  • 2021-10-15
  • 2021-11-28
  • 2022-02-23
相关资源
相似解决方案