Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am creating a secure document portal for a client. One of the things that they are worried about is having someone upload a document with a virus. One solution that might work is to enforce that they only upload pdf files.

My question is two fold:

  1. Most importantly, is a pdf document virus proof?
  2. How can you determine in a *nix environment that a file is a pdf, besides just looking at the extension.

Thanks!

Jonathan

share|improve this question

migrated from stackoverflow.com May 17 '10 at 19:48

This question came from our site for professional and enthusiast programmers.

    
Welcome to Stack Overflow! However this is more of a SuperUser.com question (sister site aimed at non-programming questions). –  Schnapple May 17 '10 at 19:44
    
For #2, are you talking about code determining this, or a user? IE, are you wondering how to write something to determine if the file is a PDF (good for Stack Overflow), or how to use a program or other utility to do the determination (good for SuperUser)? –  Beska May 17 '10 at 19:47
    
The simple answer is: NO. There is no such thing as utterly virus-proof. Any door can be broken, any lock picked by someone who has enough time, money and/or effort to throw at it. –  eidylon May 17 '10 at 20:40

6 Answers 6

PDF's (and its readers) are certainly not immune to attacks (one example here; googling for pdf vulnerability or pdf arbitrary code execution should yield more).

In a *nix environment checking the file contents with file could be a start.

share|improve this answer
    
Lately with Adobe's Reader it could be called the Penetratable Document Format (not sure about Foxit). Reader has had problems like buffer overflows and JavaScript being enabled by default and they are releasing patches regularly now. –  Bratch May 17 '10 at 22:59

If I remember, Unix/Linux has a command called "file" that will tell you what type of file it is.

share|improve this answer
    
that did it! Thanks +1 –  Jonathan May 17 '10 at 19:53
  1. Theoretically, a PDF cannot contain any executable code; however, specially crafted PDF files can possibly get the viewer to run native code if there is a vulnerability in the viewer. Adobe (Acrobat) Reader, for example is notorious for buffer overflow issues. Each viewer will have its own set of vulnerabilities, and the most important thing is to keep the viewer updated.

  2. file myfile.pdf will print something containing PDF document.

share|improve this answer

PDFs are not inherently virus-proof. Like anything, if you know the vulnerabilities in a common reader for the file, you can put something in the file to exploit that, which can then download the main payload. Images (heck, image files on Mac have been infected), pdf, whatever, can be "infected" somehow, and lead to a virus.

On the second note, as somebody else said, there is a file command on Linux, that looks at the actual data in the file to tell you the filetype.

share|improve this answer

There was an article recently about PDFs being susceptible to viruses from any viewer; searching for the link.

http://it.slashdot.org/story/10/04/06/1434222/No-JavaScript-Needed-For-New-Adobe-Exploits

share|improve this answer

There are a variety of different ways that a hacker can attack a computer system. When you ask whether a pdf file is virus proof you probably lack the understanding of attack vectors to find important vulnerability in your own architecture.

It would be a good idea to talk about your design with an expert in computer security if you really need security.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.