Say you have a website which takes file uploads of a certain type and places them in a subdirectory (let's call it "videos") in the web root.
I have heard from various sources that trusting uploaded files is never safe, because a payload can be uploaded and executed, even if you check the file extension. Ideally, you should check the whole file (which could slow down the system if the uploaded file is a huge video file).
So my question is - is it still unsafe with the following configuration?
You handle the upload with POST requests to a PHP script which checks the file extension and renames the file, then places the file in the subdir "videos".
Let's say the subdirectory "videos" is protected like this (nginx):
location ~ /(videos/|admin-stuff|etc) { deny all; }
When the files are placed in the directory, they have -rw-r--r--
permissions. If I understand correctly, the files cannot be accessed/executed by any means.
Is it still a vulnerability?
Thanks.