Comment by Thaxll

17 hours ago

Is it an exploit around the library that handles PDF parsing/opening? Can someone explain how files / attachement are open on a mobile device ( android/iPhone).

I don't understand how in 2026 this is still a thing, we have many safe languages to parse/deserialize data. Why is it complicated?

PDFs are basically executables, that's why it's hard. They support running code, they support decoding images which themselves have their own custom compressors that are basically code. Anything to do with image formats is rife for bad decoders, insane compression algorithms from the 90s, and a PDF is basically 1000 formats inside many different container types with executable code plastered on everywhere. If you want to make a compatible PDF viewer you'll need to be able to implement an image decoder algorithm for a fax machine that was specific to Japan in the late 80s, which was somehow ratified into a standard and is used today by all the top legal firms, or something absurd like that. When you open a PDF on your computer, depending on how it is being parsed, it can even make outbound network connections without you knowing. To safely open a PDF you need one of those bomb proof suits, a disposable laptop, and even then you might be going home without eyebrows.

  • Willing to bet that a default "treat PDFs/documents/spreadsheets as dumb" option in operating systems would eliminate the majority of common one-click vulnerabilies out there. And exactly 0.001% of actual use cases would be affected.

    • PDFs are just absurdly complicated in general. Dumbing down the parser might be the right idea. I wonder what consequences that would have with how intertwined PostScript and PDF in general are with macOS/iOS; maybe that's why the PostScript engine was removed with macOS Sonoma/iOS 17? I don't know if that was only user facing behavior and Apple is still working to remove the internal usages.

    • No. Very few PDF exploits come from the officially sanctioned way of running code (JavaScript) inside PDF. Most are just plain old parser bugs.

    • That's kind of what Adobe does with downloaded PDFs, you have to click the Enable button to turn on more document features. My schematic capture app will output a PDF that has links that will take you to specific spots on a page and also some JavaScript where you can right click on a part and see it's BOM information. None of that stuff works until you click the Enable button. I've also seen some vendors offer not only normal 3D model files and 2D drawings but a PDF that has an interactive 3D model inside. It's kinda cool how much random shit can go into a PDF but it's clearly a massive malware vector.

      One neat thing I've seen is a PDF that will ping an IP catcher when opened in Adobe, regardless of the security level. The same can be done with word docs, excel spreadsheets, and even SVGs.

  • > PDFs are executables, that's why it's hard.

    That isn’t really true, it’s not hard for PDF viewers to block by default (or just not implement) the problematic features, which also aren’t critical for the vast majority of PDF files.

    The exploitable bugs are typically the usual, some buffer overflow in an underlying image or font library or similar, but unrelated to PDFs being “executable”.

    • What a sleight of hand. PDF's are obviously not executable, any more than text files are. Decoders are executable and they can choose to unsafely handle input. Even plain text editors can have exploits. It's no different than any piece of complex software.

      4 replies →

  • > PDFs are executables, that's why it's hard. They support running code

    I don't think Apple's PDF renderer supports e.g. running JS, you'd need real Acrobat for that. Or are you talking about something else?

    > they support decoding images which themselves have their own custom compressors that are also basically code themselves.

    But this is fundamentally true for anything that displays images, right? Or are the PDF formats particularly bad for some reason?

    • Yeah a lot of those fancy PDF features are Adobe-only. It's not that other apps can't support those features, it's that no one in their right mind wants to spend endless amounts of money and time trying to sandbox it.

      Most people have some understanding that shady websites can give you malware, a drive-by exploit is pretty rare but it's good that most people think just visiting a site could infect your computer. But a PDF is just a document, right? Just thinking that a PDF is just words on a page is exactly why it's such an insidious threat. Or they'll get a PDF as an email attachment, see that it's not an exe or something weird, and open it because they think a document is safe.

    • I think it's more the image formats PDF supports? I could be wrong, but there was that forcedentry vulnerability (which was insanely cool, even if really bad)

  • From the standpoint of a layman it looks like there's a lot of overlap between writing safe web browsers/engines and writing safe PDF readers/engines. There just hasn't been anywhere near as much of an impetus to push PDF readers/engines in that direction because most of us aren't interacting with PDFs nearly as often as we interact with the web (and things built on web tech).

    • The difference is that web browsers absolutely need to support JavaScript to correctly display many important web sites, whereas that’s not necessary for PDF. You also don’t have to deal with vulnerability footguns like XSS/CSRF/CORS in PDF. Except for some rare special use cases that PDF viewers don’t need to support, nothing has to happen online for PDF. It’s really not comparable.

I'm pretty sure not even the safe languages would help you here. PDF allows you to pretty much run arbitrary code since it supports javascript, images, and a bunch of other things I'm forgetting, and you can't not implement javascript support or otherwise be selective about what you support with it because then all the end-users will complain when they get that one PDF that they need to fill out but it needs JS because... Nobody knows.