I've been tasked with allowing users to upload files to a webpage, and then other users can download that file.
The file format is a custom one, for this example I'll just call it .ccx
. This is opened by our own custom software. The idea is, users can upload tutorial files to share with each other.
However, I'm concerned that someone could engineer a .ccx
file to implant a virus on the users computer. This could have a very negative impact on our site if ever such a file was engineered, users would become fearful of downloading, and our competitors might use that to take advantage of us.
How can I as a web developer make sure that uploaded files are safe? I know it's not possible to be 100% sure, but I want to improve on currently being 'very unsure'.
Also, in our custom software, what steps can be taken to ensure that the .ccx
file wont cause harm to the users computer (A Windows program written in C++)? I'm talking about the exe
equivalent of an SQL injection.
Thanks for all answers.
On the server, you can run any command line virus scanner over them and have them look for known virus signatures. However, it is questionable whether this will improve security: since the virus writers would need to taylor your format, it doesn't seem very likely that their malicious files would match any known signatures, secondly you have the risks of false positives, causing otherwise valid uploads to be rejected.
You need to make your client app's handling of the file format as secure as possible. This means:
You can never be 100% sure that your code is secure. So better take some precautions: