I am writing a small PHP application and I am not sure if I have a security problem. So this is what the application does:
- the user can upload image files (png, gif, jpg, jpeg, tiff and several others) or zip files
I check the mime type and extension, and if this is not allowed, I will not allow the download (this is not the part I'm worried about).
Now, after downloading, I rename the file to a unique hash and save it in a folder outside of root access.
The user can now access the file through a short URL. I make the file accessible by setting the correct mime type for the header, and then just use readfile ().
My question is, does the exploit work here where the jar file is included in the image file? I serve the image as a clean image.
Should this be a way to prevent this?
Thanks.
source
share