in reply to security issues for allowing images to be uploaded to the server

There a number of security issues which can be raised by allowing files to be uploaded to a web server, but the majority of these security issues relate to how the files are used after being uploaded, rather than the action of uploading the file itself. Some of these issues can be addressed through the careful vetting and validation of the uploaded file prior to use or employ in other process or business applications. These issues have been raised for discussion on PerlMonks in previous posts here, here, here and here.

It was with these issues in mind that I wrote the CGI::Upload module - This module incorporates methods for validating the supplied file name and file content, the latter of which is particularly important as it is relatively trivial for a malicious user to rename a file to incorporate an 'allowed' file extension prior to upload. Further to this, I would recommend defining the $CGI::POST_MAX as recommended by the CGI::Safe module by Ovid within your upload script to set a ceiling on the size of uploaded files.

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001001010110"))'

  • Comment on Re: security issues for allowing images to be uploaded to the server
  • Download Code