Question on security of images run through imagemagick
Posted: 2012-10-31T13:35:56-07:00
I am a web developer, and I have a question.
I am building a page for a customer where visitors can upload images to the customer's server. Once an image has been uploaded, I will then have imagemagick resize the image and rename it. My development hosting is on godaddy, and my customer's site is on powweb. I am taking the necessary precautions (using captcha, checking mime type, etc.) to try to avoid malicious code from being uploaded. However, a very clever hacker could get around these precautions.
Here is my question. If a visitor uploaded malicious code disguised as an image, would imagemagick recognize that the file is malicious (and not execute the file), or would it cause the code's execution by trying to open and resize the infected file?
I guess what it boils down to is whether or not imagemagick will increase, decrease, or cause no change to the inherent security issues involved in allowing visitors to upload files to the web server.
As a side note: The customer will be downloading the user-uploaded images and scanning them all with AVG before using them on his own computer.
I am building a page for a customer where visitors can upload images to the customer's server. Once an image has been uploaded, I will then have imagemagick resize the image and rename it. My development hosting is on godaddy, and my customer's site is on powweb. I am taking the necessary precautions (using captcha, checking mime type, etc.) to try to avoid malicious code from being uploaded. However, a very clever hacker could get around these precautions.
Here is my question. If a visitor uploaded malicious code disguised as an image, would imagemagick recognize that the file is malicious (and not execute the file), or would it cause the code's execution by trying to open and resize the infected file?
I guess what it boils down to is whether or not imagemagick will increase, decrease, or cause no change to the inherent security issues involved in allowing visitors to upload files to the web server.
As a side note: The customer will be downloading the user-uploaded images and scanning them all with AVG before using them on his own computer.