lainchan / sec
help, I'm too scared to open all these books
Acid Burn · 2022-05-25 12:31
I use Evince which doesn't support Javascript, but there are other ways to compromise a PDF file. Even DjVu format, which is supposed to be just jpegs and text, has had exploits.
I was going to try converting suspicious PDFs to DjVus to just strip/mangle everything, but now I'm worried about that too. If an exploit attacks a library common to both the reader and converter, can converting a compromised file have the same result as if you opened it in a reader?
Of course that doesn't solve the problem of books that were originally in DjVu format; it seems there's no way to convert those into any other formats.
And why does pdf2djvu need curl??
Please advise.
Unnamed · 2022-05-25 13:25
Dumb question but couldn't binwalk reveal if a pdf contains something it shouldn't contain? Also, try scanning the pdfs using ClamAV.
Zhora · 2022-05-25 18:57
Qubes OS was literally designed for the exact problem you are having OP. In Qubes, you can open a PDF in a temporary disposable virtual machine with no network connection, and when you close the windows, the disposable virtual machine will be discard. If the PDF had embedded malware, it won't be able to escape its sandbox and will be discarded without affecting the system or ever getting to the network
Motoko Kusanagi · 2022-05-25 19:08
>>19372
but if your less schizo than Qubes but still schizo enough, a good compromise is:
>create a VM with no network and copy PDF to it
>convert each page to a raw bitmap image format
>stitch the bitmaps back together into a DJVU
odds are, the conversion to raw bitmaps would have destroyed any malware. If you don't trust the conversion process itself (malware might have screwed with the conversion), you could theoretically count the bytes in each raw bitmap as a sort of checksum that verifies nothing else has been added to the file (raw bitmaps are literally just 1 big matrix of pixel data, a 100x100 image with 8-bit, 3 color channels should theoretically be 100x100x8x3 = 240,000 bytes in size, no more no less)
Ishikura "Tatsu" Tatsuhiko · 2022-05-25 22:28
>>19366
if you're on linux look into flatpaks. You can set permissions for a PDF viewer in a way that it can't access anything on the filesystem except for the place where you store books, no internet connectivity, no access to usb devices, etc.
Jet Black · 2022-05-26 05:08
>>19374
>flatpaks
Or just bubblewrap.
Pulse · 2022-05-26 07:42
>>19375
first time I've ever heard of this. Interesting project.
Cat Mother · 2022-05-26 08:48
>>19373
>If you don't trust the conversion process itself (malware might have screwed with the conversion)
I'm not worried about "smart" malware as much as the exploit designed against the reader also working against the converter.
IE you have to read the file first to know what you're converting.
What programs do you recommend for doing conversion and stitching?
Do you know any ways to do it to DjVu files?
>>19374
>>19375
How resistant are sandboxes to break-outs? Better or worse than VMs?
Unnamed · 2022-05-26 09:43
>>19379
>How resistant are sandboxes to break-outs? Better or worse than VMs?
Worse in general/theoretically. VM should really be seen as an extra layer of security over everything else, because you can run a sandbox or container or whatever inside the VM too.
DJVU is much safer than PDF in general. Anything that lets people embed scripts is going to be a security nightmare. Personally I always convert files with pdf2djvu, usually in a strict firejail container. Then open with djview also in a firejail container. Your personal security requirements might be stricter in which case I recommend Qubes.
>why does pdf2djvu need curl?
Why not look at the source code yourself?
Rick Deckard · 2022-05-26 14:17
https://github.com/freedomofpress/dangerzone
Demeere · 2022-06-15 11:12
>>19366
open them inside a "via" cpu -thinstation or something else other than x86
maybe even arm11 or v7 just werks
otherwise use an online service that converts documents to images i guess.
something like imagemagick should do the trick
buddy boy · 2022-06-15 13:26
>>19366
Stop being smelly and open those PDFs.
Agent Jones · 2022-07-15 19:26
Supposedly, opening PDFs in a web browser is actually very secure because Javascript is memory-safe, plus the viewer is running inside the browser's sandbox.
As for bubblewrap, these scripts were posted on /Ω/ a while ago. I seem to remember the OP saying firejail had some issues compared to bubblewrap.
https://git.sr.ht/~q3cpma/scripts/tree/master/item/bwrap.bash
https://git.sr.ht/~q3cpma/scripts/tree/master/item/bwrap_auto.bash
Boris Grishenko · 2022-07-18 00:15
>>19382
This guy gets it
Drano · 2023-01-30 07:09
>>19381
What pdf2djvu settings do you use? Sometimes my Djvu files come out 10 times the size of the original PDF.
Roy Batty · 2023-02-01 22:32
>>19388
firejail is a lot easier to use.
The config file format could be a lot better, and there are many exploits which work by compromising firejail configs and then using them to get superuser, but generally I think if you practice good hygeine firejail is a very good and easy way to make your system more secure.
Joey · 2023-02-01 23:30
>>20914
Adding onto this: an easy mitigation for those attacks you speack of is to set the +i flag on your config files/folders.
Tequila · 2023-02-07 15:41
>>20914
Any good examples?
>>20915
Thanks!