Whenever end users post something to your server, there is a chance of malicious behavior. Although it is unlikely that double-clicking on the .jpg image will close your box, unknown things are known to happen. (For example, who knew that PDF files could contain so many security issues!)
Itβs best to try uploading the image and see if the GDI + libraries are recognized as a valid image. If you do not get an exception at runtime, then you know that the image is "valid." This, however, will not protect you if uploading an image to GDI + does not decorate your box in the first place.
You can protect yourself even more by uploading the image to a separate AppDomain, but at the same time it reduces the potential threats.
source
share