![]() |
phUploader File Upload Vulnerability
I noticed this phUploader security issue at: SecurityFocus.
Below is a summary from: SecurityFocusArchives : Quote:
Great script, keep up the good work! |
It's not really a vunerability but rather an annoyance. If someone uploads a file with a special character you may not be able to delete it though FTP. Make sure you set file extensions to exclude file types that are prone to cause attacks suchs as exe, src etc as the script cannot tell if the file is an exploit. It may also be helpfull to run a virus scanner in the background like you shoud be doing on a server anyways.
To fix it do this: After (line 185): PHP Code:
PHP Code:
|
Sweet! I will do that! Thanks for the speedy reply.
|
I added the suggested code but encountered an error from the "\" section, which I replaced with "\\" to escape the escape character and avoid the error missing the double quote.
Then I reduced the code to test just file names with spaces, since I really need this feature... My sanitize line is now: $sanatize = array(" "); This was very easy to test by uploading file names with spaces. The program completed but it did not remove the spaces in the uploaded file names. Any ideas why? Can you verify this? Thanks! |
Oops, I forgot to mention that the "random_name" variable is set to false, so the code will be executed in the "Else" clause.
|
Sorry, I didn't test the above code before posting it as I was in a rush. I throughly tested this and it works. Remove any previous changes.
Replace: PHP Code:
PHP Code:
|
The new code will throw an error (see below), I think due to the back slash cancels the double quote (see fix below). However, I was not able to test my changes in the code.
It worked like a charm after the above change. I was able to test uploading a file with spaces and they were removed as expected. Thanks for your effort! Quote:
|
Weird!! it's the forums software that was removing my double back slash.. I knew I tested that code right before I posted it.
Glad it worked for you |
All times are GMT -5. The time now is 10:51 AM. |
Powered by vBulletin®