dongmei3869 2017-07-06 12:17
浏览 41
已采纳

fswrite具有完整的777服务器协议。 安全?

I have a question about the security of a server when the 777 Permissions are open.

This is the code:

<?php
// collect the cookie - save the data 
if(!isset($_COOKIE["markertype"])) {
    echo "Cookie named markertype is not set!";
} else {
   echo "Cookie markertype is set!<br>";
   echo "Value is: " . $_COOKIE["markertype"];
   $file = 'newfile.txt';
   // Open the file to get existing content
   $current = file_get_contents($file);
   // Append a new person to the file
   $current .= $_COOKIE["markertype"];
   // Write the contents back to the file
   file_put_contents($file, $current);
}
?>

Basically the system allows users to do stuff in javascript, I then set a cookie in JS with some user information that they put in the system. I then send that to PHP via a cookie to store this information on the server. The problem was that the server didn't have the permission to write to a file, so i proceeded to give full 777 access to the entire directory.

I think this opens me up to full XSS attacks and more, what is my alternative or can i secure the server in a different way? the server is NOT mine, therefore I only have certain access.

  • 写回答

1条回答 默认 最新

  • douzhuangxuan3268 2017-07-13 21:02
    关注

    Yeah 777 does cause some security holes, however it can be used on a different directory on your server, for instance if you have a public_http folder, then make that 777 permissions then that is a HUGE issue, but instead you could make a non-public accessible folder full 777 and save your data to that.

    This still isn't 100% secure because really your data should be off-site or remotely stored in a database, but if it's just for research then that is fine.

    hope this helped. H

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么