{"id":4979703,"date":"2014-06-04T21:09:59","date_gmt":"2014-06-04T21:09:59","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/uploaded-files-not-checked-for-filetype\/"},"modified":"2016-08-21T21:15:08","modified_gmt":"2016-08-21T21:15:08","slug":"uploaded-files-not-checked-for-filetype","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/uploaded-files-not-checked-for-filetype\/","title":{"rendered":"Uploaded files not checked for filetype"},"content":{"rendered":"<p>Basically, a malicious user could write a testimonial, upload a virus, and use the url to spread the virus elsewhere. Effectively, the site would be hosting malware.<\/p>\n<p>On a site where I have used this, I have added a couple lines of code testing whether the file really is a jpeg:<br \/>\n\t\t\t<code>$image_mime_type = exif_imagetype($_FILES[&#039;pts_photo&#039;][&#039;tmp_name&#039;]);<\/code><\/p>\n<p>I added that to  pts_front_add_testimonial() and updated this line:<br \/>\n\t\t\t`if ( (strtolower($_ext) == &#8216;jpg&#8217; || strtolower($_ext) == &#8216;jpeg&#8217;)<br \/>\n\t\t\t\t&amp;&amp; ( $image_mime_type == 2) )<br \/>\n.<br \/>\n.<br \/>\n.<br \/>\n`<br \/>\nBut I wonder if the plugin author shouldn&#8217;t update the code to make this more secure.<\/p>\n<p>https:\/\/wordpress.org\/plugins\/premium-testimonials\/<\/p>\n","protected":false},"template":"","class_list":["post-4979703","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4979703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4979703\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4979703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}