WordPress.org

Ready to get started?Download WordPress

Forums

Another WordPress Classifieds Plugin
[resolved] Way to Prevent Users From Uploading Images With Double Extensions (4 posts)

  1. MickeyRoush
    Member
    Posted 1 year ago #

    Pretty much what the title says. A user tried uploading an image that was something like 12.13.12.jpg

    I believe that's poor file name formatting anyways. Can't remember the exact details right now. But I do not allow files of any sort that have a double extension to be uploaded. Too many possibilities for something malicious to happen. Especially when some server configurations allow double extensions, meaning either can be interpreted as the legit file extension. I don't need anyone trying to upload something like script.php.jpg

    See here:
    http://httpd.apache.org/docs/2.2/mod/mod_mime.html#multipleext

    Is there any way you can create a warning message or something to that affect that if they try to upload a file with more than one literal period, that they need to rename the file. Message "The file you are trying to upload has more than one literal period/dot in the file name. This is improper format for uploading a file here. Please rename the file with only one literal period/dot so the system can determine if it is an acceptable file."

    Thanks!

    Also I tried posting this on your own forums, but every time I try to login, I get a 404 Not Found.

    http://wordpress.org/extend/plugins/another-wordpress-classifieds-plugin/

  2. awpcp
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mickey,

    I checked the forum--seems OK to me. Maybe you caught it at a bad time?

    For multiple extensions, the last extension wins (per the link you sent above). If they use a bad multiple extension (like foo.jpg.php), we flat out reject it. If they use a bad file with a fake image extension (like a PHP file named foo.jpg or foo.php.jpg), we reject it again because it doesn't meet the JPG format specifications.

    Bottom line: AWPCP is safe from this kind of attack--having these extra extensions is not an issue.

    If you have evidence to the contrary, I'd be interested in seeing it.

  3. MickeyRoush
    Member
    Posted 1 year ago #

    Hello, yes this is the second time I tried to login to your forums and got sent to a 404 Not Found page. I previously sent you a message via your contact form. That's okay, I can still read your forums. I'll just have to post here.

    Here you go:
    http://www.acunetix.com/websitesecurity/upload-forms-threat/

  4. MickeyRoush
    Member
    Posted 1 year ago #

    Also, I would like to mention that this is only a suggestion. If it's too much trouble don't worry about it. If my users make this mistake I can just go in there and edit the image file name myself. It's just a hassle to do so, and trying to explain it to them is out of the question.

    For any of my clients that only upload images, I create an .htaccess file to white-list what files can be access via HTTP. There's just too many possibilities to cover. A php file extension is not the only executable file on most of the web servers out there.

    I use something like this in .htaccess:

    Order Allow,Deny
    <FilesMatch "^[\w()+-]{1,99}\.(?i:jpe?g|png|gif)$">
    Allow from all
    </FilesMatch>

    There are other bad things that can be done with double extensions. Some of those "how to's" are on "White Hat" forums, which I think WordPress.org would frown upon me if I posted links to them on here.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic