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"))'


In reply to Re: security issues for allowing images to be uploaded to the server by rob_au
in thread security issues for allowing images to be uploaded to the server by jonnyfolk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.