【BUG反馈】不能创建临时目录
赵楠
|
不能创建临时目录,请确认目录 /www/wwwroot/zentao/www/data/ 是否存在并有操作权限。
环境: 系统:ubuntu 18.04 面板:宝塔面板 + nginx + PHP 7.4 + mysql 5.7
软件:开源版12.5.3 错误文件:module/user/control.php 780行 错误内容:
public
function
login(
$referer =
'',
$from =
'')
{
/* Check if you can operating on the folder. */
$canModifyDIR =
true;
if(
$this->
user->
checkTmp() ===
false)
{
$canModifyDIR =
false;
$floderPath =
$this->
app->
tmpRoot;
}
elseif(!
is_dir(
$this->
app->
dataRoot) or
substr(
base_convert(@
fileperms(
$this->
app->
dataRoot),
10,
8),-
4) !=
'0777')
{
echo
$this->
app->
dataRoot;
exit;
$canModifyDIR =
false;
$floderPath =
$this->
app->
dataRoot;
}
这里权限检测为 777,如果该目录设置为777权限,则极有可能导致跨站攻击。或其他非nginx用户也可以修改改目录文件,或写入脚本,从而取得webshell。
个人认为应该只检测当前用户 rwx权限,而不应该检测 其他用户组与其他用户rwx权限。
建议修改:
is_dir(
$this->
app->
dataRoot) or
substr(
base_convert(@
fileperms(
$this->
app->
dataRoot),
10,
8),-
4,
2) !=
'07')
|
于涛 |
您好,非常感谢您的反馈,这块我们会记录反馈给相关研发部门,进行优化。您的建议对我们来说非常重要,作为感谢,我们会奖励您20个积分,请注意查收:)
|