Thank you for your reply.
A little background on what Im doing with file uploading.
1. Im allowing registered users to upload avatars for their own usage.
2. Im allowing image uploading for submitted articles by certain registered users.
3. And Im currently constructing a media gallery, where images, mp3, realaudio, etc can be presented/downloaded/streamed.


All 3 points are based on a file upload class that I put together. Of which each section has their own allowed set of mime-types,
based on what is supplied via $_FILES['xxx']['type']


An analogy that I have in mind is this.
Lets look at the file upload class as the Post Office. They practically allow any package to be delivered to anyone by anyone.
They do scrutiny checks on packages. Unfortunately, this one package, has a pipe bomb in it.
Its delivered to my mailbox, and poses a threat.
Now, is it the fault of the PostOffice for allowing that particular package through?
What else can this PostOffice do to tighten things up?


So Im at the point, where Im trying to figure out what else I can do to "tighten" scrutiny checks.
Concerning infecting the server, if the files are chmodded without the executable bit, shouldn't that be considered *safer*
It may seem that mime_content_type() isnt an option. I tried it on a flash file, and it reported it as text/plain.


What would really be cool, is a php extension to a virus scanner. (Hey can I dream)
Once again, thanks for your pointers/thoughts/comments.



Dan Anderson wrote:


There are some very good reasons to check a file's mime type.  For one
thing, if you send a user an executable when you meant to send them a
jpg, and that executable unleashes a virus, that is no good.  Not only
will noone visit your site if they know you are a source of viruses, you
may get sued for damages.  (Computers are expensive!)

Everything depends on how the file is used.  If, for instance, the only
person who will be downloading or handling the file will be the person
who uploaded it, everything should be fine.  (NObody's going to infect /
r00t their own computer intentionally).

But let's say you run the file yourself.  In that case, that file can
hurt your server.

So basically, if you don't check your files scrupulously a hacker can
and will do something evil.

-Dan



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to