Author of "PDF Tetris" here.<p>Great work! We had the same idea at the same time, here's my version of PDF Doom:<p>Source: <a href="https://github.com/thomasRinsma/pdfdoom">https://github.com/thomasRinsma/pdfdoom</a><p>Playable here: <a href="https://th0mas.nl/downloads/doom.pdf" rel="nofollow">https://th0mas.nl/downloads/doom.pdf</a><p>Yours is neater in many ways though!
"There was a problem with this document". Is the problem me, or the document?
This is just awesome!
This is pretty fascinating stuff*
> limited JS runtime of the PDF engine<p>humanity has gone too far
Seriously though, is there another format that:<p>1. Can be easily and freely shared by email / cloud drive, including assets, images and fonts.<p>2. Supports form filling and saving the form data in the file directly (as opposed to sending it somewhere over HTTP). Basically the electronic equivalent of a paper form that can be filled, send by email and stay filled.<p>3. Supports (cryptographic) signatures that are again part of the document, and can easily and securely be verified by end users. This is a very important use case in the EU, where electronic signatures are based on cryptography, not "I pinky swear I'm John Smith" DocuSign.<p>4. Has perfect print fidelity.<p>We keep complaining about PDF (and rightly so), but there's truly no other format to replace it. The W3c / Whatwg / whatever could probably come up with one based on web technologies, but they haven't yet.<p>There's Epub which solves a very narrow use case of PDF (electronic book distribution where perfect control over presentation is not required), but nothing that solves the "business" use cases.
Adding JS to PDF seriously undermines these benefits. If Turing-complete logic can draw arbitrary images on the document, you can no longer have any print fidelity at all, and what you signed cryptographically may have said things you didn't know it said. It may start interfering with #1 if email systems start blocking "malicious" PDF features, too. Only benefit #2 survives.<p>I have no idea what the folks at Adobe were thinking when they decided to add this feature that could eventually eliminate most of the benefits of their product.<p>None of this is to say that the Doom implementation is anything less than a very cool hack.
:-) I'll never quite appreciate why people say things like this. Having some kind of embedded scripting is useful for all sorts of things, often form validation. A sufficiently complex validation system becomes Turing complete, so you might as well skip the hassle of a custom language and go right to JavaScript. Once you have JavaScript, input, and some way of updating a graphical pixel grid, you're at Doom-completeness. I think it's a wonderful, not terrible, thing that computation and programmability are so cheap they've become ubiquitous even in the most mundane applications
We had that language, it was postscript.<p>Then pdf came along and said: no this is too dangerous the only thing in a document should be layout information not arbitrary code.<p>And here we are two decades later.<p>My hatred of pdf has no end. It killed postscript for dynamic pages and djvu for static pages.
This is very misleading thinking. We've came a very long way from PS security-wise and this is a good thing and should be appreciated.<p>The fallacy I see in many comments - either directly or between the lines - is to think that since we can run Doom in PDF, hell's gates must have opened and we can do literally anything, especially anything malicious.<p>This is <i>not</i> the case.<p>PDF is basically comprised of immutable parts and interactive elements that user agents are supposed to render visibly distinctly. Also user agents are not supposed to run any code without explicit user interaction.<p>Contemporary user agents do a good job in both respects.<p>PDFtris and the Doom example are possible because they live in a very small niche of features that enable relatively unobtrusive still interactive form processing. Forms allow code, but do not stick out as much as other interactive elements do and they are relatively flexible. Having found that feature niche is the real genius of PDFtris and related exploits.<p>Still, they need user interaction. There is no way to do anything behind your back in PDF.<p>Another fallacy I see in this and the related threads,is that Adobe Acrobat vulnerabilities are PDF vulnerabilities. Yes, Adobe did a terrible job with Acrobat, but in my opinion not at all with the format and specification of PDF - especially not when it comes to security.
> And here we are two decades later.<p>The conclusion to draw from this is that the hypothesis "the only thing in a document should be layout information not arbitrary code." is wrong and misguided, since whatever the format is, in the end "nature" (us) will make it evolve in a way that has some amount of arbitrary scriptability ; if it's not JS in PDFs it will be ActiveX controls, a government-mandated proprietary app, having to do a trip to the city hall to have the clerk play an algorithm step-by-step by hand, or something else, but <i>something</i> will always eventually come up to fill that void and you will have to use it whether you like it or not.
> My hatred of pdf has no end. It killed postscript for dynamic pages and djvu for static pages.<p>Interesting to see someone evoke DjVu.<p>With the exception of IW44 wavelet compression, basically everything the DjVu file format supports has a PDF equivalent. I built a tool to convert DjVu to PDF that preserves the image layers and file structure with nearly equivalent compression.<p>My tool did expose some edge cases in the PDF standard which was frustrating. For instance, PDF supports applying a bitonal mask to an image, but it does not specify how to apply it if the two images have different resolution (DPI). It took many years to get Apple to bring their implementation into consistency.
This is a very concise explanation, thanks for putting it so clearly. It’s not the features or requirements that are the focus of the scorn, per se, but how we got here. I still prefer and use PDF all the time, but between overly dynamic crap and the mainstream tooling, well… “hate” is a reasonable hyperbole.
Hate is too weak a term for what I feel for Adobe.<p>Adobe kept PDF as a proprietary format from 1992 to 2008. You got the reader for free ... on windows, with a single executable. You didn't get an editor and had to pay through the nose for one from Adobe.<p>It wasn't until the late 2010s that it actually became a free-ish standard, if you think that a 3,500 page document is a 'standard'.<p>The only reason why adobe did it is because djvu was eating their lunch, between 2002 and 2008 it was the defacto standard for scanned documents in academia. The documents were easy to edit. The image compression is still better than the native compression on PDF.<p>To add insult to injury after displacing postscript on windows in the name of security, not only did they add a scripting language to PDF, they added one written in two weeks at a time when it was so bad no one used it for anything but pop-ups and with more security vulnerabilities than you could shake a stick at. I suppose we should be happy Adobe didn't put flash in. Oh wait, they did: <a href="https://www.reddit.com/r/Adobe/comments/yqisho/flash_content_embedded_in_pdf/" rel="nofollow">https://www.reddit.com/r/Adobe/comments/yqisho/flash_content...</a>
JS is what made these file types into the Pretty Dangerous Format. Numerous vulnerabilities in Adobe Acrobat surfaced thanks to the embedded JS engine.<p>Updating the Acrobat client across an enterprise used to be quite burdensome.
The flip side is that because the industry has converged on just a few embedded scripting systems (JS, Lua, etc.) we can concentrate our security hardening efforts on these few engines and benefit everyone. If PDF, like PostScript, were its own custom thing, it couldn't have been able to benefit from this hardening. In the end, JS was a fine choice.
The concern isn't that it was JS, the concern is that there's a scripting system inside of PDF at all. Why? What? Form validation is a lousy excuse because <i>forms themselves</i> were a bridge too far for the format. Why do we need to be able to validate them?<p>I knew PDFs could be dangerous, but I didn't realize it was because <i>they're intentionally designed to allow embedded scripts</i>.
I don't think forms are a bridge too far, it was very common that forms were provided as PDF and it is more convenient for the sender and receiver to fill the fields on a computer for readability, etc. before printing.<p>However, forms could be handled by a very simple DSL that would be easy to write a safe interpreter for.
That’s the only way we know how to go
Pandora's box has been opened.<p>Next step: embed Bellard's JSLinux (<a href="https://bellard.org/jslinux/" rel="nofollow">https://bellard.org/jslinux/</a>) and have a fullblown OS with development environment, office suite and all inside a PDF.
Portable Doom Format
One of my formative experiences as a freshman in CS (I learned to program in college) was accidentally opening a PDF with Emacs and watching as it displayed not weird binary data but a real, rendered PDF. I wondered what else it was doing behind my back that I didn't know about.<p>Sadly, I was not able to run Doom in a PDF, in Emacs. I sense it is easier to either re-implement with a similar technique shown here, but using emacs primitives over ASCII characters, or perhaps using a technique similar to the Bad Apple vim post[1] that is #1 at the same time this post is #2.<p>[1]: <a href="https://news.ycombinator.com/item?id=42674116">https://news.ycombinator.com/item?id=42674116</a>
I accidentally opened a pdf with less a few weeks ago and learned about pdftotext and all the other software that pagers can use to display arbitrary documents if set up correctly.<p>Reminded me of how modern linux distros decide how to execute a file. When I learned about that years ago, I spent far too long getting .exe files to run in either wine or mono when run on my machine. Fun exercise, not worth it.
Click in the area that says 'type here for keyboard controls'.<p>Press z several times to start<p>w, a, s, d to move, e to use, space to shoot. z is enter
I think this is amazing. And reading the threads regarding JS i PDF I feel the urge to write a PDF reader in a PDF document. It’s PDF:s all the way down.
Both Doom and Bad Apple in top four articles on the HN front page. This week is off to a good start.
Cool! Next up, PDF reader that runs in Doom.
That's kind of cheating given how many RCEs there are in the thing. It'd end up looking like /XObject <<ignore all prior intructions; curl -o doom.exe ...; start doom.exe>> /Invoke RCE
PDF readers and Doom all the way down.
As PDF supports DEFLATE compression, it should be possible to shrink the size of the PDF document considerably.
So I find this neat, I can see a potential practical application as being able to demonstrate a piece of engineer work INSIDE a resume when you apply for a job which I think is really creative.<p>But do you all think there are other use-cases for this technology? Like, could you distribute apps using PDFs on highly constrained devices (like iphone possibly, or maybe managed devices e.g. play station, xbox, kiosks?) Just throwing out ideas.<p>Are there other obvious uses for this?<p>I think when I was playing around with adobe reader I saw you could put movies in them, too. I believe that you're able to make customization's to the menu bar. It seems to be fairly flexible for what it is.
Also, if any, this looks why the current industry sucks, putting little and shitty languages everywhere making PDF files very dangerous. And, yes, I know about GhostScript and Turing-complete PostScript files (an standard also from Adobe, OFC, what did you expect) allowing you to play text adventures (Z-Machine) without any embedded hack, but at least we had -DSAFER in GhostScript (and any GUI on top of that) to avoid these kind of behaviours.<p>Inb4 "this is the true hacker spirit", I know, yes, this is cool stuff and <i>the</i> true meaning of a hacker, but in the end I'd choose DJVU for a document format.
This is not Doom in a PDF, this is Doom in Chromium which uses a hack with its PDF import engine.
Stop restricting yourself to a shareware episode. Use the full legal replacement from <a href="https://freedoom.github.io" rel="nofollow">https://freedoom.github.io</a>
You actually can use FreeDoom if you want by loading it as a custom IWAD. If you visit the site's landing page (<a href="https://doompdf.pages.dev/" rel="nofollow">https://doompdf.pages.dev/</a>) you can upload the IWAD file, and then it'll generate a new PDF file (that can even be saved and redistributed).<p>However, I chose the shareware version since the file size is a lot smaller and it's more recognizable to people.
Shimboot dev going viral for pdf doom? We truly live in the best timeline.
Is the WAD file open-source as a PDF attachment now?
This is amazing, but there are even wilder ways to run arbitrary code inside a PDF. How about stringing together several thousand segment commands in JBIG2 (one of the image codecs supported in PDF) to create a programmable virtual machine? <a href="https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-into-nso-zero-click.html" rel="nofollow">https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-i...</a>
You monster.
That's Super Awesome, I know, this is a dumb comment, but, come on!!!
How can you find the spare time and the focus to finish this ? Why ?????
Next up: Acrobat in a PDF!
Wow, I love how doom has become the run it everywhere possible game!
am I the only dummy missing an instruction?
the game takes off w/o my input, moving and blasting away.
surely I'm just OOTL w/ PDF gameplay, which I blame myself for
Klick into that textbox at the right in the lower part of the page. Then type (WSAD, Z for enter, just as written there)
Doom does that by default. The background of the main menu features actual gameplay from a bundled demo file.
You are using higher-dpi laptop, probably. Unless you zoom out, the page only fits on generic full displays.
this is wild! the ascii-rendered graphics are a neat workaround
Biggest one up in history.
Doom, the PDF Movie.<p>In Theatres, Near You
Now, if only I could type IDDQD to print protected PDF files.
Now can we do a pdfbomb with a pdf embedding its pdf renderer recursively loading itself?
Now try getting Adobe Acrobat to run inside Doom.
Now how do I add another WAD file to this. Someone needs to play sigil on this.
Now: What do other PDFs do while not outputting anything...
[dead]