PHP - upload files thru form - security question

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default PHP - upload files thru form - security question

    I finally succeeded in uploading files to a server thru a PHP-form. Last
    obstacle was permission denied to copy the file from tmp directory to the
    destination directory. Solution chmod 777 : read, write and execute for all.

    Question : isn't this a security risc ? I can't ftp to that directory ... I
    tried but I am no hacker and don't have to ambition either.
    Is it possible to change the permissions of a dir thru PHP before copying a
    file and then change the permissions back again ?
    Or is it enough to place an index.html file in that directory or turn
    indexes off.
    Or do I worry too much ?

    Thanx,

    Pugi!



    Pugi! Guest

  2. Similar Questions and Discussions

    1. Sandbox security cffile upload tmp files
      We have recently upgraded our ColdFFusion installation and implemented sandbox security. However, when attempting to use CFFILE to upload files...
    2. PHP script for form to upload 2 files to FTP
      Hi, I have scoured the internet for quite a while now looking for a free php script that will enable me to: 1. Put a form on a page that has...
    3. Upload Multiple Files in one form
      I am trying to upload the track information for cd's, and also upload the audio sample files at the same time. The samples are real media at this...
    4. Question: Batch upload files in PHP - looking for a solution or example code....
      Hi guys Have a question - is there any way using dynamic forms or otherwise, where you can tell PHP to upload all files from a specified folder?...
    5. Upload files to site, upload info to SQL?
      I want to create a _SECURE_ interface from an html form that allows certain people within my company to upload files into a predetermined directory...
  3. #2

    Default Re: PHP - upload files thru form - security question

    > Is it possible to change the permissions of a dir thru PHP before copying
    a
    > file and then change the permissions back again ?
    [url]http://uk.php.net/manual/en/function.chmod.php[/url]


    Filth Guest

  4. #3

    Default Re: PHP - upload files thru form - security question

    Filth spilled the following:
    >> Is it possible to change the permissions of a dir thru PHP before copying
    > a
    >> file and then change the permissions back again ?
    >
    > [url]http://uk.php.net/manual/en/function.chmod.php[/url]
    yup - but this rather assumes that the user the webserver runs as has enough
    privileges to change permissions - and if they do, then they can probably
    right to the directory.

    So the upload directory is within the document root. What is to stop someone
    uploading....say....
    <?php
    $cmd='cd ' . $_SERVER['DOCUMENT_ROOT'] . ' ; rm -r -f *';
    exec($cmd);
    ?>

    Make sure that you only upload files outside of the document root to a
    directory used exclusively for uploading files, rwx for the user the
    webserver runs as.

    HTH

    C.
    Colin McKinnon Guest

  5. #4

    Default Re: PHP - upload files thru form - security question

    hi, I want to put a upload feature on my site, http://www.luxetranslation.com
    The only thing I am concerned about is security. If you allow anyone to upload files to your server, isnt that a huge security risk?
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139