8 ms·
Insecure Features in PDFs (2021)
- actionfromafar 3y agoIs there some program which generates a safe subset of PDF? And/or can filter a PDF into that subset? pdf2ps -> ps2pdf?
- deleted 3y ago[deleted]
- 1oooqooq 3y ago[flagged]
- _mlbt 3y agoMost of our core desktop computer infrastructure was never designed with 24/7 high speed internet access in mind and it shows. I remember MS Office macros being a frequent source of security vulnerabilities as well.
- jocaal 3y agoTrying to design a perfect system is a pipe dream. There will always be interactions between components that weren't expected. The best we can do is fix the problems as they come and occasionally break some api's to build better systems with hindsight, but backward compatibility is such an essential requirement to customers.
- rellfy 3y agoThere is a difference between a design flaw and an implementation flaw though. It seems like for PDFs, those are mostly design flaws, e.g. doing potentially malicious silent tasks in the background without the user's knowledge. Although it could be argued that the OS should be the component guarding against those types of attacks instead of the PDF implementation.
- _mlbt 3y agoI completely agree, however Windows desktops are in particularly bad shape in this regard as they are the result of continuous evolution from the very first version of DOS with an attempt to keep as much backwards compatibility as possible every step of the way. Even the modern NT-based versions of Windows brought over a lot of bits from previous OSes. They were not a completely "clean" rewrite. For example, the Windows 3.1 program manager was still available on 32-bit versions of Windows XP and to this day you still can't name a file any of the following on Windows for compatibility with DOS special file names: CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM¹, COM², COM³, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT¹, LPT², and LPT³. In fact you can't even name a file any of those with an extension, such as CON.TXT.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- nness 3y agoWhy PostScript had to be Turing-complete makes no sense to me. Loops, code-execution, functions, it all seems so unnecessary for a markup and presentation language.
- mananaysiempre 3y agoTuring completeness isn’t really a huge problem (and not included in that part of PDF anyway). PostScript in its printer application doesn’t really have I/O except for, well, the printer, and no raw pointers, so there’s a smaller surface than, say, JavaScript (no network access).
- derefr 3y agoOn its own, the Turing-completeness of PostScript is not a vulnerability, per se. But it does mean that anything that interprets or renders PostScript might take an unbounded (or infinite) amount of time to do so. So PostScript-handling software — even things like virus scanners — have to be coded to handle timing out and interrupting/cancelling PostScript interpretation. (Where PostScript/PDF rendering is often the only format among many "document formats" or "image formats" handled by such software, that imposes this requirement — so when multi-format "reader" software first adds PostScript- or PDF-handling capability, it often finds itself suddenly needing to rearchitect from using single-threaded bounded-time blocking calls to parsers, to needing to use async, concurrency, timers, etc.) That being said, in combination with exploitable vulnerabilities in particular PostScript parsers used in software like Acrobat, the Turing-completeness of PostScript makes it much harder to detect such exploits. 0days in PDF readers are "nice exploits to have", because a PDF virus can be coded such that it's represented in code inside the PDF in an unbounded number of different ways, foiling signature-based virus sanners.
- anthk 3y agoThere's a ZMachine interpreter written in postscript: gs -dNOSAFER zmachine.ps -- yourgame.z3
- bee_rider 3y agoIt was the early 80’s, probably the flexibility seemed nice, and the riskiness of putting a full programming language in your documents was probably not as obvious. Thankfully we learned from them and didn’t repeat that mistake over and over again.
- mlinksva 3y agoThough it barely mentions security https://willcrichton.net/notes/portable-epubs/ https://willcrichton.net/notes/portable-epubs/ is one of my favorite essays to be posted to HN in awhile https://news.ycombinator.com/item?id=39138042 https://news.ycombinator.com/item?id=39138042 I wonder how one would measure the costs and benefits (with a focus on security) of speeding up and making more security-driven the gargantuan task of shifting to a better, well, portable document format. People are thinking big and want measurement, eg just posted https://news.ycombinator.com/item?id=39514844 https://news.ycombinator.com/item?id=39514844 WH release on memory safety https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/press-release-technical-report/ https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/pre... would it not make sense to be similarly ambitious and metrics-driven for this too?
- nonrandomstring 3y agoLot of situations I use pdftotext file.pdf - | nroff | less pdftotext is from Poppler Developers http://poppler.freedesktop.org http://poppler.freedesktop.org Glyph & Cog, LLC nroff is a GNU common util on most linux/unix systems (though I don't trust poppler utils to be secure)
- mlinksva 3y agoYeah, I wasn't referring to the security of tools used to process PDFs, including memory-safe rewrites, but that too! Instead to whether incentivizing migration to a safer portable document format couldn't be justified and done in a similar way to how memory safety is being approached now. Edit: re-reading I guess your point is that you can use tools to extract text from PDFs and then read without worry. That brings up another super annoying thing about PDFs--it's can be hard to extract text from them with high fidelity.
- nonrandomstring 3y ago> can be hard to extract text from them with high fidelity. Or impossible with scans. Usually I take a look at the filesize as a guestimate. Anyone know better FOSS OCR tools that run from cmdline?
- mistrial9 3y agocomments welcome from Leonard Rosenthol ADOBE, fifteen years as PDF architect?
- jimjimjim 3y agoI've had to fix the outline/bookmark loop problem before. It is quite an unexpected problem. There are billions of documents out there and who knows how many different pdf generators or editors (writing a pdf is easy, reading a pdf is insanely difficult). I've had normal non-malicious documents where the software trying to merge documents or move pages has caused the outline/bookmark tree to have a loop.
- westurner 3y ago> Evaluation: Out of 28 tested applications, 26 are vulnerable to at least one attack. (2021)
- jasomill 3y agoGiven how well Preview.app and Safari work for viewing >99% of PDFs I actually encounter in the wild, this article makes Apple's engineering decisions look good. It also confirms many suspicions I've had over the years that have led me to, e.g., running all PDFs from questionable sources through VirusTotal before viewing on platforms where I wouldn't normally run antivirus software. The original article also confirms my suspicions that this step is inadequate: Because the Launch action can be considered as a dangerous feature, we conducted a large-scale evaluation of 294,586 PDF documents downloaded from the Internet, in order to research if there are any legitimate use cases at all. Of those documents, only 532 files (0.18%) contained a Launch action. While none of the files was classified as malicious according to the VirusTotal database, we conclude that the Launch action is rarely used in the wild and its support should be removed by PDF implementations as well as the standard. Incidentally, the Launch action is still present in the most recent version of the PDF standard[1], with only OS-specific launch parameters deprecated (which include passing arguments to the launched executable, so eliminating deprecated features is still a significant security gain). Finally, I'm both personally and professionally curious about how the non-DoS examples in this articles may apply to non-viewer PDF tools and libraries like qpdf[2] and Ghostscript's original and recently reimplemented PDF interpreters[3]. [1] https://pdfa.org/resource/iso-32000-pdf/ https://pdfa.org/resource/iso-32000-pdf/ (registration required, but at least the base standard is available at no cost; sadly, important incorporated standards like ISO 21757-1:2020 [ECMAScript for PDF] are not) [2] https://qpdf.sourceforge.io https://qpdf.sourceforge.io [3] https://ghostscript.com/blog/pdfi.html https://ghostscript.com/blog/pdfi.html
- eskibars 3y agoAre there any sample documents for these types of attacks? I'd love to test my own service.