PHP文件上传,是安全的? [英] PHP File upload, Secure?

查看:207
本文介绍了PHP文件上传,是安全的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我想要的用户能够:

This is what I want an user to be able:


  • 上传任何文件到服务器(附件)的文件夹上传

  • 可以事后下载

所以我创造了这个目录有以下的.htaccess

So I have created this dir with the following .htaccess

Allow from all
DirectoryIndex .x
php_flag engine off
Options -Indexes
Options -ExecCGI
AddType text/plain .html .htm .shtml .php .php3 .php5 .phtml .phtm .pl .py .cgi
ForceType applicaton/octet-stream

我的问题是,这是安全的?

My question is, is this secure?

推荐答案

我想说:没有

如果你拒绝所有访问,并通过该deliveres文件的脚本管理下载它应该是更安全。
此外,您应该重命名这些文件,以便有例如没人把他自己的htaccess或什么的。
原来的文件名就可以在数据库存储。

It should be more secure if you deny access from all and manage the download via a script that deliveres the files. Furthermore you should rename the files, so that there e.g. nobody places his own htaccess or whatever. The original filenames you can store in a DB.

为什么:你永远不会知道未来会发生什么,有些文件之后能得到的可执行文件,别的地方你把一个不安全的脚本,使用户可以包括那些上传的文件,等等。

Why: You will never know what happens in the future, some files can later get executable, somewhere else you place an insecure script that allows users to include those uploaded files, and so on.

这篇关于PHP文件上传,是安全的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆