How many times have you heard “Don’t open attachments”? It’s a solid advice, but 1. most people don’t follow this advice and 2. depending on your job ( i.e journalist ) most of the time it’s almost impossible to follow.
PDFs and office documents are incredibly complex. They can be made to automatically load an image from a remote server when the document is open, tracking when a document is opened and from what IP address. They can contain JavaScript or macros that, depending on how your software is configured, could automatically execute code when opened, potentially taking over your computer. And finally, like all software, the programs you use to open documents – Preview, Adobe Reader, Microsoft Word, LibreOffice, etc. – have bugs, and these bugs can sometimes be exploited to take over your computer. ( You can reduce your risk of getting hacked by always installing your updates, which fix the bugs that software vendors are aware of. )
For example, if an attacker knows about a security bug in Microsoft Word, they can carefully craft a Word document that, when opened using a vulnerable version of Word, will hack your computer. All they have to do is trick you into opening it, perhaps by sending you a convincing enough phishing email.
Dangerzone aims to fix this problems by allowing you to convert PDFs, MS Office or LibreOffice documents and even images to safe PDFs.
Dangerzone was inspired by Qubes trusted PDF and uses containers as sandboxes instead of virtual machines (using Docker for macOS, Windows, and Debian/Ubuntu, and podman for Fedora).
Features
- Sandboxes don’t have network access, so if a malicious document can compromise one, it can’t phone home
- Dangerzone can optionally OCR the safe PDFs it creates, so it will have a text layer again
- Dangerzone compresses the safe PDF to reduce file size
- After converting, Dangerzone lets you open the safe PDF in the PDF viewer of your choice, which allows you to open PDFs and office docs in Dangerzone by default so you never accidentally open a dangerous document
Supported formats
- PDF (
.pdf
) - Microsoft Word (
.docx
,.doc
) - Microsoft Excel (
.xlsx
,.xls
) - Microsoft PowerPoint (
.pptx
,.ppt
) - ODF Text (
.odt
) - ODF Spreadsheet (
.ods
) - ODF Presentation (
.odp
) - ODF Graphics (
.odg
) - Jpeg (
.jpg
,.jpeg
) - GIF (
.gif
) - PNG (
.png
) - TIFF (
.tif
,.tiff
)
Dependencies
Download and installing Dangerzone
- Download Dangerzone for Windows
- Download Dangerzone for macOS. Alternatively you can install Dangerzone via Homebrew with
brew install --cask dangerzone
- Linux users: check the wiki for installing Dangerzone
How does Dangerzone work?
The first container:
- Mounts a volume with the original document
- Uses LibreOffice or GraphicsMagick to convert original document to a PDF
- Uses poppler to split PDF into individual pages, and to convert those to PNGs
- Uses GraphicsMagick to convert PNG pages to RGB pixel data
- Stores RGB pixel data in separate volume
Then that container quits. A second container starts and:
- Mounts a volume with the RGB pixel data
- If OCR is enabled, uses GraphicsMagick to convert RGB pixel data into PNGs, and Tesseract to convert PNGs into searchable PDFs
- Otherwise uses GraphicsMagick to convert RGB pixel data into flat PDFs
- Uses poppler to merge PDF pages into a single multipage PDF
- Uses ghostscript to compress final save PDF
- Stores safe PDF in separate volume
Then that container quits, and the user can open the newly created safe PDF.
Usage:
1. Open Dangerzone, and click on Select dangerous document ...
2. Browse your computer and select the compatible file that you want to convert.
Click on Save as...
to choose where you want to save the converted file and its name.
Also choose which app should be used to open the safe file after convertion, and language is necessary.
3. Now click on Convert to Safe Document
and wait. Depending on the file you want to convert this can take a while.
4. When it’s done, the converted file will be opened in the app of your choice. Below you can see the result. Original ( up ) vs converted ( down ).
I’m not sure what kind of compressions Dangerzone applies ( as said in the features ) but the converted file is over 3X bigger. Otherwise there is no difference.
For more info and troubleshooting check out the official project page on GitHub.