Jump to content

Recommended Posts

Hello,

 

I'm aiming to a create a small-sized file hosting website. Of course the main idea for me is security. Would simply changing the chmod to directory to only allow read access prevent from any executions? Are there any exploits for this?

 

Also, what would be the best approach to use to keep file names in tact, but not copy/write over any other files? How do upload websites achieve the (virtual?) directory structures such as: example.com/10t/yourfile.pdf

Link to comment
https://forums.phpfreaks.com/topic/267937-file-hosting-site/
Share on other sites

For the file names just have a user having to register before uploading a file. Then set a var that randomises a url and set another function making sure that each url isnt the same. if a post is say like hasent been visited for 5months delete it

 

I'm not even looking to have users to register. Simply go to the website. Upload. Link.

Link to comment
https://forums.phpfreaks.com/topic/267937-file-hosting-site/#findComment-1374809
Share on other sites

Hydrian: I'm really curious as to why you believe adding a completely unrelated set of functions will help on the security of an upload script? In other words, when making statements like these you need to explain why you think it would make it easier.

 

N-Bomb: The basic stuff you have to verify is filenames, paths, MIME-types and that the files are actually of the type they are reported as. Exactly how you do that latter part really depends upon the filetype, and what you want to allow your users to upload. Ranging from extremely simple (pure text files), to the more convoluted (executables, images and such).

If you want to allow your users to upload any arbitrary file, then you really need to keep your tongue straight. Mostly because it would be trivial to take control over your server, if the users can get to the files outside of your download controller. Which means that you cannot permit direct linking to the file, at least not without ensuring that there is no possible way for the web server to try to parse anything within the folder. It's much easier to just have the uploaded files outside of the web root, and have a PHP file that reads the file's contents and prints it to the browser. Along with the correct headers, of course.

 

In any case, you do have some reading up to do. ;)

Link to comment
https://forums.phpfreaks.com/topic/267937-file-hosting-site/#findComment-1375357
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.