duanliang8464 2012-02-13 13:16
浏览 8
已采纳

PHP安全信息?

Let's say I have a website where

  • PHP 5.3 is installed
  • every output is htmlspecialchars()ed.
  • PDO and prepared statements are the only way to interact with the database
  • error_reporting() is off
  • every request is passed to index.php (front controller) and no direct file access is allowed except for index.php via .htaccess
  • every input is properly escaped (why should I? i use Prepared statements, how could an user input mess up with my code?)
  • there's no use of evil()

Is it considered safe? What other things could be fixed to improve security? How could you attack it? Hack it? PHP/Server side is possible to improve security?

  • 写回答

7条回答 默认 最新

  • douhuantui6259 2012-02-13 13:21
    关注

    Check this page : PHP Security Guide. Most attacks are documented. If after implementing these security checks, you're still hacked, there are high chances that the problem doesn't come from your PHP application.

    By the way, as @Jacco stated, there is some wrong stuff on the article I linked to.

    1. Use prepared statements instead of mysql_real_escape_string(), but you already did that.
    2. About salting, follow this answer instead : https://stackoverflow.com/a/401684/851498
    3. Finally, checking ['type'] (for file upload) is unsafe since a malicious user can change this value. Instead, see the suggested solution of this link : http://www.acunetix.com/websitesecurity/upload-forms-threat.htm
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法