<p>I have a folder in my web server used for the users to upload photos using an ASP page.</p>

<p>Is it safe enough to give IUSR write permissions to the folder? Must I secure something else?
I am afraid of hackers bypassing the ASP page and uploading content directly to the folder.</p>

<p>I'm using ASP classic and IIS6 on Windows 2003 Server. The upload is through HTTP, not FTP.</p>

<p>Edit: Changing the question for clarity and changing my answers as comments.</p>

[{'answer_id': 22595, 'author': 'Ben Williams', 'author_id': 2453, 'author_profile': 'https://Stackoverflow.com/users/2453', 'pm_score': 1, 'selected': False, 'text': '<p>How will the user upload the photos? If you are writing an ASP page to accept the uploaded files then only the user that IIS runs as will need write permission to the folder, since IIS will be doing the file I/O. Your ASP page should check the file size and have some form of authentication to prevent hackers from filling your hard drive.</p>\n\n<p>If you are setting up an FTP server or some other file transfer method, then the answer will be specific to the method you choose.</p>\n'}, {'answer_id': 24401, 'author': 'chrisofspades', 'author_id': 2614, 'author_profile': 'https://Stackoverflow.com/users/2614', 'pm_score': 0, 'selected': False, 'text': '<p>You\'ll have to grant write permissions, but you can check the file\'s mime type to ensure an image.  You can use FSO as so:</p>\n\n<pre><code>set fs=Server.CreateObject("Scripting.FileSystemObject")\nset f=fs.GetFile("upload.jpg")\n\'image mime types or image/jpeg or image/gif, so just check to see if "image" is instr\nif instr(f.type, "image") = 0 then\n   f.delete\nend if\nset f=nothing\nset fs=nothing\n</code></pre>\n\n<p>Also, most upload COM objects have a type property that you could check against before writing the file.</p>\n'}, {'answer_id': 49821, 'author': 'pilif', 'author_id': 5083, 'author_profile': 'https://Stackoverflow.com/users/5083', 'pm_score': 3, 'selected': True, 'text': "<p>also, I would recommend not to let the users upload into a folder that's accessible from the web. Even the best MIME type detection may fail and you absolutely don't want users to upload, say, an executable disguised as a jpeg in a case where your MIME sniffing fails, but the one in IIS works correctly.</p>\n\n<p>In the PHP world it's even worse, because an attacker could upload a malicious PHP script and later access it via the webserver.</p>\n\n<p>Always, always store the uploaded files in a directory somewhere outside the document root and access them via some accessing-script which does additional sanitizing (and at least explicitly sets a image/whatever MIME type.</p>\n"}, {'answer_id': 77635, 'author': 'user14094', 'author_id': 14094, 'author_profile': 'https://Stackoverflow.com/users/14094', 'pm_score': 0, 'selected': False, 'text': "<p>Your best bang for the buck would probably be to use an upload component (I've used ASPUpload) that allows you to upload/download files from a folder that isn't accessible from the website.  </p>\n\n<p>You'll get some authentication hooks and won't have to worry about someone casually browsing the folder and downloading the files (or uploading in your case), since the files are only available through the component.</p>\n"}]
['https://Stackoverflow.com/questions/22519', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2385/']