If you have ever opened or executed any user-uploaded file on a server, you should expect your server to be at risk now.
Even jpg can contain php executable. If you include or require file in any way in your script, that could also endanger your server. The image you stumble upon the website was like that ...
header ('Content-type: image / jpeg');
header ('Content-Disposition: inline; filename = "test.jpg"');
echo file_get_contents ('/ some_image.jpg');
echo '<? php phpinfo (); ?> ';
... which you save and repost on your server like that ...
$ q = $ _GET ['q']; // pretend this is sanitized for the moment
header ('Content-type:' .mime_content_type ($ q));
header ('Content-Disposition: inline; filename = "'. $ _ GET ['q']. '"');
include $ q;
... will execute phpinfo() on your server. Then, users of your site can simply save the image to your desktop and open it using notepad to see your server settings. Simply converting the file to a different format will cancel this script and should not run any actual virus attached to the file.
It may also be best to do a virus scan at boot time. You should be able to make a built-in system command for verification and analyze its output to find out if it will find anything. Your site users should always check the files they upload.
Otherwise, even a virus containing a user-uploaded file just sitting on your server should not do anything harm ... as far as I know.
source share