8 Alguém fez linux rodar dentro de um PDF (+ cybersecurity) comentada em 03/02/2025 16:27 Tecnologia Giovanni em 03/02/25 10:35 comentada em 03/02/2025 16:27 https://linux.doompdf.dev/linux.pdfThis is Linux running inside a PDF file via a RISC-V emulator, which is based on TinyEMU.Try it here: https://linux.doompdf.dev/linux.pdfSource code: GitHub - ading2210/linuxpdf: Linux running inside a PDF file via a RISC-V emulatorThis works in a very similar way to my previous DoomPDF project.You might expect PDF files to only be comprised of static documents, but surprisingly, the PDF file format supports Javascript with its own separate standard library. Modern browsers (Chromium, Firefox) implement this as part of their PDF engines. However, the APIs that are available in the browser are much more limited. This allows us to do any sort of computation inside the PDF, just with some very limited IO.C code can be compiled to run within a PDF using an old version of Emscripten that targets asm.js instead of WebAssembly. With this, I can compile a modified version of the TinyEMU RISC-V emulator to asm.js, which can be run within the PDF. For the input and output, I reused the same display code that I used for DoomPDF. It works by using a separate text field for each row of pixels in the screen, whose contents are set to various ASCII characters. For inputs, there is a virtual keyboard implemented with a bunch of buttons, and a text box you can type in to send keystrokes to the VM.Além de ser muito interessante a capacidade das pessoas, resolvi trazer isso aqui como "alerta" de segurança. Não abram pdfs de fontes desconhecidas. Se é possível rodar código dentro de um PDF, é possível fazer coisas maliciosas =)