Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back to your course on building a secure ThinkPad.
Introduction
In our last lesson, we established the foundational practice of compartmentalization by creating persistent AppVMs like work and personal-banking. These qubes are designed for trusted, ongoing activities, and they maintain their state across reboots.
However, a significant portion of digital risk comes not from our routine tasks, but from the unexpected: an unsolicited email attachment, a strange link in a message, or a file downloaded from a questionable source. Handling these in a persistent AppVM is risky; a malicious file could compromise the qube and its data, and the infection would persist.
This lesson introduces the Qubes OS solution for this exact problem: the DisposableVM. By the end of this session, you will be able to use a DisposableVM in Qubes OS to safely open a potentially malicious document downloaded from the internet. We will explore what DisposableVMs are, why they are a cornerstone of secure workflows, and how to use them in practice.
1. The "Why": The Need for Ephemeral Computing
The core idea behind a DisposableVM is to create a "clean room" environment for a single, untrusted action, and then burn the room down afterward. This concept of ephemeral, or temporary, computing is a powerful security primitive.
For many professionals, such as journalists, activists, or even founders evaluating unsolicited materials, handling untrusted files is a daily reality. Let's start by seeing how a security expert uses this feature in his own work.
Qubes OS: The Operating System That Can Protect You Even If You Get Hacked
To understand the real-world necessity of DisposableVMs, let's watch this segment by security journalist Micah Lee. He explains how he uses them as a core part of his workflow to handle untrusted documents safely.
Watch from 07:28 to 09:29. Pay close attention to his explanation of what happens even if the document is malicious and successfully exploits the application (LibreOffice in his example). This is the key security guarantee of a DisposableVM.
As Micah Lee demonstrates, even if the malicious document successfully hacks the virtual machine it's opened in, the damage is completely contained. The DisposableVM has no access to any of your other data, and the entire VM—along with the malware—is irrevocably destroyed the moment you close the application window. The threat is neutralized before it can establish persistence or move laterally.
2. The "What": Understanding the DisposableVM Lifecycle
Now that the "why" is clear, let's formalize our understanding of what a DisposableVM is and how it differs from the AppVMs we created in the last lesson.
The official Qubes OS documentation provides a precise definition of disposables and how they function. This will give us the formal concepts behind the practical demonstration we just saw.
Please read the introduction ('How to use disposables') and the section 'Named disposables and disposable templates'. Focus on the distinction between a disposable template (e.g., fedora-38-dvm) and the actual disposable (disp####) that is created from it.
To synthesize the key points from the documentation:
- A DisposableVM (or "disposable") is a lightweight, single-use qube.
- It is generated on-the-fly from a pre-configured Disposable Template. In a default Qubes installation, you have templates like
fedora-XX-dvmandwhonix-ws-XX-dvm. - When you open a file in a disposable, Qubes OS performs the following actions:
- It rapidly creates a new, empty qube with a random name like
disp1234. - It copies the target file (e.g.,
suspicious.pdf) into this new qube. - It launches the appropriate application inside
disp1234to open the file. - When you close the application,
disp1234is automatically shut down and its entire file system is deleted.
- It rapidly creates a new, empty qube with a random name like
This relationship is analogous to classes and objects in programming: the Disposable Template is the class definition, and the disp#### qube is the temporary object instance.
3. The "How": A Practical Exercise
Let's put this into practice. We will simulate a common scenario: you've downloaded a document into your work qube and want to inspect it without exposing that qube to any risk.
Step 1: Create a Test File
First, we need a "suspicious" file to work with. We'll use a simple text file for this exercise, but the principle is identical for PDFs, Word documents, images, or any other file type.
- Open a terminal in your
workAppVM. (Application Menu -> Qube: work -> work: Terminal) - Create a directory to receive untrusted files. This is good practice for organization.
mkdir -p ~/Downloads/untrusted - Create the dummy document.
echo "This document could contain anything." > ~/Downloads/untrusted/analysis-report.txt
Step 2: Open the File in a DisposableVM
Now, we'll use the Qubes GUI to open this file safely.
- In your
workAppVM, open the File Manager. (Application Menu -> Qube: work -> work: Files) - Navigate to
Downloads/untrusted. - Right-click on the file
analysis-report.txt. - From the context menu, select View in disposable.

You will see a notification that a disposable qube (disp####) is starting. A moment later, a text editor will appear with the contents of your file.

Take note of two crucial details:
- The window's title bar will say
[disp####] ..., not[work] .... - The colored border of the window will be the color assigned to disposables (typically red by default), not the blue you assigned to your
workqube.
Step 3: Observe the Self-Destruction
- Close the text editor window.
- Watch the Qube Manager widget in your notification area. The
disp####qube will appear briefly as "shutting down" and then vanish completely from the list.
The process is complete. Any potential malware that might have been in the file has been contained and eliminated.
To reinforce this, the following short clip provides another clear demonstration of the same process.
Qubes OS: How it works, and a demo of this VM-centric OS
This clip provides another clear demonstration of opening a file in a DisposableVM, reinforcing the steps we just discussed.
Watch from 11:58 to 12:48. The presenter performs the exact action we are practicing: right-clicking a file and choosing 'View in disposable vm'.
The Command-Line Method
Given your background, you'll appreciate that this can also be done from the command line, which is useful for scripting or automation.
From a terminal in the AppVM containing the file (in our case, work), you can use the qvm-open-in-dvm command:
qvm-open-in-dvm ~/Downloads/untrusted/analysis-report.txt
The terminal will wait and only return you to the prompt after you have closed the application running in the disposable.
4. A Note on Editing Files
You may have noticed an "Edit in disposable" option in the context menu. This works similarly to "View," but with one key difference: if you make changes to the file and save it, the modified file is safely copied back to the originating AppVM, overwriting the original.
This is a powerful feature. It allows you to work with a potentially untrustworthy document using a potentially vulnerable application (e.g., editing a complex .docx file in LibreOffice). Even if the application is exploited during your editing session, the exploit is contained within the disposable. When you save your work, only the clean data of the file itself is transferred back, not the compromised application state.
Conclusion
Today you've added one of the most powerful tools in the Qubes OS arsenal to your skillset. You now understand how to handle untrusted files and links without jeopardizing the integrity of your system.
Key Takeaways:
- Persistent AppVMs are for trusted, ongoing work where data needs to be saved.
- DisposableVMs are for single-use, untrusted tasks, providing an ephemeral environment that self-destructs after use.
- This "contain and destroy" model effectively neutralizes threats from malicious files and links at their source.
- The standard method is to right-click a file and choose View in disposable or Edit in disposable, a process that can also be initiated from the command line.
We have now established robust practices for compartmentalizing your tasks, both persistent and ephemeral. The next major frontier is network anonymity.
In our next lesson, we will begin Module 7: Achieving Anonymity with Whonix and Tor. We will explore the fundamental principles of the Tor network and install Whonix, a specialized pair of Qubes templates designed to enforce Tor routing, isolate network streams, and prevent IP address leaks.