Linked Questions

3 votes
6 answers
28k views

Use PHP to check uploaded image file for malware?

I want my users to be able to upload a photo. Currently I am not checking the uploaded photo for problems of any kind, although I do limit the size to 32k. Is there any way for me to check uploaded ...
Frank E's user avatar
  • 113
8 votes
5 answers
2k views

How should I serve untrusted / unsanitized documents (PDF, DOC, XLS) to end users over the web?

My website will be hosting documents for end users and I would like to make this as secure as possible. Question Assuming that I have a need to share documents on a website that may contain hostile ...
makerofthings7's user avatar
22 votes
4 answers
14k views

Is it safe to serve any user uploaded file under only white-listed MIME content types?

Let's say I develop an application that, Allows any user to upload a file of only white listed mime content type and extensions (word and pdf). Serves those files with the allowed extension and ...
Andy's user avatar
  • 535
20 votes
4 answers
3k views

Is it safe to store and replay user-provided mime types?

If a user uploads a file but modifies the request by setting the mime-type to something arbitrary, like "superdangerous/blackhatstuff", is it safe for me to send the same mime type back to a different ...
Mark E. Haase's user avatar
2 votes
4 answers
3k views

Security risks of hosting user-supplied images?

I have a program that will accept and fetch images from urls. It will check if the extension is .png, .jpg, etc... I will fetch these files and store them, they will be shown to users in a gallery (...
Lucas Kauffman's user avatar
29 votes
3 answers
17k views

How can I be protected from pictures vulnerabilities?

I've just read this question What is the corrupted image vulnerability? How does it work? (GIFAR, EXIF data with javascript, etc..) I'm asking myself how can I protect myself and my website's users. ...
xun's user avatar
  • 393
20 votes
3 answers
23k views

Does X-Content-Type-Options really prevent content sniffing attacks?

In Tangled Web Michal Zalewski says: Refrain from using Content-Type: application/octet-stream and use application/binary instead, especially for unknown document types. Refrain from returning ...
Andrei Botalov's user avatar
14 votes
3 answers
26k views

Is it possible to inject HTML into image to provoke XSS?

Some answers mention that it's possible to inject attacker-controlled HTML into images and therefore provoke XSS. I guess that this HTML will be processed by browser only if hole exists in browser. ...
Andrei Botalov's user avatar
8 votes
3 answers
3k views

How to safely allow upload of executable files [duplicate]

I need help regarding file uploading. In one of my projects the client wants to allow a file upload without restrictions on the file type. But I'm afraid that then users can upload executable files ...
Ravi's user avatar
  • 89
1 vote
2 answers
448 views

Malware prevention of data received in a POST endpoint

Problem Having one HTTPS api which has an endpoint i.e POST data how can we prevent/check that the data received is not malicious or possibly detrimental? To consider (please read) POST data receives ...
Federico Baù's user avatar
16 votes
1 answer
17k views

Preventing Server-Side Request Forgeries in Java

The application lets users specify a URL for their profile picture. It fetches the data from the URL and saves it on the server. However, the app is vulnerable to server-side request forgery (SSRF) - ...
paj28's user avatar
  • 33.4k
2 votes
1 answer
639 views

How confident is MIME blacklisting on a proxy server?

We are blacklisting a number of MIME types on our proxy server so users can't download certain file types, for example, executables. Could it be possible that somehow, a malicious server can trick a ...
lithium's user avatar
  • 23