Slashdot Mirror


Ask Slashdot: How Do You Automatically Sanitize PDF Email Attachments?

First time accepted submitter supachupa writes "It seems the past couple of years that spearfishing is getting very convincing and it is becoming more and more likely someone (including myself) will accidentally click on a PDF attachment with malicious javascript embedded. It would be impossible to block PDFs as they are required for business. We do disable javascript on Adobe reader, but I would sleep a lot better knowing the code is removed completely. I have looked high and low but could not find a cheap out of the box solution or a 'how to' guide for automatically neutralizing PDFs by stripping out the javascript. The closest thing I could find is using PDF2PS and then reversing the process with PS2PDF. Does anyone know of a solution for this that is not too complex, works preferably at the SMTP relay, and can work with ZIPed PDFs as well, or have some common sense advice for dealing with this so that once its in place, there is no further action required by myself or by users."

238 comments

  1. Foxit Reader? by Anonymous Coward · · Score: 5, Informative

    As far as I know, Foxit Reader strips out any JavaScript. The PDF readers in Chrome and Firefox also should do the same.

    1. Re:Foxit Reader? by MoFoQ · · Score: 3, Informative

      dang...I was about to say the same...

      but yea...best way to sanitize is by not using Adobe Acrobat (or Acrobat Reader).

      on OSX and many Linux distros have their own builtin viewer ("Preview" in OSX, and "Display" at least on Ubuntu).

      Also, you can probably use Google Apps to do the same as well.

    2. Re:Foxit Reader? by fuzzyfuzzyfungus · · Score: 5, Insightful

      That isn't really 'sanitizing', though: It's certainly good that you practice safe text on your computer; but if you are the mailserver guy, and may or may not have as much control as you'd like over the users and their filthy, weatherbug-encrusted, systems, you want to modify the file such that it no longer contains a potential payload, not merely use a reader that doesn't execute payloads.

    3. Re:Foxit Reader? by Anonymous Coward · · Score: 1

      weatherbug my god... that fucking thing is on everyone's computer now.. WHY? How does a simple application that polls maybe a few hundred bytes of information take so much fucking cpu? IT"S IMPOSSBLE!

    4. Re:Foxit Reader? by Anachragnome · · Score: 1, Flamebait

      "Also, you can probably use Google Apps to do the same as well."

      You aren't seriously suggesting using Google to address a security issue, are you?

    5. Re:Foxit Reader? by king+neckbeard · · Score: 2

      perhaps you could sanitize their systems by preventing them from running Adobe products.

      --
      This is my signature. There are many like it, but this one is mine.
    6. Re:Foxit Reader? by Anonymous Coward · · Score: 0

      Print them out, then spray them with a solution of Vioxx?

    7. Re:Foxit Reader? by Anonymous Coward · · Score: 1

      Why not?

      If you're on a Microsoft OS, it doesn't matter what else you do, your computer is pre-compromised.

      If you're not on Microsoft, Google Apps runs in a web browser context and has all the protections of the browser.

    8. Re:Foxit Reader? by thelukester · · Score: 2

      Nitro and foxit now display JavaScript. You can disable it in options. Unless you want to use old versions, your best bet is sumantraPDF.

    9. Re:Foxit Reader? by rioki · · Score: 1

      I think GP was mixing privacy and security...

    10. Re:Foxit Reader? by TheHonch · · Score: 1

      I use an iPad to read attachments from outsiders, works for word and excel-docs too

    11. Re:Foxit Reader? by TheRaven64 · · Score: 1

      Why not? Open the PDF locally, and if there's an exploit in the parsing code then it will infect your machine. Upload it to Google, and if there's an exploit in the parsing code then it will infect one of their machines. Of course, doing this with any PDF that had commercially sensitive information in it would be stupid...

      --
      I am TheRaven on Soylent News
    12. Re:Foxit Reader? by quantumghost · · Score: 1
      Why the hell would you spray them with a NSAID (aspirin/ibuprofen) analog that was withdrawn from the market because it had a slightly increased risk of mycardial infarction?

      If you want it gone, spray it with FOOF

    13. Re:Foxit Reader? by thejynxed · · Score: 2

      Because, ironically enough, the newer versions run embedded Adobe Flash for visual weather maps.

      --
      @Mindless Drivel: 100% of Twitter posts ever Tweeted.
    14. Re:Foxit Reader? by bwcbwc · · Score: 1

      Yeah, but if your sanitizing is defective in some way and you load into Adobe Reader, the remaining JS will still execute. With a reader that is incapable of running javascript, it doesn't matter.

      On the flip side, if you don't sanitize the JS and pass the file along to an unsuspecting 3rd party, they may get infected. So the best option seems to be to do both: try to strip JS from the files and use a reader that doesn't parse JS.

      --
      We are the 198 proof..
    15. Re:Foxit Reader? by turp182 · · Score: 1

      Corporate policy could enforce an alternative PDF reader. And everyone would be happy as PDF viewing would be a much nicer, faster, experience.

      --
      BlameBillCosby.com
    16. Re:Foxit Reader? by Anonymous Coward · · Score: 0

      If you're on a Microsoft OS, it doesn't matter what else you do, your computer is pre-compromised.

      And if you're on any other OS, you are pre-determined to constantly be asking the question "Hey, is this available on my OS?"

    17. Re:Foxit Reader? by Mashdar · · Score: 4, Informative

      I run a ghostscript shell script to print a PDF as a new PDF:

      gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=NEW_FILE.pdf -dBATCH OLD_FILE_1.pdf OLD_FILE_2.pdf

      In this case OLD_FILE_1.pdf and OLD_FILE_2.pdf will be combined into NEW_FILE.pdf. AFAIK this strips javascript.

    18. Re:Foxit Reader? by Anonymous Coward · · Score: 0

      Unfortunately, many organizations run SAP, and some SAP modules make use of PDF forms that only work with the branded Adobe product. Try telling the bean counters that their favorite Human Resources information application system for tax withdrawals suddenly needs to go back to paper forms. I predict you having a stapler thrown at your head.

    19. Re:Foxit Reader? by rwise2112 · · Score: 2

      As far as I know, Foxit Reader strips out any JavaScript. The PDF readers in Chrome and Firefox also should do the same.

      That ony prevents it running on the machine used to view it - it's still in the PDF. The best way is to either insist on PDF/X or convert to it. PDF/X does not allow active content such as scripting, etc.

      --

      "For every expert, there is an equal and opposite expert"
    20. Re:Foxit Reader? by amicusNYCL · · Score: 1

      That's a clever solution, instead of trying to convert it just print it to a file. I wonder if that would also remove form elements.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    21. Re: Foxit Reader? by Anonymous Coward · · Score: 0

      Maybe twenty years ago

    22. Re:Foxit Reader? by Anonymous Coward · · Score: 0

      Do you realize that one of the first jailbrake methods was using a pdf file?

    23. Re:Foxit Reader? by RockDoctor · · Score: 1

      If you want it gone, spray it with FOOF

      Ah, the good old corante.com "Pipeline". Always, always worth a return visit!

      Sir, you are a man after my own heart. Wanna burn some sand?

      --
      Birds are not dinosaur descendants;birds are dinosaurs, for all useful meanings of "birds", "are" and "dinosaurs"
  2. Tried and True by oldhack · · Score: 0, Offtopic

    Can't go wrong with chicken bone.

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
  3. Print to PDF by digitalhermit · · Score: 4, Informative

    The way I'd do it is to create a dummy printer driver that just writes to a file. Print the PDF to the dummy printer, which in turn creates a new PDF without all the junk.

    1. Re:Print to PDF by Anonymous Coward · · Score: 0

      The way I'd do it is to create a dummy printer driver that just writes to a file. Print the PDF to the dummy printer, which in turn creates a new PDF without all the junk.

      But don't you need to open it (thus potentially triggering javascript) to send the PDF to the printer? Under windows, at least. In Linux you could presumably just copy/pipe the file to the printer device?

    2. Re:Print to PDF by Kludge · · Score: 4, Informative

      Like
      lpr -P Cups-PDF file.pdf

    3. Re:Print to PDF by Em+Adespoton · · Score: 2

      The way I'd do it is to create a dummy printer driver that just writes to a file. Print the PDF to the dummy printer, which in turn creates a new PDF without all the junk.

      But don't you need to open it (thus potentially triggering javascript) to send the PDF to the printer? Under windows, at least. In Linux you could presumably just copy/pipe the file to the printer device?

      Do it via a service like Google Docs... ...At least it won't be infecting YOUR system.

    4. Re:Print to PDF by DJ+Jones · · Score: 5, Interesting

      Sadly a lot of PDF printers will retain javascript code even if you print it and re-assemble it back into a PDF. The problem lies in the fact that Adobe allows javascript to be embedded inside image objects and compressed blocks of PDF binary. It's not as simple as opening the file and stripping out anything that starts with . Code can be fired on almost any user event and it can be attached to almost any high-level object. It's not impossible to create a scrubber but it's a lot more complicated than you might think.

      I spent the better part of a week attempting to create a PDF scrubber at my office for this same reason. We had become victim to highly targeted attacks from PDF sources. I wrote a scrubber in PHP using an open-source PDF parser and a series of regular expressions to strip out any javascript. At the end of the day, I came very close to a working solution but I ran into issues with encrypted PDF's.

      The project was shelved in favor of making users open all external PDF's on a virtual server that was hardened and re-imaged every evening to prevent any malicious code from running rampant. That's the simplest solution.

    5. Re:Print to PDF by Anonymous Coward · · Score: 0

      Agreed, and for this reason I'd definitely not use Adobe products. At the simplest level, using something like pdftops to write to Postscript file. You could then extract the image objects, re-render them, and replace. I helped write some of the code (long obsoleted) for some early rasterizers and the Javascript doesn't survive :).

    6. Re:Print to PDF by fuzzyfuzzyfungus · · Score: 3, Interesting

      Out of curiosity, were you dealing with enough fancy-forms-and-interactive-nonsense type PDFs that the 'just brutally rasterize it and let them eat .jpeg!' option wasn't an option, or were the attackers good enough that you didn't have a PDF renderer you could trust for the rasterizing duties?

    7. Re:Print to PDF by Anonymous Coward · · Score: 0

      Maybe dumb question, not an expert - if I were to print to pdf (OS X), would the file thus created be stripped of embedded Javascript? Tnx.

    8. Re:Print to PDF by Anonymous Coward · · Score: 1

      Somewhat good solution.
      Problem: text fields are no longer editable. So all PDF files have to be signed/fileld manually.

    9. Re:Print to PDF by Anonymous Coward · · Score: 0

      Maybe if you learned to use any programming language you'd be able to do something constructive instead of trolling /. saying things that prove you're too stupid to live.

    10. Re:Print to PDF by rioki · · Score: 2

      Man, don't bash bash! It's awesome and most tools that do real work are written in C anyway. It is just the glue between small tools.

    11. Re:Print to PDF by Anonymous Coward · · Score: 0

      I wouldn't try writing this kind of thing in Perl or Bourne Shell either.

      I wouldn't write it in Perl either...

      It's probably on CPAN already.

    12. Re:Print to PDF by OptimalCynic · · Score: 1

      Not if the JS was embedded in images, I believe in that case it's not interpreted but it is preserved.

    13. Re:Print to PDF by ozmanjusri · · Score: 1

      pstotext [file] | less

      --
      "I've got more toys than Teruhisa Kitahara."
    14. Re:Print to PDF by nicolastheadept · · Score: 4, Funny

      Converting to JPEG? You're a terrible human being.

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    15. Re:Print to PDF by TheRaven64 · · Score: 1

      You need to run it through a PDF parser, and therefore potentially trigger bugs. There's nothing stopping you from doing this from a sandboxed process, so exploit code would be contained. You'd also want to make sure that it went through a simpler intermediate format that another sandboxed process could check. On the other hand, if you can do decent sandboxing, why not solve the problem properly and just sandbox the PDF reader so it can't access anything except the PDF that's passed into it?

      --
      I am TheRaven on Soylent News
    16. Re:Print to PDF by TheRaven64 · · Score: 3, Informative

      Stripping JavaScript isn't enough. For example, a number of 'PDF' exploits have actually been due to vulnerabilities in libpng: if your PDF contains a PNG image (a lot do), then it may have a metadata payload that triggers a bug in libpng that allows arbitrary code execution. The same can happen for embedded fonts and for embedded JPEG images.

      --
      I am TheRaven on Soylent News
    17. Re:Print to PDF by jimicus · · Score: 2

      Actually, you may have hit upon a pretty good idea there.

      Use ImageMagick to convert the PDF to PNG or TIFF then convert it straight back again.

      Potential drawbacks:

        - Would your mailserver now become the target for those attacks?

    18. Re:Print to PDF by Curupira · · Score: 1

      Posting to unmake an accidental "flamebait" mod. Nothing to see here, move along...

    19. Re:Print to PDF by lister+king+of+smeg · · Score: 1

      you could try piping the pdf through a postscript to pdf converter, that will often rip out older drm it might work on javascript

      --
      ---Saying gnome 3 is better than windows 8 not so much a compliment as it is damning with light praise.
    20. Re:Print to PDF by operagost · · Score: 1

      You forgot:
      - PDF is no longer searchable

      --

      Gamingmuseum.com: Give your 3D accelerator a rest.
    21. Re:Print to PDF by jimicus · · Score: 1

      I also forgot:

        - User complains that the email they sent and the email they received are subtly different.
        - Ethical implications even if the enduser never notices this. By all means scan email and use heuristics to say yay/nay, but futzing with the content so it appears to be what was sent but is in fact subtly different? Not Cool.

    22. Re:Print to PDF by mcrbids · · Score: 1

      Isn't it sad that somebody thought about putting javascript into PDF and concluded that it was a "good idea"?

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    23. Re:Print to PDF by amicusNYCL · · Score: 1

      The project was shelved in favor of making users open all external PDF's on a virtual server that was hardened and re-imaged every evening to prevent any malicious code from running rampant. That's the simplest solution.

      I'm not going to argue whether or not that's the simplest solution, but it makes me shake my head to think that Adobe has screwed up PDF so much that we need to put them in jail now to open them.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    24. Re:Print to PDF by youngatheart · · Score: 1

      Good points. I rather like the idea of something that removes every PDF from the incoming email but sends a follow up message "Your recent email with the subject line 'blah blah blah' sent at 'sentdate' had an unsafe type of attachment. You can download a safe version with 'this link' or you can contact the administrator if you require the unsafe version."

      I wonder if procmail could do that for you?

    25. Re:Print to PDF by jimicus · · Score: 1

      If it couldn't, MailScanner could, and probably pretty easily.

    26. Re:Print to PDF by fuzzyfuzzyfungus · · Score: 1

      Converting to JPEG? You're a terrible human being.

      I prefer to think of myself as 'The Rasterizer of the Unworthy'.

  4. Be careful modifying documents by Anonymous Coward · · Score: 5, Informative

    You can change the legality of a document for example by modifying it.

    A solution that modifies the PDF viewer is much better than one that alters the document. That means not using Adobe. Pity the company refuses to build a version that doesn't do Javascript in the first place.

    1. Re:Be careful modifying documents by macbeth66 · · Score: 4, Informative

      I believe that for a PDF document to be a legal document, it needs to be in PDF/A format. This format prohibits the use executable code, such as Javascript.

    2. Re:Be careful modifying documents by godrik · · Score: 4, Insightful

      Where does this belief comes from? Why would there be any format requirement on these things? The requirement would need to be in the law or in a court judgment. Is the law going to be that precise over electronic communications? (Not trying to bitch, just really wondering)

    3. Re:Be careful modifying documents by Aaron+B+Lingwood · · Score: 4, Informative

      I believe that for a PDF document to be a legal document, it needs to be in PDF/A format.

      Where does this belief comes from?

      Many states have legislation regarding the font, margins and paper sizes used for some legal documents.

      US courts, archivists and many case management / COPS systems only accept documents in PDF/A.

      --
      [Rent This Space]
    4. Re:Be careful modifying documents by Anonymous Coward · · Score: 0

      Semantics: "legal document"

      So there's a difference between a document for the legal system, and a legally binding document.

      The point being made in the parent posts is that court systems require documents to be filed that conform to various formatting, style, and technical guidelines. It seems PDF/A is a common requirement.

      For two parties to create a legally binding document, then I believe they would be free to use whatever format they wish.

    5. Re:Be careful modifying documents by Anonymous Coward · · Score: 0

      There is good reason for PDF/A: If your "contract" contains executable code you might have a hard time proving that what the other side saw when they agreed/signed was actually the thing that you submitted to the court now.
      Or another way to put it: If the court only accepts your contract in PDF/A but the document you have isn't in PDF/A then you'd have the interesting job of proving that what you submitted to the court is actually the same as the real contract.
      It doesn't make the contract not legally binding, you just might end up spending a lot of money to show what the contract actually says.

    6. Re:Be careful modifying documents by mounthood · · Score: 1

      Many states have legislation regarding the font, margins and paper sizes used for some legal documents.

      US courts, archivists and many case management / COPS systems only accept documents in PDF/A.

      Sadly, the ISO can't be counted on; it's "Office Open XML" again.

      http://en.wikipedia.org/wiki/PDF/A#PDF.2FA-3

      PDF/A-3 (ISO 19005-3:2012. Part 3) allows embedding of arbitrary file formats (such as XML, CSV, CAD, wordprocessing documents, spreadsheet documents and others) into PDF/A as complete archived objects.[9]

      --
      tomorrow who's gonna fuss
    7. Re:Be careful modifying documents by Anonymous Coward · · Score: 0

      The US courts require PDF/A, but it has nothing to do with security. PDF/A contains instructions for the fonts and sizes and some other things I was told but forget. PDF/A is required because any particular font can die out, but court documents must last presumably forever.

  5. Sumatra PDF by Anonymous Coward · · Score: 0

    Sumatra PDF:
    http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html

    It doesn't get nailed by viruses and security breaches like Adobe's PDF reader. And, it doesn't have adware in the installer like FoxIt. And, he releases updates regularly.

    I used to use FoxIt a long time ago, but have since switched to Sumatra. Never looked back, it does the job.

    1. Re:Sumatra PDF by X-Dopple · · Score: 2

      A big limitation of Sumatra is that it doesn't support filling out interactive forms, which makes it a no-go in my organization

    2. Re:Sumatra PDF by Em+Adespoton · · Score: 1

      A big limitation of Sumatra is that it doesn't support filling out interactive forms, which makes it a no-go in my organization

      If it fills in forms, it's a security risk. I seem to recall that there are a few that ignore forms and let you create companion files that do overprint forms on form-like fields though. Can't remember the names offhand.

    3. Re:Sumatra PDF by Em+Adespoton · · Score: 2

      Check out Sumatrapdf http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html. It's super fast and does not support javascript or actionscript in PDF's. I use it exclusively now.

      Is it vulnerable to font description overloading and the other PDF exploits out there? A large portion of the malicious PDFs I've seen lately didn't use forms or javascript containers as the main attack vector (usually shellcode via some markup bug).

    4. Re:Sumatra PDF by Anonymous Coward · · Score: 1

      They address what few security vulnerabilites exist in the software immediately, it's based on MuPDF library.

    5. Re:Sumatra PDF by Anonymous Coward · · Score: 0

      I used to use FoxIt a long time ago, but have since switched to Sumatra. Never looked back, it does the job.

      You did look back — how else would you have remembered that you used to use Foxit?

    6. Re:Sumatra PDF by znrt · · Score: 1

      A big limitation of Sumatra is that it doesn't support filling out interactive forms, which makes it a no-go in my organization

      an organization relying on filling out interactive pdf forms sounds quite like a no-go to me. can't you really come up with a better solution to get your shit together? besides, the topic is how to get rid of this pdf pest because of obvious security concerns. I don't see how insisting in bad practices could be of any help.

      here are my 50c: forget proprietary formats, forget any interactive or multimedia content requiring anything but a vanilla browser to view (yes, this includes html crap in emails), embrace the simplicity of plain text and mash up a secure webapp for anything beyond the capabilities of plain text.

    7. Re:Sumatra PDF by Anonymous Coward · · Score: 0

      +10.

      I install Sumatra whenever a windows user asks me 'how could i download/view this pdf file?'.

    8. Re:Sumatra PDF by Anonymous Coward · · Score: 0

      If I had mod points you would be getting them. I also use it and agree absolutely, its a great and super fast product.

    9. Re:Sumatra PDF by mjwx · · Score: 1

      Check out Sumatrapdf http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html. It's super fast and does not support javascript or actionscript in PDF's. I use it exclusively now.

      Sumatra PDF used to be light, a mere 800 KB, I just installed the latest version, a whopping 3.6 MB. It's suffering the same form of featuritis as the other PDF readers I dumped because they became slow and unwieldy (Adobe and Foxit).

      --
      Calling someone a "hater" only means you can not rationally rebut their argument.
    10. Re:Sumatra PDF by Anonymous Coward · · Score: 1

      an organization relying on filling out interactive pdf forms sounds quite like a no-go to me. can't you really come up with a better solution to get your shit together?

      Certainly! I could accept a multi-dozen thousand UKP fine and possible imprisonment from HM Revenue & Customs for refusing to complete the interactive PDF Corporation Tex return form ( CT600 ).

      What an alternative!

      Note: paper submissions are no longer accepted.

    11. Re:Sumatra PDF by Anonymous Coward · · Score: 0

      Sadly Sumatra PDF it's not compatible with PDF forms and we need them in our company. With that feature it could be the perfect choice.

    12. Re:Sumatra PDF by amicusNYCL · · Score: 1

      Sumatra PDF used to be light, a mere 800 KB, I just installed the latest version, a whopping 3.6 MB.

      Considering the size of Acrobat Reader, calling Sumatra "whopping" at 3.6MB sounds like a pretty good compliment.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    13. Re:Sumatra PDF by youngatheart · · Score: 1

      I'm with you in spirit but stuck in a situation where our single most important software vendor has incorporated interactive forms using Adobe PDF reader. Replacing it is so far beyond our budget that just discussing what it would take turns the discussion into a five year plan.

      Doing our own software to replace it is even worse in terms of budgeting. If you'd like to make yourself a couple million dollars and a career for the next twenty years, you can go for it, but the initial investment requirements are going to be in the same range and it'll probably take a minimum of five years for you to get a new system past all the regulatory hurdles and any adoption.

      If you do all that, drop me a line. We'll be looking for somebody new about that time.

      For people stuck in reality: Our solution is to try to be very suspicious of PDFs that come into the system, but trust the ones already in there. It's not a great situation to be in but I hope this forum will give me some ideas on how we can better protect ourselves from the potential dangerous PDFs coming in.

    14. Re:Sumatra PDF by shellster_dude · · Score: 1

      If you need PDF forms, then you just about have to live with the whole "dynamic content" package which is the security problem in the first place.

    15. Re:Sumatra PDF by Anonymous Coward · · Score: 0

      Sumatra PDF used to be light, a mere 800 KB, I just installed the latest version, a whopping 3.6 MB. It's suffering the same form of featuritis as the other PDF readers I dumped because they became slow and unwieldy (Adobe and Foxit).

      Ha ha, hilarious. I just checked and Acrobat reader is 1.045MB just for the fucking downloader. It's been a very long time since I used Acrobat reader, but wasn't the file size something ridiculous like 100 to 200MB? BTW, Sumatra doesn't upgrade frequently as someone said above. Because Sumatra is so simple, it rarely needs to.

    16. Re:Sumatra PDF by znrt · · Score: 1

      Certainly! I could accept a multi-dozen thousand UKP fine and possible imprisonment from HM Revenue & Customs for refusing to complete the interactive PDF Corporation Tex return form ( CT600 ).

      What an alternative!

      Note: paper submissions are no longer accepted.

      i had no idea, sorry to hear that. that's pretty deep shit. have you considered migration as an alternative?

  6. Sumatra PDF by shellster_dude · · Score: 5, Insightful

    Check out Sumatrapdf http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html. It's super fast and does not support javascript or actionscript in PDF's. I use it exclusively now.

  7. Easy by Sparticus789 · · Score: 1

    The best way to protect your computer from malicious Javascript embedded within a PDF is to not install Adobe Reader. If you cannot open the file, your computer cannot be infected.

    --
    sudo make me a sandwich
    1. Re:Easy by plover · · Score: 1

      That's almost 100% correct. The problems could potentially be infecting a document previewed or even the search indexer, though. There have been successful attacks on Windows taking advantage of the JPEG previewer as well as WMF, TTF, and others.

      I don't know of any such successful attacks on Windpws 7 or higher. Doesn't prove they're impossible, just that they haven't been encountered yet.

      --
      John
    2. Re:Easy by sjwt · · Score: 1

      Nuke them from orbit--it’s the only way to be sure.

      --
      You have 5 Moderator Points!
      Which Helpless Linux zealot/MS basher do you want to mod down today?
    3. Re:Easy by Ash+Vince · · Score: 1

      The best way to protect your computer from malicious Javascript embedded within a PDF is to not install Adobe Reader. If you cannot open the file, your computer cannot be infected.

      In the real world that is simply not an option. I have to be able to view PDF's on my work PC.

      This original question seemed to be posed by someone wanting to protect a network, in that case he definitely cannot mandate no PDF's. The trick to being a good admin is doing your best without getting in peoples way. Blocking all PDF's at the mail server would definately get in peoples way.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    4. Re:Easy by operagost · · Score: 1

      That sounds like the best way to protect your computer from all malicious code, which is to turn it off.

      --

      Gamingmuseum.com: Give your 3D accelerator a rest.
  8. javascript? by sjames · · Score: 4, Insightful

    Why in the world is javascript included in PDF documents? PDF is already a Forth like programming language and environment.

    1. Re:javascript? by jbolden · · Score: 2

      I think you are thinking PostScript. PDF requires that all computations resolve to a well defined value based on information contained within the document (i.e. not turning complete). So then of course Adobe had to add a turing complete language back in.

    2. Re:javascript? by gweihir · · Score: 0

      I suspect most people (and malware programmers ;-) are not capable of writing PostScript, regardless of it being a full-featured programming language. Hence JavaScript, the bastard-cretin of the programming language world, got included. Personally, i find the only thing difficult in PostScript is handling fonts. But that may also be because what I wanted to do, I could well do without fonts.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    3. Re:javascript? by Gothmolly · · Score: 2

      Because in the post-Microsoft world, there is no separation between code and data. Where have you been since 1991?

      --
      I want to delete my account but Slashdot doesn't allow it.
    4. Re:javascript? by sjames · · Score: 1

      I am more familiar with PostScript (by way of Forth (Warnock can claim they're unrelated all he wants). Looking further, I see that PDF strips out flow control. Perhaps they should just put it back?

    5. Re:javascript? by fuzzyfuzzyfungus · · Score: 3, Interesting

      I think you are thinking PostScript. PDF requires that all computations resolve to a well defined value based on information contained within the document (i.e. not turning complete). So then of course Adobe had to add a turing complete language back in.

      I don't know if any implementations are stupid enough to implement this(at least without some very careful sanitizing); but(in addition to ramming in javascript and the ability to embed basically anything at all, thanks for nothing 'rich media annotations'), they even added: Launch Actions!

      "12.6.4.5 Launch Actions
      A launch action launches an application or opens or prints a document. Table 203 shows the action dictionary
      entries specific to this type of action.
      The optional Win, Mac, and Unix entries allow the action dictionary to include platform-specific parameters for
      launching the designated application. If no such entry is present for the given platform, the F entry shall be
      used instead. Table 203 shows the platform-specific launch parameters for the Windows platform. Parameters
      for the Mac OS and UNIX platforms are not yet defined at the time of publication."

      Your Standards Compliant Solution for executing arbitrary binaries with arbitrary parameters. No need for messy, version-sensitive, exploit code! Combine with javacript and web-interaction support to build documents that search the target's hard drive for interesting things upon being opened... Or(miracle of miracles!) build a PDF that runs the adobe update utility when you open it, you're sure to find something new every time!

    6. Re:javascript? by mysidia · · Score: 1

      Will the next version of reader come complete with a PWN ME sign hung automatically around the back of your computer, and included in the Acrobat plugin version string announced by the web browser in the User Agent headers towards every site you visit?

    7. Re:javascript? by jbolden · · Score: 1

      Well the idea of PDF was to avoid indefinite resolution, inconsistent RIP times.... I think it makes more sense to keep it out but I'd say really the question is, "why not bring back Postscript for more complex documents"?

    8. Re:javascript? by jbolden · · Score: 1

      Wow! .pdfs become binaries. Talk about a glaring security hole.

    9. Re: javascript? by Anonymous Coward · · Score: 0

      A hole implies there is something around the hole for there to be a hole in. This is just the complete and utter lack of any security.

    10. Re:javascript? by Anonymous Coward · · Score: 0

      It's fucking ridiculous, they are effectively turning PDF files into stripped-down applications...

      Is there any advantage to this over using a tightly walled garden - a la smart phone apps?

    11. Re:javascript? by jimicus · · Score: 1

      Because Adobe PDF Reader is not - and hasn't been for some years, if ever - a plain PDF viewer. It's not meant to be.

      It's a fat-client application for a whole lot of other products that need to produce interactive forms that require both the presentation to the user and the end result to look predictable.

      99 times out of 100, nobody needs this functionality. But for that 1 time out of 100 where it is needed, Adobe's salesmen have a nice easy job: "No obscure third-party software required by your clients in order to use our product, everyone already has the reader!".

    12. Re:javascript? by sjames · · Score: 1

      That would seem reasonable. Especially since adding javascript would seem to screw up the consistent RIP times again not to mention, apparently adding a security risk.

    13. Re:javascript? by sjames · · Score: 1

      Alas, then the bad guys decide they like the idea of a document format that reliably delivers their payload to hapless email users...

    14. Re:javascript? by jbolden · · Score: 2

      So we agree. As an aside, I don't think inconsistent RIP times mean as much for print as they did. You'd be hard pressed to find an engine 2.5x faster than the one you would get in a good quality commercial printer of the same form factor in the mid 1990s. At the same time you would be hard pressed to find a RIP that wasn't at least 25x as fast as one from the mid 1990s. RIPing is so fast relative to other parts of the engine that there aren't dedicated hardware RIPs at all, it is just a process you throw in some where else.

      In terms of security, PostScript was insecure but at least it was designed to be easily sandboxed. Alternately you could wrap PostScript in such a way that the few dangerous commands would fail. PDF was designed to be secure via. limiting its capacity, adding a Turing complete language to those environments seems much more dangerous. Better to know you are in a shark tank and at least have the right gear.

    15. Re:javascript? by K.+S.+Kyosuke · · Score: 1

      You'd be hard pressed to find an engine 2.5x faster than the one you would get in a good quality commercial printer of the same form factor in the mid 1990s. At the same time you would be hard pressed to find a RIP that wasn't at least 25x as fast as one from the mid 1990s.

      Excuse me, don't those two sentences contradict each other?

      --
      Ezekiel 23:20
    16. Re:javascript? by K.+S.+Kyosuke · · Score: 1

      That's not a security hole. Nobody says that the application can't ask you to confirm the action after having you review the command line.

      --
      Ezekiel 23:20
    17. Re:javascript? by jbolden · · Score: 1

      No.

      RIP = converting the high level print language to a low level print language. For example PDF to Xerox Metacode or PCL
      Engine = take low level print language and put dots on a piece of paper.

    18. Re:javascript? by jbolden · · Score: 1

      How are end users going to be able to successfully confirm the security hole.

    19. Re:javascript? by K.+S.+Kyosuke · · Score: 1

      RIP = converting the high level print language to a low level print language. For example PDF to Xerox Metacode or PCL

      Uhm, no. The "RI" in RIP means "raster image". A RIP is a rasterizer, no matter what its input is - PCL, PostScript, PDF, XSP, doesn't matter.

      --
      Ezekiel 23:20
    20. Re:javascript? by K.+S.+Kyosuke · · Score: 1

      There's a simple rule for that: "If you don't know what this is about, click 'Cancel'".

      --
      Ezekiel 23:20
  9. Why sanitize the pdf file? by 140Mandak262Jamuna · · Score: 2

    Why don't you sanitize the reader? Use a reader with javascript ignored. Or build one from whatever open source pdf reader you can find, if there isn't one already. Or run the pdf reader inside a sandbox without internet access or permanent disk write. If that breaks the portability and the documents don't render correctly when javascript is diabled, tell the sender and blacklist the sender too for good measure. If enough companies lock javascript out of pdf documents eventually the authoring tools will stop using it.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  10. Just block PDFs with javascript by Kardos · · Score: 2

    You don't need a solution that rewrites the PDF. At best it will work correctly "most of the time", and break PDFs the rest of the time. For example, pdf->ps->pdf, or the "print to pdf" solution mentioned earlier in the comments may work fine for scanned PDFs, but if there are annotations/comments then they'll get stripped. This will lead to massive user frustration ("but the comments are there, I sent it in the last email") and people having to find ways to work around your filter. Modifying people's attachments is a bad move. A more reasonable solution is to detect if the PDF contains any javascript code, and if it does, block the PDF entirely.

    1. Re:Just block PDFs with javascript by Kardos · · Score: 3, Funny

      Looks like these guys made a tool to do the JS detection: http://www-rsec.cs.uni-tuebingen.de/laskov/papers/acsac2011.pdf

    2. Re: Just block PDFs with javascript by Anonymous Coward · · Score: 5, Funny

      That link is to a PDF! How do I know it's not a trap? Oh, the dichotomy :-(

    3. Re:Just block PDFs with javascript by rioki · · Score: 1

      It is like the executable files restriction. It does not really hinder you, since you can always encrypt zip the files you want to send. It is an almost win-win situation, in that all bad attachments are rejected and the few users that do need the feature, it takes them only 10s more effort. Huge security gain, little effort on the users.

      But I would not drop or reject the email, I would remove the attachment and attach an atachment-deleted.txt. This allows the user to react to the communication, even though the files did not go through.

    4. Re:Just block PDFs with javascript by andy_t_roo · · Score: 2

      bonus points awarded for linking to a pdf.

  11. RE:Ask Slashdot: How Do You Automatically Sanitize by MobSwatter · · Score: 0

    "Your document has been completed Sent on behalf of *. All parties have completed the envelope 'Please DocuSign this document: To All Employees 2013.pdf'. To view or print the document download the attachment . (self-extracting archive, Adobe PDF) This document contains information confidential and proprietary to * LEARN MORE: New Features | Tips & Tricks | Video Tutorials DocuSign. The fastest way to get a signature. If you have questions regarding this notification or any enclosed documents requiring your signature, please contact the sender directly. For technical assistance with the signing process, you can email support. This message was sent to you by * who is using the DocuSign Electronic Signature Service. If you would rather not receive email from this sender you may contact the sender with your request." They are zero day exploits... The funny thing is, the more I try to piss off elite corps and gov't, the more of these I get. No law against testing the "system".

  12. Rasterize and reencapsulate by gweihir · · Score: 1

    The problem is that PDF and the PostScript used in it is an executable language. This falls under "executable code in non-executable containers". If you need to be sure, convert the PDF to a series of JPG or GIF pictures and recreate a PDF from them. With any less harsh approach, you may retain malicious PostScript (and other) code.

    And, yes, what you are trying to do is non-trivial. Expect anything "simple" will be insecure.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:Rasterize and reencapsulate by Kardos · · Score: 3, Informative

      If you rasterize and re-encapsulate your user's PDF attachments, your users will hate you, and work around your "stupid filter that breaks pdf attachments". You are better off blocking all PDF attachments by email. It'll save yourself a ton of work, and your users can skip the frustration of mangled attachments and go directly to working around your filter.

    2. Re:Rasterize and reencapsulate by gweihir · · Score: 2

      Your problem only applies if the PDFs have to be editable or if you rasterize with too low or too high resolution. You can also run the images through OCR to get back come level of editability.

      Otherwise you have work with possibly infected PDF. There are a few settings where that is not acceptable and users will not work around it (e.g. "you infect this system and then it turns out you where not following procedure, you go to prison for a few years"-environments.)

      While I agree that security should not hinder users from doing their job exactly because they will otherwise start to work around it, that was not the question of the OP.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    3. Re:Rasterize and reencapsulate by Anonymous Coward · · Score: 1

      If you rasterize and re-encapsulate your user's PDF attachments, your users will hate you, and work around your "stupid filter that breaks pdf attachments". You are better off blocking all PDF attachments by email. It'll save yourself a ton of work, and your users can skip the frustration of mangled attachments and go directly to working around your filter.

      I saw a large contract walk out the door as a result of a mangled attachment. After several rounds of sending and re-sending, the two managers ended up arguing about who was fucking up the file, and eventually the other guys just figured we were idiots and walked away.

    4. Re:Rasterize and reencapsulate by Kardos · · Score: 1

      If users will be fired/jailed for working around a PDF mangling filter, the solution is to ban all PDFs, not mangle them and expect the users to keep doing their jobs. Permit raster image attachments, not PDFs.

    5. Re:Rasterize and reencapsulate by Anonymous Coward · · Score: 0

      If you rasterize and re-encapsulate your user's PDF attachments, your users will hate you, and work around your "stupid filter that breaks pdf attachments". You are better off blocking all PDF attachments by email. It'll save yourself a ton of work, and your users can skip the frustration of mangled attachments and go directly to working around your filter.

      I saw a large contract walk out the door as a result of a mangled attachment. After several rounds of sending and re-sending, the two managers ended up arguing about who was fucking up the file, and eventually the other guys just figured we were idiots and walked away.

      Clearly there was more than one fucking idiot who couldn't come up with another way to transmit a file from one location to another. These old fashioned things called fax machines and even snail mail still do work. And damn near every single time I hear. Obviously the contract wasn't worth the 2 minutes of common sense effort.

      Aren't assumptions a bitch...

    6. Re:Rasterize and reencapsulate by Anonymous Coward · · Score: 0

      I've seen customers leave because they couldn't figure out how to open the zip file containing the product. Instead they thought we were jiving them and sending garbage. Turns out he was renaming the file extension to what he thought was proper and loading it in autocad.

    7. Re:Rasterize and reencapsulate by gweihir · · Score: 1

      And what if these users have to work with things sent in from the outside world? Fail!

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    8. Re:Rasterize and reencapsulate by toejam13 · · Score: 1

      My wife's old scanner software used to scan documents into multi-page TIFF files. She had one client whose image viewing/printing software would only recognize the first page embedded in the file. After a couple of rescans/resends, the client was ready to walk. I had to download a PDF conversion program for her so that her client could view the other pages.

      Some people have very little patience and will quickly walk if any issues with communication arise. That's life.

    9. Re:Rasterize and reencapsulate by Anonymous Coward · · Score: 0

      Combining the above advices, a sensible solution would be a mechanism that automatically:

          - splits off any attached PDF from incoming email,
          - but doesn't delete the original PDF, rather store it on a local server
          - in the email, replaces the unchecked PDFs with a "sanitized" version, plus a link to the original on your local server,
          - from where users can download the original if needed, possibly through a web page decorated with appropriate warnings.

      This way it is easiest for users to use the sanitized version, but if they need they can still access the original without hacking or frustration.

    10. Re:Rasterize and reencapsulate by Rich0 · · Score: 1

      The issue isn't so much that the documents are executable, but rather that they provide some kind of interface to anything other than where the ink shows up on the paper.

      I send postscript files to my printer and there is no security flaw. On the other hand, if postscript defined a command to send arbitrary network packets out the printer's NIC THAT would be a big problem. The fact that my printer can render a fractal and print it is cute, if perhaps overkill, but harmless.

    11. Re:Rasterize and reencapsulate by Burz · · Score: 1

      This is a built-in feature available to Qubes virtual machines (in fact, it uses a separarte disposable VM specifically to sanitize PDFs).

  13. You don't by PNutts · · Score: 5, Interesting

    At some point you trust technology and also reinforce proper user behavior. I hate catch-phrases but your e-mail hygiene should have layers of protection (defense in depth). Assuming that the message got through IP reputation filters, SPAM analysis, malware scans, and was delivered to your user, you rely on desktop protection and cross your fingers that nobody opens it.

    We have SMTP appliances from Axway and we used to stop all executable attachments and deliver a notification to the user to call the help desk and request a release. Times changed and we don't do that any more. However, you could annotate the message to remind the user that if they don't know who it's from or what it is or if they weren't expecting it to not open it. And some will anyway. We also used to hold certain attachments for four hours until the virus definitions (and the other defenses) received a couple of updates and then reprocess the message.

    If you do try to roll your own, be aware that everyone and their dog creates PDF files with varying degrees of success and we had certain PDF files that caused services to fail on our gateway while they tried to scan and process them. You didn't mention the volume but make sure your solution scales well.

    1. Re:You don't by Anonymous Coward · · Score: 0

      and we had certain PDF files that caused services to fail on our gateway while they tried to scan and process them

      Ya, you can target the sanitizers with all kinds of fun stuff. They usually just end up becoming a new point of failure.

    2. Re:You don't by King_TJ · · Score: 1

      I'm thinking along the same lines here.... I can't say that I've really seen Javascript embedded PDFs as much of an attack vector where I work. By and large, your Mac OS X users wouldn't encounter this anyway, since they generally use the "Preview" app that's part of the OS to view and print PDFs. Adobe Reader is usually rather pointless to install in OS X, since Preview renders pages far faster anyway AND gives the ability to do things like add signatures to a document, re-order the pages and annotate, without paying for the abilities.

      I'm sure this could eventually be an issue for some of our users, but you'd hope the desktop anti-virus software might stop it from doing damage too, depending on what it was attempting. But even if not? You can't protect against everything, and you reach a point where the solutions are as bad as the problems since they start impacting productivity and slowing down EVERYONE, all the time, just to try to block the one hypothetical attack.

      At least in Windows, I wish sometimes the OS had the capability of opening all attached executable type files from email in sort of a "sandbox". Only after a file was determined to be something the user actually wanted to use/print/keep would they get the option to transfer it over to the regular file system. (When you think about it, almost all the malware that gets in by tricking a user into opening the attachment would at least get caught at THIS level. They almost always realize after running the file that, "Hey, that didn't seem to do anything!" or "That did something weird to my system... Oh no!", or even "That's not the document the email said it was going to be!") It's that curiosity or initial confusion that makes them open the bad stuff in the first place -- and a sandboxed "safe zone" to do that in would let them do it while mitigating the risk.
       

    3. Re:You don't by dbIII · · Score: 1

      It's the exceptions that stuff everything up. If you have staff members that require that email is the way that they are going to send executable files around, and not any of the million other options from FTP onwards, about the best you can do is force them to zip it up. Then if you combine that with a requirement from some staff that they MUST use MS Outlook (and in one memorable case, even now in 2013 on Win7 the utter fucking virus magnet MS Outlook Express), you've then got another weakness with the click to run "feature" that nails them with a virus if they click too long on an email with a zipped virus. If you add the next exception of requiring badly written software that will only run as "Administrator" you can only hope that your MS Windows users don't get something before the antivirus vendors see it.
      Stopping malware is easy but very bad choices of workflows in offices make it ultimately impossible to halt it completely. That just leaves ways to clean up the inevitable as quickly as possible.

    4. Re:You Don't by Anonymous Coward · · Score: 0

      Almost suggests that it might be worth sending the odd "funny" PDF which doesn't do anything serious but does give the recipient a scare.

    5. Re:You Don't by Anonymous Coward · · Score: 0

      His duty is whatever the guys who pay him say it is.

      If they tell him to make PDFs safe, then that's what he's gotta try and do.

  14. evince by davydagger · · Score: 1

    Evince is the PDF/Documents viewer for gnome, It also gets compiled for windows.

    In the linux world, its a heavy weight gnome app.(compared to e/x pdf), but its far far far lighter than Adobe Acrobate Reader, and it doesn't do javascript at all. I've yet to come accross issues with PDFs not working, as most legimiate PDFs don't use javascript.

    It also comes from a long standing respected open source project, GNOME,(read comparable quality as commericial software,), not a drive by night freeware operation of dubious origins.

    https://wiki.gnome.org/Evince/Downloads

    1. Re:evince by geminidomino · · Score: 1

      You were really on to something until

      It also comes from a long standing respected open source project, GNOME,(read comparable quality as commericial software,)

      You got carried away and went too far beyond credulity with that one!

    2. Re:evince by davydagger · · Score: 1

      oh, well go use adobe shovelware and get back to me on what high quality software exists in the proffesional world.

      staring at you flash.

  15. Use sandboxie by zenlessyank · · Score: 1, Informative

    Great little app for just such issues.

    1. Re:Use sandboxie by Anonymous Coward · · Score: 1

      Any root exploit is also a break-out-of-sandboxie exploit, if the exploit creator decides to include that.

  16. Change configuration by Anonymous Coward · · Score: 0

    Adobe Reader (XI, other releases?) can be used in Protected Mode.

    Edit>Preferences>Security(Enhanced), check Enable Protected Mode at Startup, All files and check Enable Enhanced Security. And disable Javascript.

    I wouldn't say it's possible to definitely sanitize a malicious document, but enabling some of the security features is going to make exploitation more challenging.

    1. Re:Change configuration by fuzzyfuzzyfungus · · Score: 3, Insightful

      And be sure to double-check that the next update doesn't revert those settings on you...

    2. Re:Change configuration by Anonymous Coward · · Score: 0

      nice FUD statement

    3. Re:Change configuration by Anonymous Coward · · Score: 0

      You never have run across a badly-behaving software like that?

    4. Re:Change configuration by dissy · · Score: 1

      I posted more details up above, but if you get the Adobe Enterprise Toolkit (free), you can rebuild a custom MSI installer that you deploy through Group Policy. It defines both installer options, and default user preferences.

      You can specify a file share on your LAN for it to check for updates, so it will only have updates available once you rebuild the new version installer and vet for everything working.

      There are also group policy admin templates you can use to lock user preferences, and you can have reader check an internal file share for updates instead of from Adobe.

      Oh, and you can turn off the Ask toolbar crap too.

      Toolkit docs:
      http://www.adobe.com/devnet-docs/acrobatetk/index.html

      Adobe Reader "offline" installer (The toolkit won't work with the "online" installer)
      ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.03/en_US/

      Then go up to the 11.0.0 dir to get the group policy templates.

  17. Whatever you do, do it in a sandbox by Anonymous Coward · · Score: 0

    You're going to be automatically opening PDF from the internet, so whatever you do, do it in a sandbox.

  18. Why are you doing this? by tftp · · Score: 0

    Before you jump in and start messing with corporate documents, make sure you understand very well why you are doing it in the first place. Is it what you are specifically hired to do? Some PDFs are cryptographically signed, and there is nothing that you can do to alter them that won't invalidate the signature. Other PDFs are password-protected from copying. You cannot legally extract their content (even if technically there are ways.) Malicious content inside a PDF is, therefore, not blockable unless you block all PDFs - and then you will cause more harm to the business than all the PDF viruses taken together. The best solution is to enforce a safe reader.

    1. Re:Why are you doing this? by king+neckbeard · · Score: 1

      Aren't the signed PDFs usually just signed in Adobe, but read just fine in lmost any other reader?

      --
      This is my signature. There are many like it, but this one is mine.
    2. Re:Why are you doing this? by tftp · · Score: 4, Informative

      Signed PDFs can be read in any reader, but the signature will be still validated (if the reader is not defective.) Encrypted PDFs will not be even readable if they are not encrypted to you. Password-protected PDFs may require the password to be readable, let alone printable or changeable.

      In other words, PDFs are not designed for wanton modification. Some of them can be modified, but others cannot. This means that you cannot build a reliable method for converting suspect PDFs into safe PDFs.

    3. Re:Why are you doing this? by king+neckbeard · · Score: 1

      I seem to recall a lot of the security mechanisms assuming you are using Adobe. I want to say that passworded files will often just ignore the password prompt and display normally, and if a PDF can be read, it can be printed.

      --
      This is my signature. There are many like it, but this one is mine.
    4. Re:Why are you doing this? by tftp · · Score: 1

      I want to say that passworded files will often just ignore the password prompt and display normally, and if a PDF can be read, it can be printed.

      It's because there are two passwords; one to open for reading, and another for other purposes. Let me open Acrobat and tell exactly...

      • Four security methods: None, Password, Certificate, Adobe LiveCycle DRM
      • Password uses AES256; encrypts all, all ~metadata, only attachments
        • Require password to open: Y/N
        • Require password to print: Y/N (if Y then select output resolution)
        • Require password to edit: Y/N (many options)
        • Enable copying of text, images, etc.
        • Enable screen readers

      The certificate security seems to support that too. It's a complicated cardhouse, and I wouldn't want to become responsible for hacking it. Not as a volunteer, at least (no "thank you" if it stops a virus, but all the blame if it breaks someone's workflow.) Generally, if a PDF is signed or certified or encrypted, it's off limits. I do sign PDFs now and then, and I have seen workflows where *every* PDF is signed (the government does that.) Those are not something you dare to hack - those are often multimillion contracts awarded to your company.

    5. Re:Why are you doing this? by Z00L00K · · Score: 1

      And there are software out there that removes all limitations on a PDF too.

      Of course - mostly useful when you want to be able to enable the ability to copy text from a PDF or remove watermarks and similar stuff.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    6. Re:Why are you doing this? by tftp · · Score: 1

      That software cracks the password(s) by brute force. As I understand, there are not too many better attacks against AES. This means that a password like 9~}~w\1[X\3{F968|05|\St3\Ya7Lh~~ is not going to be cracked in this millennium. Besides, it would be entirely illegal to use such software in a business. Cracking of a password may take a second, or it may take a year. How would you integrate that into your mail processing chain?

      PDF can be also encrypted with PKI, and with Adobe's own DRM. Those cannot be cracked, as far as I know. You either attack the symmetric cipher, which is usually AES256, or you find a new attack against RSA. If you can do either of those in reasonable time, you have better things to do - like becoming filthy rich and famous. (Or dead.)

    7. Re:Why are you doing this? by Bert64 · · Score: 1

      The only option remotely useful, is the one to encrypt the file with a password for opening. The other "features" are just stupid client side security, and only appear to work if the client respects the options. All the user has to do, is open the file with a different pdf reader that ignores the options. Options like this are actually worse than having no options at all, because they create a false sense of security and encourage users to use them.

      If you can read the file, you can always copy data out of it, print it, edit it etc.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    8. Re:Why are you doing this? by Bert64 · · Score: 1

      Cracking the password is entirely different from removing the "limitations"...
      If you can open the file and read it, then you can always modify, print, copy etc the file too. If you can read the file then you have already got past the encryption because either there is no encryption or you have the key.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    9. Re:Why are you doing this? by dbIII · · Score: 1

      Is it what you are specifically hired to do

      If somebody is in charge of filtering policy on a mail server that's carrying such traffic the answer is nearly always yes.

    10. Re:Why are you doing this? by tlambert · · Score: 2

      In other words, PDFs are not designed for wanton modification. Some of them can be modified, but others cannot. This means that you cannot build a reliable method for converting suspect PDFs into safe PDFs.

      I believe the entire point of the original submission was likely to troll this fact; as soon as he/she said that they wanted to do it while transitting a mail gateway, it was either a request for PDF encryption cracking or a troll against Adobe locking down documents in this fashion.

      I've personally railed against government agencies being in violation of the Americans with Disabilities Act for putting up PDF forms that have to be filled in by loading them into Adobe products, but until someone who has been spearfished for lack of a product capable of doing this without violating the DMCA, nothing's going to change. With the ADA, there are clear, litigious interests groups, with large fat government agency targets. Not so when all you are talking about is companies like Barracuda being essentially frozen out of a market which Adobe is free to compete in on a software basis. But again, you have to be the wronged party.

      The ordinary person doesn't give enough of a damn about this sort of thing for public pressure to work, and never will, since they have no idea what constitutes "enough" and would rather watch TV than be lectured to by nerds like us.

    11. Re:Why are you doing this? by rsborg · · Score: 1

      Signed PDFs can be read in any reader, but the signature will be still validated (if the reader is not defective.) Encrypted PDFs will not be even readable if they are not encrypted to you. Password-protected PDFs may require the password to be readable, let alone printable or changeable.

      In other words, PDFs are not designed for wanton modification. Some of them can be modified, but others cannot. This means that you cannot build a reliable method for converting suspect PDFs into safe PDFs.

      Encrypted PDFs can be broken, quite quickly - a quick search pulled up some tools - one of which I had to use a while back for work [1]. I decrypted about 40k documents in less than a day with GuaPDF, with only about 300 or so that couldn't be cracked - 99% success rate. Combine with the JS detection method noted in another comment [2], and you can still tell if there's a dangerous PDF most of the time.

      If you need to protect your populace (i.e., at the mail server level), combining the two above and either blocking (with a "see IT" note) or warning users for uncrackable/JS-detected pdfs sounds like a good win. Especially since cracking is almost instantaneous.

      [1] http://pcsupport.about.com/od/toolsofthetrade/tp/pdf-password-remover.htm
      [2] http://it.slashdot.org/comments.pl?sid=3985927&cid=44314295

      --
      Make sure everyone's vote counts: Verified Voting
  19. Solution is here .. by dgharmon · · Score: 0, Flamebait

    Download and install Ubuntu or one of these distros ..

    --
    AccountKiller
  20. Anything but Adobe by king+neckbeard · · Score: 2

    If you use anything but Adobe, it probably won't support javascript because it's fucking stupid to have javascript in a PDF. Just avoid Adobe, because they are allergic to security.

    --
    This is my signature. There are many like it, but this one is mine.
    1. Re:Anything but Adobe by safetyinnumbers · · Score: 1

      I've always been wary of Adobe Reader alternatives for a non-security reason.

      I was using one (possibly FoxIt) to complete some official forms, the type that allow you to enter text into boxes and then print it for mailing.

      Checking over the form, I found an incorrect birthdate, 5/18 instead of 5/17. So I re-typed 5/17 and the text changed back to 5/18.

      I guess that it was internally parsing the date and then doing some timezone adjustment to display it, or it was some crazy rounding error. But whatever the reason, I've never trusted the alternatives to be reliable after that.

  21. Test the Attachments by Flere+Imsaho · · Score: 3, Interesting

    There's a couple of vendors (and many more playing catch-up) selling appliances that detonate attachments on sandboxed VMs running in fast virtual memory.
    They executed/open attachments and watch to see what happens - registry changes, file drops, network activity, attempts to contact known C&C servers, etc.
    Anything that exhibits non-legit behavior get quarantined. FireEye have a box that does this and also crawls network shares, testing files.

    Aside from whitelisting, I think it's the best defense against zero day malware. It's a little too pricy for the company I work at right now, but as more vendors add this functionality, the price will come down.

    --
    It gripped her hand gently. 'Regret is for humans,' it said.
    1. Re:Test the Attachments by Kardos · · Score: 2

      Until you get malware that is smart enough to detect if it's in a VM, only activating when it's not in a VM...

    2. Re:Test the Attachments by Anonymous Coward · · Score: 0

      Then you just have all of your clients run hypervisors and do everything in VM. Problem solved.

      (Kidding, but that might not actually be a horrible idea.)

    3. Re:Test the Attachments by ZzzzSleep · · Score: 3, Funny

      Then just do all your work in a VM, and you'll be safe from malware!

    4. Re:Test the Attachments by guusbosman · · Score: 1

      This is already reality. So called "red pills" allow malware to find out if its are running in an emulator or virtual machine.

      Here's a paper that describes automatically generating such red pills:

      "A fistful of red-pills: how to automatically generate procedures to detect cpu emulators" by R. Paleari, L. Martignoni, G. F. Roglia, and D. Bruschi
      https://www.usenix.org/legacy/event/woot09/tech/full_papers/paleari.pdf

      The authors found more than 23k red-pills to detect QEMU and/or BOCHS.

  22. Okular? by Anonymous Coward · · Score: 0

    I was surprised that nobody mentioned it so far. Is it the case that nobody uses KDE these days? (KDE SC can be installed and run on a windows box as well)

    And I believe there are programs that convert PDF's to ps's so none of the executable stuff are kept. Whether those will survive legal challenges when some comes up, well, that's for another discussion.

    and if you are more cautious than that, set up vm's for these and you have snapshots when things go wrong.

  23. You Don't by SuperCharlie · · Score: 5, Interesting

    For a long time, I thought like you, that it was my duty to ward off and protect the "children". After a while, you realize 2 things.

    First, it is most likely your duty to inform and educate. Do that. Do it well, do it loud, and do it as often as you can. When someone eventually opens up one of those attachments, it will get around, and peer pressure will make everyone else gun-shy. After a user or two of mine got bit by an attachment, and I had repeatedly warned my users about these things.. I ended up with people at my desk occasionally asking..can you come look at this.. it just looks funny.. it was all about the peer pressure and not wanting to be That Guy who clicked the stupid link.

    Second, and I hate to say it, this is what we do, and this is job security. You can't save em all Hasselhoff, if ya did, there would be nothing left to do..

  24. Take A Step Back by PairOfBlanks · · Score: 0

    Re-evaluate the use-case for the whole PDF attachment. I can't think of a single _good_ reason to use it, ever. If somebody tries to give a false reason why it's a necessary format, just explain to them in technical detail why it's bad. I'm hoping that somebody can reply to this with a _genuine_ reason why sending a PDF (Pretty Damn F'ked) attachment to an e-mail is either necessary or optimal. 'It's good looking' sounds like a weak reason.

    1. Re:Take A Step Back by tftp · · Score: 3, Insightful

      I'm hoping that somebody can reply to this with a _genuine_ reason why sending a PDF (Pretty Damn F'ked) attachment to an e-mail is either necessary or optimal

      What else would you use to send an invoice, or a contract, or a drawing, or a user's manual, or anything else that requires pixel-accurate placement of all elements as designed ? It has to support digital signatures as a minimum, and preferrably a complete public key encryption. PDF does that.

      'It's good looking' sounds like a weak reason.

      The 'good looking' is a weak reason. "Correct" is a far better reason. Once you print into a PDF, it captures your document exactly as it is. You want your documents to represent what you put into them - neither more nor less. Perhaps there are better formats, but I'm not aware of any.

    2. Re:Take A Step Back by PairOfBlanks · · Score: 1

      Good thoughts. I was thinking (not written well) about what PDF does better than other pixel-accurate formats (such as postscript). In other words, I was looking for something above-and-beyond the competition effectively justifying the sanitization effort that the OP will have to put forth (as many unfortunately don't).

    3. Re:Take A Step Back by Bert64 · · Score: 1

      Postscript is a turing complete language, it has even more scope for including malicious code than pdf does.

      Incidentally there are also subset versions of the pdf format which don't include stupid features like javascript.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    4. Re:Take A Step Back by Anonymous Coward · · Score: 0

      Invoice
      Text file, HTML, spreadsheet, etc.

      Contract
      Rich Text file (signed with GPG/PGP), Text file (signed with GPG/PGP), HTML (with SHA hash stored elsewhere), markdown (signed with GPG/PGP), ODF, or even Doc or Docx.

      Drawing
      lossless: bit map, Portable Net Graphic, Giff, WebP, tiff, Scalar Vector Graphic
      lossy: Jpeg

      User Manual
      Windows: HTML files compiled to .lit format, HTML document, Doc or Docx, Rich text file, or text file
      Linux: man page, HTML, info page, text file

      Encryption and signing:
      GPG/PGP, TrueCrypt Volume (where you can even hide the files even exist for plausible deniability), stenographs

    5. Re:Take A Step Back by tftp · · Score: 2

      Invoice: Text file, HTML, spreadsheet, etc.

      Pixel-accurate, in a single file, with embedded vector fonts and raster images? What kind of text file is that?

      Contract: Rich Text file (signed with GPG/PGP), Text file (signed with GPG/PGP), HTML (with SHA hash stored elsewhere), markdown (signed with GPG/PGP), ODF, or even Doc or Docx.

      Doc and Docx are the likeliest candidates, at least because most documents are prepared in them. However these files are not pixel-accurate, and they do not lock the content, and they contain hard to remove traces of past edits. Still, MS Word documents are a popular format in business - as long as both sides intend to edit them.

      Drawing: lossless: bit map, Portable Net Graphic, Giff, WebP, tiff, Scalar Vector Graphic lossy: Jpeg

      Not even funny. Did you ever try to export a D size architectural drawing into a JPEG? An SVG may do well on vectors, but how will it handle small rasters that are often there? How will it deal with fonts?

      User Manual: Windows: HTML files compiled to .lit format, HTML document, Doc or Docx, Rich text file, or text file

      I see no reason to separate Windows and Linux here because user manuals must be platform-independent. But ebook formats are not very nice because they don't deal nicely with *all* of the text, raster and vector graphics. HTML comes very close, but it's usually not a single file (hard to distribute.) RTF is, of course, good - but it's very complex. User manuals are rarely published as .doc[x] because the end result is not pixel-accurate, and reflowing of the document can (and will) mess it up considerably.

      Encryption and signing: GPG/PGP, TrueCrypt Volume (where you can even hide the files even exist for plausible deniability), ste[GA]nographs

      Businesses rarely need to hide data in images. Volume encryption does nothing to secure documents that you email. GPG/PGP is somewhat OK, but it is arcane and requires an extra step to verify.

      As you can see, PDF combines all those desirable features in one convenient format, and there are many different readers and writers. A good number of them are free. What is there not to like? Alternatives may be just as good in one specific aspect, but there is no competition that does all of that pretty well.

  25. How hard could it be? by Lost+Race · · Score: 1

    Learn the file format and write a program to strip out any executable script elements.

    http://www.adobe.com/devnet/pdf/pdf_reference.html.

  26. confining javascript by Skapare · · Score: 2

    Javascript should not be given the capability of doing damaging things, It should be confined to a narrow execution context that is limited to being able to do only the things that enhance the experience of that ONE information resource. Dynamic layout is certainly a useful thing. Dynamically changing your system is not. It should not have access. I blame the developers. It doesn't matter if it is mail or web. It might do cute things inside a PDF like give you a calculator for a certain algorithm the PDF is written about. But it should not be able to access even /etc/hosts on your computer.

    --
    now we need to go OSS in diesel cars
    1. Re:confining javascript by phantomfive · · Score: 1

      You are not the only one who thinks this, the problem is things designed this way are rarely as secure as the designer wishes. See for example, Java Applet exploits.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:confining javascript by bill_mcgonigle · · Score: 1

      It should be confined to a narrow execution context that is limited to being able to do only the things that enhance the experience of that ONE information resource

      I think we just don't quite have the technology for secure computing yet.

      SELinux can do some of that isolation you're looking for, but we don't have the technology to make SELinux work well over a software ecosystem yet. We also don't have any security isolation between X11 resources, so that buggy PDF reader can conceivably deploy an exploit to steal the root password from your terminal window.

      Sadly, Windows Vista pulled ahead of FreeDesktop in the latter regard, and even Wayland doesn't treat this kind of isolation as a fundamental tenet (it's on the TODO list, so bolted on). Maybe the next generation will use signed comms between the display manager and the windows...

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
  27. Other options not always an option by fermat1313 · · Score: 4, Insightful

    Lots of people here saying "Don't use Adobe" and suggesting alternatives. Reality is, for many of us, we deal with complex PDF forms and applications that integrate directly with Adobe Acrobat. In my business (CPA firm) we use lots of applications, and most of them are highly vertical with often just one realistic competitor that can function adequately for a firm our size. Many of our apps integrate directly with Acrobat (and Office) so not using Acrobat simply isn't a choice we can make.

    So how do we deal with Adobe Acrobat? As some pointed out earlier, defense in depth. Spam filters, multiple virus scans, and our two most important measures: End users don't have admin on their computers and Adobe is one of our "High Priority" upgrade applications. Updates must be pushed out within one day of being released.

    BTW, the other other High priority apps are Java and Flash, again, both required by our software. With Acrobat, they make up my "Axis of Evil" of insecure software.

    1. Re:Other options not always an option by Anonymous Coward · · Score: 1

      Hopefully your enterprise I.T. can also use Group Policy to switch off javascript in Adobe Acrobat entirely.

      e.g.,; this page

      (bit dated, but it's the gist of it.)

    2. Re:Other options not always an option by Anonymous Coward · · Score: 0

      Many of our apps integrate directly with Acrobat (and Office) so not using Acrobat simply isn't a choice we can make.

      Make a plan, and start getting off it now. And avoid lock-in in the future.

    3. Re:Other options not always an option by jgrahn · · Score: 1

      Lots of people here saying "Don't use Adobe" and suggesting alternatives. Reality is, for many of us, we deal with complex PDF forms and applications that integrate directly with Adobe Acrobat. In my business [---] "Axis of Evil" of insecure software.

      That seems like an accurate, believable description of a common situation. I just wish I'd some time see someone *try to get out* of a lock-in situation like that. Or try to avoid creating more such situations. It has been well-known for decades that you can end up there, and yet organizations still plunge in, head first, all the time.

      (Note that the lock-in isn't just about paying $$$ to the vendor indefinitely. It also means your data is cut off from the rest of the ecosystem; you can't benefit from inventions done elsewhere. No version control for your MS Word documents, and so on.)

    4. Re:Other options not always an option by dissy · · Score: 1

      If you can't avoid the Adobe reader, the best advice is to Google "Adobe Reader Enterprise Toolkit"

      It's a GUI you run, point at an offline installer exe, pre-configure both the installer settings and the default user settings, and it spits out an MSI.
      There are also Group Policy admin templates you can use to lock down user preferences.

      The toolkit program claims to be able to customize most all Adobe product installers, but I've never used it beyond Reader.

      With this you can set up the exact policy you need, including either disabling javascript, or pre-load your domain certificates and set it to only run javascript from documents created in-house.

      You can also turn off the Ask toolbar crap, and set it to check your own file share for updates instead of having all your workstations do the downloads.

      Note this will NOT work with the "online" installer, which at least for me is the only download link I can seem to find on their website. You'll need the "offline" installer from their FTP.

      - Enterprise toolkit docs
      http://www.adobe.com/devnet-docs/acrobatetk/index.html

      - Enterprise toolkit download, plus group policy admin templates
      Toolkit direct download for v11: ftp://ftp.adobe.com/pub/adobe/acrobat/win/11.x/11.0.00/misc/

      - Adobe reader offline installer
      Go to ftp link above, and up two dir levels into 11.x
      Find the latest folder, and under a 'misc' dir will be the full installer.

    5. Re:Other options not always an option by fermat1313 · · Score: 1

      For us, there is simply no getting out. In the CPA industry, there are very few players in our software market. Finding software appropriate for my size firm (we're a top 40 US firm) is harder. At our industry level, there are basically two companies that make software for us: Thomson Tax and Accounting and CCH. There are no other options. There's no open source software for production level tax prep, or risk-based audit methodology, and we can't build our own. The resources required to build these systems is extensive. Hundreds of tax forms with hundreds of thousands of calculations. Our audit and advisory methodology software contains some 16000 different Microsoft Word and Excel templates and integrates with workpaper management software that documents our audits in the manner required by the PCAOB and the AICPA peer review process. Our document management system (which integrates with tax prep workflow) requires Acrobat.

      These are the realities of my business, and many like that. Too many people here think you can just open source yourself out of that and you can't. Yeah, if all your users just use word and excel and some web-based production software, you're fine. But in highly vertical industries, you use the software that's on the market, and you live with their requirements.

  28. xpdf doesn't support javascript by Narcocide · · Score: 1

    just sayin... you could simply use a more secure pdf reader.

  29. So the real question is... by Blugenes · · Score: 0

    ...are you saying Earth was the victim of a planetary-scale golden shower at some point?

    1. Re:So the real question is... by Blugenes · · Score: 2

      Ignore and erase if possible, posted in wrong thread by accident

    2. Re:So the real question is... by Anonymous Coward · · Score: 0

      Hey fellas! Lookit what Blugenes posted! Hardey-har-har!

    3. Re:So the real question is... by Anonymous Coward · · Score: 0

      It cannot be erased, it will forever exist to show the world that Blugenes posted a comment about his galactic watersports fetish on an Ask Slashdot question about sanitizing PDFs. And just to be clear, a golden shower will not sanitize a PDF.

  30. simple by Kishin · · Score: 1

    Use Foxit and keep javascript off by default. (Or don't even install the JavaScript plugin.) It's lightweight, fast and has fewer quality issues than adobe. Additionally, considering PDF is inherently an unsafe format, I'd say adding a sandbox like Sandboxie can help you. More technical people here might try porting a good PDF reader's key parsing and JS functionality to NaCl sandboxing system. Put each component in separate partitions with inner sandbox protection at a minimum. That lets us use the fast and legacy native code, but have plenty isolation almost for free. Nick P Security Engineer usually on schneier.com

  31. SumatraPDF by thelukester · · Score: 1

    Simple. In our organization, Sumatrapdf is the only allowed PDF reader. Users could request nitro or foxit but a sysadmin would disable JavaScript on install. Never once had a malicious PDF infect our organization. Little more work to not give users admin rights to their machines. But time and time again, users prove they are too incompent to safely manage their own machines.

  32. PDF2PS by Anonymous Coward · · Score: 0

    And moron who allows attachments should be fired.

    We allow authorized persons to upload files. 100% of attachments are trashed. Emails with pictures or questionable html, attachments or other tripe are stripped to raw text. There is a zero tolerance policy on personal devices connecting to the internal net and this includes USB or other devices. If you find you can't do your job with all the twiddly blather there's a line at the door.

    1. Re:PDF2PS by Bert64 · · Score: 1

      So you make it inconvenient for your employees to do their jobs, which will make some potentially good employees walk and reduce the efficiency of those who remain. Technology is supposed to improve the efficiency of workers, otherwise why bother using it at all? It's very hard to include working exploit code on a piece of paper.

      While i agree attachments are often misused, and i utterly detest companies that attach a bunch of images to every email they send out, all you can really do is avoid doing such stupid things yourself... Other people will still do it.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  33. Wrong Place to Address the Issue by Anonymous Coward · · Score: 0

    Scrubbing JS from all PDF files is only one step below blocking PDF outright. Sysadmins have to understand that you can't combat ignorance and stupidity with technology. It's never going to work. We've spent the last two decades trying to block this exploit and that, but has it made us safer? No, it hasn't. You know why? Because people are gullible, that's why. You can't fix that. Just design your systems so that critical infrastructure isn't damaged or disrupted by stupid users.

  34. Ditch acrobat by Bert64 · · Score: 1

    Seriously, why do people still run acrobat? PDF is a standard format, there are countless programs which support it and the only reason such files are a target is because adobe reader is basically a monoculture and represents a very large and attractive target. We need diversity among PDF readers, just like diversity among web browsers. It was diversity among web browsers more than anything else that reduced browser attacks and caused hackers to concentrate on proprietary monoculture plugins instead.

    --
    http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    1. Re:Ditch acrobat by bill_mcgonigle · · Score: 1

      Seriously, why do people still run acrobat? PDF is a standard format, there are countless programs which support it and the only reason such files are a target is because adobe reader is basically a monoculture and represents a very large and attractive target.

      Because people produce PDF documents with Acrobat and you can't do anything about that. Show me how to handle and XDF form or view a bank statement that uses javascript-based authentication on linux without Acrobat and I'll be very interested.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    2. Re:Ditch acrobat by david_thornley · · Score: 1

      PDF is a standard format,

      Seriously, have you read the PDF standard? The PDF is megabytes. There's all sorts of stuff listed that only Acrobat supports. For example, we produce PDFs with 3D images the user can manipulate to some extent (and don't get me started on U3D). I haven't found any reader other than Acrobat that can handle that.

      The fact that it's a standard doesn't help if your problems are because of features in the standard.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  35. This entire approach is wrong by 93+Escort+Wagon · · Score: 1

    The submitter is looking for a code-based solution to a sociological/psychological problem, and it's just not going to be effective.

    The real solution is to educate and train your users so they don't fall prey to these sorts of attacks. I know a lot of IT people aren't comfortable dealing with people, and I know it takes quite a bit of time and doesn't look as snazzy on your résumé - but, really, it's the best long-term approach.

    --
    #DeleteChrome
    1. Re:This entire approach is wrong by dbIII · · Score: 1

      That works for a while, then some guy gets employed to be in the middle of the stack that doesn't know any better and tries to change the "culture" and throw off the restrictive yoke of the IT people. All those senseless rules like one software licence per install and not using warez have to go!

    2. Re:This entire approach is wrong by Anne+Thwacks · · Score: 2
      The real solution is to educate and train your users

      I am intreagued by your solution, and would like to subscribe to your magazine.

      --
      Sent from my ASR33 using ASCII
    3. Re:This entire approach is wrong by Ash+Vince · · Score: 1

      The submitter is looking for a code-based solution to a sociological/psychological problem, and it's just not going to be effective.

      The real solution is to educate and train your users so they don't fall prey to these sorts of attacks. I know a lot of IT people aren't comfortable dealing with people, and I know it takes quite a bit of time and doesn't look as snazzy on your résumé - but, really, it's the best long-term approach.

      Some people are just too stupid to train in this manner. This is especially true if you are a system admin for an office that employs dolly bird PA's just to make tea and look pretty on the front desk when a client comes to visit.

      Blokes can be just as stupid too though, I had to clear up a PC after one of our support team clicked on one of these BS fishing emails as he installed some software that "cleaned" his Windows XP PC. He just has an inability to pay attention to what he is doing. He will most likely spend his entire like manning a helpdesk phone line helping people allow popups (We have to use them as many elearning courses are designed to only work in a popup and we host other peoples courseware).

      Often these people are employed in dead end jobs earning no money so training them to take their head out of their arse is like trying to get blood out of a stone. Hiring someone with a brain would cost more and they might not need it for the job they have to do anyway.

      Not that any form of network security for this is a magic bullet either. Unfortunately there is no one solution. All you can do is try and block as much as possible at the email gateway via a decent spam filter and make sure people only have the minimum admin rights on the PC's that they need to do their job. The final layer of protection though is making sure you have a damn good disaster recovery policy to allow you to recover a machine from nightly backups easily and can also rollback to previous days until you get a clean image.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    4. Re:This entire approach is wrong by Anonymous Coward · · Score: 0

      Except that's clearly wrong, at least for this particular case. The problem is Adobe Reader is a piece of crap that allows stuff that shouldn't be allowed. Doing what he wants to do is a perfectly reasonable solution. Training users on security is useful in general, but if you can eliminate another possible (or based on the popularity of PDF exploits, "likely") attack vector with a bit of code, you should absolutely do that.

  36. Printing ? by gitano_dbs · · Score: 1

    Print then delete the file.

  37. acrobat reader sanitized 100% by jjohn_h · · Score: 5, Informative

    In the install tree find the file JSByteCodeWin.bin and rename it. Works for me.

    1. Re:acrobat reader sanitized 100% by Kythe · · Score: 2

      Glad to see this got modded up. The general conclusions of the comments here are that it's impossible to sanitize 100% of Adobe PDF files while retaining needed functionality. If you have to use Acrobat Reader, you could do a lot worse than removing the capability to execute JS at the code level (rather than settings). I suppose you'll need to prevent uncontrolled updating of the software, as well.

      --

      Kythe
  38. PTSD by Kaenneth · · Score: 1

    I think all the people commiting suicide at their Seattle office might be getting to them.

    Their Seattle office is right under the Aurora bridge, popular with jumpers...

  39. Summary by supachupa · · Score: 4, Informative
    So the vast majority of people are recommending to ditch Adobe Acrobat, which is not where I was wanting to focus the discussion, but I appreciate your advice. I do agree that using something like Sumatra would be a good part of a defense-in-depth approach, but that approach does not protect your organisation from inadvertently sending out an infected PDF to another organisation.

    I did not know it was possible to detect javascript in a PDF, and I think this is possibly a better approach than a full rewrite (btw: I found this python script: http://blog.didierstevens.com/programs/pdf-tools/ ) So instead of rewriting every PDF, you just choose to delete any PDF attachments that are detected with JavaScript. I assume this will then not break any legitimate PDFs that have comments or forms, etc? It will need testing, I guess.

    The mail relay can then be configured to detect and delete any javascript-containing PDFs and allow everything else through (including encrypted, which is more likely to be legit than not). Once again, this is not the only protection against this malicious code, but just one facet. I found some recent exploits that don't need javascript at all, so it seems the safest, yet most likely to make you hated, approach is to rewrite the PDF completely or not allow PDFs at all.

    1. Re:Summary by Anonymous Coward · · Score: 0

      Yes and no. A malicious PDF can contain
      * JavaScript in embedded images, i.e., not in human-readable form
      * non-JS code that outputs JS code and then hands off control to that dynamically generated code.
      * Arbitrary recursion of all of the above.
      * Piecewise versions of the above, say in ten pieces scattered across input validators.

      The problem of verifying that a body of executable code never generates a specific sequence of state changes on any conceivable input is equivalent to the Halting Problem. There is no silver bullet.

      Quarantining/destroying innocuous dynamic layout PDFs and certain forms due to false positive identifications from your JS detector is an excellent way to show up on management's radar.

      Good luck.

  40. Outsource by Anonymous Coward · · Score: 0

    Ask the guys at NSA check the attachements for viruses etc. for you while they read through your mails anyway :)

  41. Ghostscript by nullchar · · Score: 4, Informative

    I use Ghostscript when attempting to compress a "bloated" PDF (such as generated by Xsane). The input is a PDF, output is a PDF:

    # Use ghostscript to re-write the PDF
    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=new.pdf old.pdf

    Also handy to combine multiple PDFs into a single document, or copy out certain pages from a PDF:

    # Combine PDFs
    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=combined.pdf 01.pdf 02.pdf 03.pdf

    # Copy pages 3 & 4 from an existing PDF
    gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=4 -sOutputFile=new.pdf current.pdf

    1. Re:Ghostscript by bill_mcgonigle · · Score: 1

      gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=new.pdf old.pdf

      And does that actually strip malicious javascript from the document? Most sources say it just copies them, and does nothing for libpng attacks.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    2. Re:Ghostscript by nullchar · · Score: 1

      I do not know if it strips javascript or not. I'd be happy to try it on a script heavy PDF.

      You can do the same PDF-> PS -> PDF as the summary suggested -- but with ghostscript and possibly control more options (like change the PDF version which might strip scripts), and perhaps use a different intermediary format than postscript.

      (I also don't know about the libpng attack inside a PDF, but am aware of various remote code execution in poor png parsing/rendering libraries. Are people re-encoding PNGs at the mail gateway level to reduce exposure to malicious PNGs?)

  42. Wisdom follows, pay attention! by Anonymous Coward · · Score: 0

    > cheap out of the box solution

    Out of the box probably means fast to implement? So you want something good and fast and for cheap? All three together are simply not possible.

    If you have the (big) money, look at Clearswift's "Secure Mail Gateway / Secure Web Gateway appliances" or Proofpoint USA appliances (in Europe it is known as the "F-Secure Messaging Security Gateway").

    Those have extremely refined, enterprise level message manipulation capabilities. Clearswift is actually capable of automatically censoring e-mails if you want (recognizes strong language, SSNs, credit card numbers, personal data etc. in mail body and attachments and crosses them out).

  43. Shameless plug by Anonymous Coward · · Score: 0

    Bromium (company I work for) sells a product that wraps all web pages and popular attachment formats like PDF in lightweight VMs, without disturbing the user experience. In this way you can still interact with the documents, but they can't infect your host OS.

  44. BFO PDF Library by Hypotensive · · Score: 1

    If you know a bit of Java you can do it in a few lines of code with the BFO PDF Library.

    1. Re:BFO PDF Library by Hypotensive · · Score: 1
      To follow up on myself, here is how to do it:

      PDF pdf = new PDF(new PDFReader(<input file or stream>));
      pdf.setJavaScript(null);
      pdf.render(<output stream>);

  45. Remove Adobe-whatever from all systems. by Anonymous Coward · · Score: 0

    Remove Adobe-X from all systems. Flash, Reader, Acrobat, Photoshop, everything from Adobe.

    As to Javascript in PDF files, xournal, evince don't seem to care about that. Use them instead of Adobe-pdf stuff.

    The only people who should have Adobe software loaded on their computers are professionals who make a living from those tools. Everyone else should disable and remove adobe-whatever. It is a matter of computer security and safety.

    We should also train our end-users to use HTML for most documents, unless page layout is critical. Page layout is probably only critical to marketing people. The rest of us are better served by the loose layout control that HTML provides.

    I like adobe products from a feature standpoint, but that isn't enough anymore. We need software that is safe to use too. Safey is more important than features to most users now. Until Adobe management makes the tough decisions to secure their tools by default, we are all screwed. We have little choice except to deinstall them all.

  46. great strategy by slashmydots · · Score: 1

    Only hire people who are smart enough to not open obviously fake attachments

  47. Sandboxin/isolation by Anonymous Coward · · Score: 0

    Simply put, sandbox the suspicious pdf in a sandbox environment. Best free solution comes with Comodo Internet Security. What sandbox does is it isolates the pdf virtualy so no malicious code stands a chance.

    Also Foxit Reader beats Adobe Reader hands down, and with the above mentioned CIS you can disable JS for readers via custom HIPS ddfense filtersp.

  48. http://pdfjavascriptst.sourceforge.net/ by Anonymous Coward · · Score: 0

    http://pdfjavascriptst.sourceforge.net/

  49. Doing It Wrong. by VortexCortex · · Score: 1

    Remember back when Internet worms were rampant? Yeah, back then we had all ports open by default in popular desktop operating systems. Finally they were convinced to release a service pack that closed all ports (turned on the firewall by default) and nearly all the worms went away.

    That's what you call using a whitelist instead of a blacklist. A blacklist is stupid, but I guess it's the only option you have if everyone is too stupid to utilize the whitelist. This problem has been boiling for a while, and its come down to authentication of endpoints and blocking all others not in the trust graph. If only there were some system that allowed you to authenticate emails and form decentralized trust graphs... Like PGP.

    So, How do you automatically sanitize all the packets hitting your ports? You don't. You block all but the ones that are legitimate. How do you automatically sanitize PDF Email Attachments? You don't. You block all but the ones that are legitimate.

    Instead of thinking me clueless, or unhelpful consider that I've already been down that road as far as it can be traveled and wound up in the exact situation I started. Absolute security is impossible, make the environment hostile to propagation. Call up the other IT guys in the businesses you do work with, it's a problem you can't solve on your own. If only Jedi Mind tricks actually worked, you could convince your managers to let you live. These scanners are not the solutions you are looking for. Whitelists are the way to go.

  50. You could quarantine them by SCHecklerX · · Score: 1

    For dangerous attachment types, you can quarantine them using MimeDefang. Then you provide a link for download after X days (notifying the recipient of the mandatory quarantine time), and a procedure for the helpdesk to pre-release 'known good/expected' documents. While in the quarantine area, you can do whatever you like to it ... scan for viruses, convert to another format, etc.

  51. CCC by Warbothong · · Score: 3, Interesting

    There's an interesting talk from Chaos Communication Camp 2011 about making a verified PDF scanner in the Coq proof assistant: http://www.youtube.com/watch?v=CmPw7eo3nQI

  52. Virus scanners. by leuk_he · · Score: 1

    Beside that, if you sue a less feature rich pdf reader, that is safe,

    the virusscanner will STILL find the suspicious js code, flag it, and set of all kinds of big alarms. And then they will be back at the mail guy.

    Maybe you want to run mail in a virtulized sanatized citrix box, where you cannot infect an pc that has access to al internal systems.

  53. Malware!! by Anonymous Coward · · Score: 0

    There is no where to hide. It's the evolution of work as we know it. The future is mainframes.

  54. You Do... by Burz · · Score: 1

    Built-in feature using hardware-hardened (VTx and IOMMU) disposable virtual machines. Process is described here: http://theinvisiblethings.blogspot.com/2013/02/converting-untrusted-pdfs-into-trusted.html

  55. switch to epub by cellocgw · · Score: 1

    I know it's a thought doomed from the start, but switching from pdf to epub as the document standard would be a big help.

    --
    https://app.box.com/WitthoftResume Code: https://github.com/cellocgw
  56. Forwarding by tepples · · Score: 1

    why not solve the problem properly and just sandbox the PDF reader so it can't access anything except the PDF that's passed into it?

    We can within a company, but we can't control what reader software the recipient of a forwarded PDF uses.

  57. Any search/replace will work, like sed by Yakasha · · Score: 1
    Going off of this description of pdf documents, it appears that everything in there is nicely encapsulated in an object. So it looks like all you need is a short text processing script (sed, php, whatever you know) to pipe the attachments through.

    The actual javascript object looks something like this:

    244 0 obj<</S/JavaScript/JS(all javascript code is between the two paranthesis)>>
    endobj

    Just stripping it out appears to work ok. Though the first number on the line appears to be an object number... so you might need to renumber the remaining objects as well to avoid problems with some viewers (I'm just guessing here).

  58. Tools, Techniques, and solutions...- by dthanna · · Score: 1

    If you want to go through a PDF a scrub out such things as JavaScript, actions, annotations, etc. I would implement either Enfocus' PitStop Server or Callas' pdfToolBox Server. They pay tools are not some sort of conspiracy. They have been tested in a large number of production environments with a zillion PDFs produced by various tools and systems. The vendors (Adobe included) have libraries (10's of thousands) of malformed PDFs that they use to regression test their products.

    Do not refry (PDF--> PS --> PDF) the PDF unless you know what you are doing. It's not the PS --> PDF using Ghostscript that's the problem (ver 9 of GS actually produces a pretty decent PDF). It's the creation of the PS from the PDF feedstock. It is not as easy as you may think. Did you sit down with a loupe to see if you have the resulting PDF look EXACTLY as the input? Didn't think so. You can run into all sort of weird issues with fonts, color spaces, transparency, alternate content layers etc. by doing a blind refry. There are a lot of ways to create a PDF. There are relatively few ways to do it correctly. There are very few (read: only ONE!) PDF Reader that actually does a good job on the not so well-formed PDFs. That being Adobe Reader.

    Tools that decompose the PDF and recompose it will be hit or miss.

    With regards to installation of Reader in a corporate environment:
    1) Use the latest/current version. Starting with Reader X (ten) Adobe launches PDFs in a sandboxed mode (until disabled by the user), negating much of the JS and other exploits that have been rampant previously. Starting with Acrobat XI (Spinal-Tap version - it goes to Eleven!), even Acrobat is launched in a sandboxed mode, again until disabled by the user.
    2) Use the enterprise deployment tools that Adobe provides http://www.adobe.com/products/acrobat/it-resources.html to make sure that a) Reader is locked down b) stays locked down according to your corporate needs. The tools provided can allow you to harden Reader quite a bit and keep the users from making changes.
    3) If you are truly of the paranoid type - and there are some business areas that have a legitimate need to be hyper paranoid about this stuff - only allow the PDFs to be opened inside of a hardened virtual machine that you remote into. Sort of a glove box approach to the PDF. Others have mentioned various methods to do this which are perfectly acceptable.

    Now, a larger number of slashdotter's are not going to like this - but much (most?) of the FOSS PDF software, tools, and libraries, produce less than optimal PDFs. The primary problem stems from 1) good page layout design is not the same as good web design. 2) Good PDF is built by using the most expedient and direct method possible. Not by using the most obscure methods you can find (such as how Apache FOP loves to f-around with the CTM rather than just performing a simple moveto). This is not RISC vs. CISC. Yes, f-ing around with the CTM allows you to slice, dice, Julian, fry, as well as being both a dessert topping and a floor polish. However, it is almost impossible to debug. You would have been better off just coding moveto, rmoveto, translate, scale, rotate, etc. as individual function calls (note, I am using the PostScript equivalents to the internal PDF commands). Your code is easier to parse, understand, debug, and, most importantly, follows generally industry concepts. 3) Use the minimal work to get the job done, not the most maximal. Don't screw around with kerning, leading, etc. unless you really need to. Place stings of characters as stings, not individual glyphs. 4) Learn the industry you are developing in and not gripe that the industry has no clue as to what they are doing. The typographic/layout industry has 10x the longevity as the web industry (500+ years vs. ~50). Most of the mistakes noobs were learnt years ago. Learn from their mistakes first. Yes, there are some things that are holdovers from tim

  59. OCR the new PDF. by Futurepower(R) · · Score: 1

    "- PDF is no longer searchable"

    Use a PDF OCR product like Adobe Acrobat Professional or an ABBYY FineReader product.

  60. Print to PDF by Futurepower(R) · · Score: 1

    Print to PDF using the open source PDFCreator, which would create another PDF file?

  61. What else would you use? by Anonymous Coward · · Score: 0

    XPS

  62. the best way to sanitize PDFs by Anonymous Coward · · Score: 0

    use lysoform and fire

  63. Enfocus PitStop Server by Anonymous Coward · · Score: 0

    Enfocus PitStop Server ( http://www.enfocus.com/en/products/pitstop-server ) can remove javascript from PDFs.

  64. Digital Signatures by Anonymous Coward · · Score: 0

    Any manipulation to a digitally signed document would really piss me of, and seriously consider going for face to face talk with the power-hungry "mail guy" who toke that decision!
    Believe me... if you want to keep your job and your health, do *nothing*... unless you are prepared to guarantee that your sanitization does NOT change any content being perceived by the user or that it won't be your problem at all (blame mcafee,kaspersky,etc).

  65. Extension by kmoser · · Score: 1

    Beware of people changing the extension (to, say, ".foo") before sending it inside your network. The recipient just has to change the extension back to ".pdf" and voila: they've snuck in an unsanitized PDF. And then there's the problem of password-protected Zip files.

  66. xpdf by Anonymous Coward · · Score: 0

    I use xpdf and FreeBSD. Works for me.