<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>The Invisible Things</title>
    <description>My personal blog and website (see http://blog.invisiblethings.org/)</description>
    <link>https://blog.invisiblethings.org/</link>
    <atom:link href="https://blog.invisiblethings.org/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Mon, 13 Nov 2023 14:27:33 +0000</pubDate>
    <lastBuildDate>Mon, 13 Nov 2023 14:27:33 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>Debunking the myth of the dark Web</title>
        <description>&lt;p&gt;This is a blog post I found while exploring the dark Web a long time ago, and it caught my eye after reading a few paragraphs. The author, whose name is Alice, has taken a rigorous attitude, devoting 7,000 words to the ins and outs of the dark web, and the examples cited in the article are all footnotes (up to 44), which shows that the author has spent a lot of energy, and has a very professional level, and is completely writing a serious paper. In order to read the convenience, I deleted the footnotes, readers if there is a deep interest, you can see my personal website blog, I am afraid to add a link to the article will be blocked… (website to see the signature should be written, the site for two years, the number of page views but I ~~ hahahaha).&lt;/p&gt;

&lt;p&gt;First of all, write some of their own reading, the article is very long, readers need to calm down to straighten out their ideas, the article likes to drop the Internet book bag, involving rich knowledge points, many knowledge points are not available to the average person, but also gave the footnotes, if seriously reading, it is estimated that there is no certain level to spend some time to see the footnotes. Such an article is much smarter than a cool article with a few gory and scary photos to create a scary atmosphere of the dark web. What I admire more is the author’s ability and attitude, as well as the feelings full of idealists.&lt;/p&gt;

&lt;p&gt;The article made me lament that there was already a blueprint for anonymous electronic money transactions in 1981, and until now Bitcoin has only been a tool for human evil (money laundering/black market/manipulation). In fact, even the original idealist free/equal Internet is very different from today’s centralized/monopolistic Internet. It’s ironic that what started out as a well-intentioned tool to defend everyone’s privacy has instead been used by the evil of humanity to become a monster that everyone is Shouting at.&lt;/p&gt;

&lt;p&gt;It is even more ironic that on the open platform of the Internet, the material about the dark web is so incendiary and arouses emotions that most people have little understanding of it. (Most people’s understanding of the virus is also the same) and on the so-called “dark web” this private platform, it is rigorous and objective to describe its past life.&lt;/p&gt;

&lt;p&gt;The same is true of human history, where the few deceive and control the many; There is also an idealistic minority who want the majority not to be deceived and controlled. So far history has repeated itself, but I believe it will have a different future.&lt;/p&gt;

&lt;p&gt;With the full text –&lt;/p&gt;

&lt;p&gt;Debunking the myth of the dark Web&lt;/p&gt;

&lt;p&gt;Author: Alice&lt;/p&gt;

&lt;p&gt;Published: November 17, 2017&lt;/p&gt;

&lt;p&gt;Technology pioneers’ quest for Internet freedom began shortly after the Internet was born. In 1981, cryptographer David Chaum designed an anonymous E-mail system, and a few years later outlined a blueprint for an anonymous electronic money exchange system in a paper declaring that it “would render Big Brother obsolete.” Three years later, TimothyC. May argued that just as printing weakened and changed the medieval guilds and social power structures, cryptography would do the same. A small wire fence made it possible to build vast farms and ranches in the Western United States, and the small branch of mathematics known as cryptography became a sharp pair of scissors to strip away the wire fence surrounding “intellectual property.” In 1993, Berkeley scholar Eric Hughes further supplemented the basic idea: We cannot expect governments, corporations, or other faceless giant institutions to benevolently grant us privacy, and if we expect privacy at all, we must stand up and defend it.&lt;/p&gt;

&lt;p&gt;The anonymous web technology we see today is the result of the efforts of these hackers. Unfortunately, their years of hard work have been seriously distorted in the past few years, and they have become what the media calls the “dark web.” While the Silk Road is partly to blame for this, it is largely to blame for the wild urban legends that, because of their dramatic and mysterious nature, are widely disseminated on social networks and half-understood subject media. They will tell you that the entire Internet as we know it is only 5% of it, and that more than 95% of the content is on the “deep web” and the “dark web.” So who’s involved? There are alleged secret societies, mafias, human experimentation, illegal drugs, human trafficking, and hidden conspiracies. Today darknet, tomorrow darkweb, then deepweb, in short, all kinds of buzzword, and “Internet security” is not a word.&lt;/p&gt;

&lt;p&gt;These myths have serious implications not only for anonymous technologies and their communities, but also for Internet privacy and security itself. In order to dispel such myths, it is necessary to conduct a simple research on the sources of these claims, so that history can be used as a mirror to recognize the facts, and over-exaggerated conspiracy theories can be destroyed. Finally, we need to recognize the misleading and harmful nature of the term “dark web” and recommend that we stop using the term “dark web” and use other terms, such as “anonymous web.”&lt;/p&gt;

&lt;p&gt;Due to the short writing time, the article is not only very long and lax sorting, I hope readers can understand.&lt;/p&gt;

&lt;h1 id=&quot;deepweb&quot;&gt;Deepweb&lt;/h1&gt;

&lt;p&gt;Before dealing with the confusing definition of the “dark web,” let’s first talk about the uncontroversial “deep web.”&lt;/p&gt;

&lt;p&gt;“Deep Web” is a term used in web search to refer to content that exists on the Internet but is not indexed by search engines. The simplest examples are websites that require a login to view, public databases that require a form to query, and so on. Many studies believe that the scale of the data that has not been included is much larger than the scale of the network data that can be searched, and the public data is clearly on the network, but can not be found by search engines, so it is a major problem that search engines need to solve. Especially in the early days of Internet development, when search engines were not perfect, relevant reports appeared almost every few years. There are also academic teams that have built tools to help users query deep Web data, which is where the claim that only 5% of the Internet we see comes from. For example, this report by ABC Australia in March 2010 even used “iceberg” as an example, which foreshadowed the legend in the future.&lt;/p&gt;

&lt;h1 id=&quot;early-meaning-of-darknet&quot;&gt;Early meaning of Darknet&lt;/h1&gt;

&lt;p&gt;The term “darknet” had several early meanings, none of which have anything to do with today’s urban legend usage. The first meaning, which is closer to its literal meaning, refers to an address space on the Internet that has assigned IP segments and routes, but does not actively run any network services or servers. Therefore, any packet entering this IP address space seems to be entering a black hole, hence the name “dark web”. Such networks can act as a kind of honeypot, deploying logging and intrusion detection systems to track malicious traffic on the Internet, such as network viruses, DDoS attacks, etc., because any data attempted to send to the “dark web” is inherently problematic. The term appears in several papers on network architecture and security research, such as this MIT paper, and the team can be reached at darknet@mit.edu…&lt;/p&gt;

&lt;p&gt;The second, more interesting implication, comes from a paper published in 2002, which suggests that the “dark web” is not a separate physical network, but rather a layer of applications and protocols on top of the network, such as “P2P file sharing, CD and DVD copying, and keys and passwords shared in email and newsgroups.” The reason for this alarmist description is that the paper, written by Microsoft developer PeterBiddle for digital rights management technology, argues that such private web sharing poses a serious challenge to DRM, which they do not want to see. Around the same time, groups led by the RIAA and the MPAA began a harsh crackdown on piracy in the name of protecting artists, and many American Internet users had a lot to say about it. In 2005, journalist J. D. Lasica published a book titled Darknet: Hollywood’s War Against the Digital Generation, a book that describes Hollywood’s copyright wars, the open Culture movement, etc., is also the meaning of the “dark web”. At the same time, the Freenet project, which has been active since the beginning of this century, also released a new version of v0.7 in 2007, adding a “dark web” mode, meaning that Freenet will only be connected to the trusted friend node for data exchange, so as to improve the privacy of user communication and avoid interference from outsiders. Here, the “dark web” is the same definition.&lt;/p&gt;

&lt;p&gt;The third meaning refers to the network used for organized crime. This usage was first seen in the special research on online extremism and terrorism of Arizona State University, which used web crawler, statistics, natural language processing and artificial intelligence technologies to conduct a large amount of data analysis on the network promoting terrorism, and studied the operation mode and communication characteristics of such communities. In a 2003 slide study, the “dark web” was defined as the other side of the Internet, used by terrorist and extremist groups for propaganda. In 2006, a feature report on the study was picked up by NPR, Fox News and others, probably the first time a news outlet used the dark Web. But it’s worth noting that the “dark web” here doesn’t have any meaning of “anonymous,” “encrypted,” or “secret,” and that the terrorist websites in question are all accessible directly from a browser (the slideshow begins with sites that promote extreme racism, such as Stormfront, as an example), and that Tor wasn’t mentioned until recently. As a result, the term “dark web,” which is the most widely abused term in today’s sense and pervades media reports and urban legends, still does not exist.&lt;/p&gt;

&lt;p&gt;It was not until November 2009 that The Guardian reported on The dark side of the internet, which briefly covered the Pirate Bay, the development of Freenet, and the existence of illegal content on the web. The Reddit forum’s /r/darknet/ section was created around the same time, apparently in response to the news. However, there is only a brief mention of Tor and links it to the “dark web”, saying that it is a Freenet-like system, but there is no mention of Tor’s Hidden Service features, and the time is set for all of 2010. Typing Darknet or Darkweb still yields no results, except for a puzzle game of the same name and something like a “Dark Web Color Scheme Guide.” A search of Tor Hidden Service, however, turns up some technical data. It can be seen that until 2011, the anonymous website technology itself, such as Tor, and the various shady websites hosted by it were still not associated with the term “dark web”, and its modern usage was still not formed.&lt;/p&gt;

&lt;h1 id=&quot;silk-road&quot;&gt;Silk Road&lt;/h1&gt;

&lt;p&gt;The turning point came in February 2011, when Silk Road launched after six months of development. Just four months later, tech media outlets like Gawker and Motherboard were the first to report on the black market for drugs operating on Tor. However, the words “deep” and “dark” did not appear in the news at all, only the role played by Tor was mentioned, and then more mainstream media followed up, and Congressman Charleschumer’s attention called on law enforcement agencies to act. But in these early articles, there was no mention of the “dark web” or “deep web,” instead focusing on Bitcoin.&lt;/p&gt;

&lt;p&gt;Meanwhile, in April, Anonymous members launched the #OpDarknet initiative, claiming that one of their IRC servers had begun blocking proxy servers, Tor, and VPNS, and called on Anonymous members to use i2p. This is probably the earliest modern use of Darknet. In October of the same year, Anonymous launched an attack on the child pornography site Lolita City on Tor and the Freedom Hosting service, exposing a large amount of user data, and again using the #OpDarknet banner, claiming to seek justice. Then, in reports in the Huffington Post and The Wall Street Journal, there was a natural interpretation of one of the terms “Darknet,” which said it “protects dissidents from government crackdowns but also serves as a venue for everything from drugs to child pornography.” According to the former, “The sites on Darknet are part of the Invisible Web, sometimes called the Deep Web, which includes content other than the Surface Web that is indexed by search engines.”&lt;/p&gt;

&lt;p&gt;Over the course of the year, some individual blogs began to refer to the Tor HiddenService as “deep web” and “dark Web”, such as using Anonymous’s Operation Darknet captions. At this point, the term “dark web” was first associated with these anonymous sites on Tor and confused with “deep web,” a usage that would continue to spread. Soon after, the famous image of the iceberg appeared, and the earliest documented appearance of the image was this version uploaded to Imgur on May 31, 2011, which has been viewed more than 150,000 times. It compares the Internet to an “iceberg” and places easily accessible sites above the water, while lesser-known sites that require technical tools are placed below, and asks if any of its readers have reached the deepest level of the water. The image is poorly reworked and in poor quality, and it also suggests that niche forums such as 4chan, 808chan, 7chan and 420chan are the dividing lines above and below the water. It stands to reason that the image first appeared on a discussion post on 4chan before it was uploaded to Imgur. Full of 4chan’s usual color of abuse and parody, it soon aroused the attention of unknown outsiders, leaked out of 4chan, and was posted elsewhere.&lt;/p&gt;

&lt;p&gt;In one Reddit post, for example, the user asked /r/askreddit what the image meant and got 161 votes. It was around this time that the standard “deep web” and “dark web” myth that “the entire Internet is only 5% known of it, and that more than 95% of the content is located on the deep web and dark web, and that there are” government secrets, secret societies, mafias, human experimentation, illegal drugs, human trafficking “claims began to emerge. The most prominent example is the “Mariana Net,” which was posted around the web in June 2011. It takes its name from the Pacific Ocean’s Mariana Trench, which refers to the deepest and most secret corner of the so-called “dark Web,” and is the subject of many urban legends. This statement is likely to have been directly influenced by the “iceberg” image.&lt;/p&gt;

&lt;p&gt;By the end of 2011, such claims were widespread. We don’t find the original urban legend text, probably because it originated on 4chan and other imageboards and is no longer recorded, but references to it can be found everywhere, such as in the K-3 BBS of Taiwan villagers, where the discussion is very conspiracy-tinged; In this Channel 4 news report on September 1, the word “Darkweb” also appeared; Reddit’s /r/deepweb/ section was created in June 2011; By 2012, “Darkweb” had been frequently seen in mainstream media, such as this BBC report about illegal drugs on the “dark web”; A book called Deep Dark Web was published the same year; After the FBI shut down Silk Road and arrested those involved in the case in 2013, public opinion reached its climax, eventually forming the current Tor = “dark web” situation.&lt;/p&gt;

&lt;p&gt;In short, we can see that the “dark web” had almost no use before 2010. After that, Anonymous’ #OpDarknet was the first to bring the term to public use. With the launch of the Silk Road that same year, the media quickly confused the meaning of “deep web” and “dark web.” At the same time, 4chan users also naturally noticed these phenomena, and produced “iceberg” pictures to discuss and joke. As a result, all the media were misled by 4chan’s “masterpieces”, so that the “deep web iceberg” theory entered the official news report. During this time, various rather dramatic urban legends began to spread, such as the “Mariana Net,” which eventually became the nonsense we read today, such as this one.&lt;/p&gt;

&lt;p&gt;Anyone browsing foreign urban legends on Reddit is no doubt familiar with the term “deep web.” It’s a domain that lurks beneath the web as we know it, that you can’t find through a search engine or a web site, that’s full of all kinds of unimaginable illegal activities, like drug smuggling, arms dealing, hacking, money laundering, human trafficking, you can even buy murder through the dark Web, join a cult, buy and sell organs, Or livestreaming perverted killings or watching child pornography. Even more striking is that the content of the dark web accounts for 94% of the entire web, in other words, the pages that we can normally access, only account for 6% of the entire web. The hacker successfully hacked into the “dark web” full of evil activities, and witnessed the extreme torture images that left him with a lifetime of shadow.&lt;/p&gt;

&lt;p&gt;If the general domain is an iceberg, then the dark web is the bottomless ice beneath it. To access The dark web, you have to go through a system called Tor, a technology originally developed by American military scientists that allows all users to remain anonymous on the Internet, also known as The Onion Router because the passwords that protect data are layered on top of each other like an onion. Since such technology has fallen into the hands of people with a heart, it has become a dark world, if you want to also through the Internet to provide teaching into the dark web, but those who enter the dark Web hackers definitely have a way to find your server in the first time, even your IP address, causing a threat to life.&lt;/p&gt;

&lt;h1 id=&quot;stop-using-the-term-dark-web&quot;&gt;Stop using the term “dark web.&lt;/h1&gt;

&lt;p&gt;Thus, the “dark web” is an ambiguous and heavily mixed term that has not only lost any definite meaning in itself, but has also become associated with various urban legends. First, the term “dark web” is riddled with factual errors, such as “astonisingly, the dark Web accounts for 94% of the web’s content”, in order to attract readers’ attention, without mentioning the true size of Tor Hidden Service. The OnionScan project scanned the entire Tor network in 2016 and found a total of about 30,000 sites, and with Freedom Host II going offline, the number of Onion sites has reached an all-time low of about 4,000 (if I were a media outlet, I’d write this: Shock! The Dark Web has become 80% darker! ). In addition, according to the statistics of Tor Metrics, the current Tor network can exceed 100 Gbps of traffic, but Hidden Service traffic only accounts for 1.5 Gbps, about 1% of the entire network traffic, most of the traffic is almost through the exit node browsing the World Wide Web. Instead of being “94% of the web,” building websites and services is one of the community’s top priorities. For lurid dramatic effect, these urban legends also exaggerate the violent elements of the Internet, and while it is true that some vicious outlaws use Tor to cover themselves, the extent of it is exaggerated, and much of it is completely false, like the “invisible dark world”. If you want to, you can also access the dark Web through the education provided on the Internet, but those who enter the dark Web definitely have a way to find your server in the first time, even your IP address, causing a threat to life “, as if I open two pages with Tor Browser, I will be killed? Are you sure you haven’t been watching too much Hell Girl? Even the characters didn’t die that fast… Moreover, there is a huge amount of malfeasant activity happening every day on the open Internet, at least at the same level, if not as serious, as on the so-called dark Web; At the same time, these urban legends resort to mystery and conspiracy, and not only do not play an applied role in popularizing cybersecurity knowledge, but also mystify security technology.&lt;/p&gt;

&lt;p&gt;This leads directly to serious consequences. For example, the British police recently said that visiting the so-called “dark web” indicates that you may be a terrorist, and encourages citizens to actively report to the police, in case someone sees Tor Browser in the future, someone will call the police. Second, it seriously misleads newcomers to treat anonymous web technologies with a distorted mindset, and especially to use them in a curious manner, rather than as a practical security tool, always trying to dig something out of the ground. Tor developers in a speech last year, for example, one after the researchers see https://facebookcorewwwi.onion/ was amazed at the meeting asked him: “what’s the matter? Why did I find a dark Facebook on the dark Web?” Ironically, this version of Facebook allows activists in authoritarian countries to speak out without revealing their geographic location. Readers who read the comments on Alice’s blog, saying that they were “shocked to see the ‘dark web’ with Chinese characters for the first time,” may have been misled. Finally, this has a negative impact on the developers of anonymous web technologies and the community as a whole, meaning that exaggerating urban legends will encourage more and more people to set up websites dedicated to publishing content related to urban legends, rather than providing innovative, practical and safe web services. This image will become self-reinforcing and will only lead to the deterioration of the entire online community environment. Internet privacy cannot be promoted.&lt;/p&gt;

&lt;p&gt;Commenting on a browser plugin called Darkweb Everywhere, Tor core developer Roger Dingledine blasted it:… I can’t accept the name: I don’t want to promote such dark images of icebergs at all.” The term “dark web” only exaggerates and reinforces the FUD that HiddenService is facing. We’ve been debating these terms lately, and I now tend to favor The term “The PrivateWeb.” While it conflates the security features that users get from Tor with the security features that websites get, both are really necessary, so I have no problem with the name; The Tor team’s speech at the 2015 CCC conference also mentioned that people need to realize that Tor is just another network protocol. If we need to transfer plaintext web pages, we use HTTP; If we need secure delivery of web pages, we use HTTPS, if we need self-authenticated, end-to-end encrypted anonymous delivery, we use Onion, and that’s it. Here we urge readers to use the term “privacy network” or “anonymous network” (Alice prefers the latter), and stop using the term “dark web” to call these web technologies! The entire anonymous web technology community would appreciate it if you could practice this for yourself.&lt;/p&gt;

&lt;p&gt;Finally, having spent a lot of time talking about urban legends and horror stories that the news media talk about, let me also briefly tell you the stories that they don’t tell you: In 2006, a whistleblower published the improper actions of a pharmaceutical company. As a result, under the pressure of lawyers in the name of “copyright”, the domain name of the published document was stopped for many times, and finally it was successfully published on Tor HiddenService. This was one of the first examples of Tor Hidden Service providing citizens with freedom of speech protection, and later wikileaks did the same; Today, thanks to the efforts of the Tor community, platforms like GlobaLeaks and SecureDrop have been joined by more than 30 news outlets, making it easy for any citizen to submit raw material, such as political corruption, to multiple news outlets. According to these outlets, they have received some key clues from here (what exactly? Media: Don’t answer, don’t answer, don’t answer); In addition, Hidden Service has a strong technical advantage. Imagine that Tor HiddenService’s own traffic is not only fully end-to-end encrypted, but also the host name is the public key, as long as the link is correct, there is no need to worry about man-in-the-middle attacks, and because all traffic passes through the Tor network, you can run any TCP server without a public IP address. At the same time, the attack surface is much less than the WWW service, many users let their home servers refuse all inbound connections, and Tor is a very useful application scenario for remote access and management. In addition, the future development of next generation network tools based on the anonymous network technology foundation represented by Tor is very promising. Ricochet is an absolutely decentralized chat Service based on Tor Hidden Service. Each person’s account is the host name of Onion server on their own machine. All communication is conducted point-to-point directly through Hidden Service. Not only can mass monitors not intercept the content of chats, but they can’t analyze your network of relationships through metadata (experimental project, not recommended for ordinary users). Now public sites such as DuckDuckGo, Blockchain, GnuPG, and even Debian software sources have opened their own Hidden Service, and have been better protected.&lt;/p&gt;

&lt;p&gt;Due to space, Alice will not say much here, and will continue to introduce it to you in the future. Thank you for your support. In addition, the developers urge everyone to deploy the Onion protocol as often as possible to promote the technology, and if you’re a website owner, it’s great to have your website support TorHidden Service access.&lt;/p&gt;

&lt;p&gt;At the end of the article, Eric Hughes’ 1993 Cypherpunk manifesto is excerpted to commemorate their groundbreaking contributions.&lt;/p&gt;

&lt;p&gt;Privacy is a necessity for an open society in the electronic age. “Privacy” is different from “confidentiality” in that “private matters” refer to things that a person does not want the world to know, while “confidential” refers to things that a person does not want anyone to know. Privacy, therefore, refers to the right to selectively disclose information to the public. If the two parties had exchanges, then both have memories, and either can talk about their meetings at will, what’s to stop them? Of course, a law can be enacted to prohibit it, but freedom of speech is also a fundamental condition of an open society, and trumps the right to privacy, so we should not restrict speech. As we ask for privacy, therefore… Both sides just need to know that… Directly relevant information When I buy a magazine with cash at the counter, the cashier doesn’t need to know who I am. When I ask my email provider to send and receive messages, my provider also doesn’t need to know who I am, who I’m talking to, and who’s talking to me; They just need to know how to deliver the information and what fees I should pay. When my identity is revealed by the trading mechanism, I have no privacy. … Open societies also need privacy, and when I speak, I only want my audience to hear those words, and I have no privacy when what I say is available all over the world. … We cannot expect the mercy of governments, corporations, or other faceless giant institutions to grant us privacy. … We must protect our privacy - if we expect to have it at all.&lt;/p&gt;
</description>
        <pubDate>Mon, 13 Nov 2023 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2023/11/13/DebunkingthemythofthedarkWeb.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2023/11/13/DebunkingthemythofthedarkWeb.html</guid>
        
        
      </item>
    
      <item>
        <title>Graphene OS -Hardened security Handbook</title>
        <description>&lt;p&gt;GrapheneOS itself is the Hardened system for Android. Recommended by Edward Snowden: I use Graphene OS every day!&lt;/p&gt;

&lt;p&gt;The system itself has been enhanced with kernel enhancements, browser enhancements, sandboxed profiles, randomized MAC locations, removal of Google, camera, microphone permissions management, and support for the secure hardware chip HSM technology on newer Pixel phones (Titan M2). But there is still a lot left to tweak to maximize security/privacy.&lt;/p&gt;

&lt;p&gt;I’ll show you the method I used here. And how I use the habits of Qubes OS/Tails/Whonix, combined with the system Grapheneos, which is expected and considered to be privacy and anonymity.&lt;/p&gt;

&lt;h1 id=&quot;hardened--security-step-1-use-a-different-profile-for-the-main-system&quot;&gt;Hardened // Security Step 1: Use a different profile for the main system&lt;/h1&gt;
&lt;p&gt;Immediately after installing the system, a profile must be created for switching.
The reason for this is that the main profile is Admin, which is the main directory.
The less attacked Admin is, the better. Please use 100% of the other profiles for daily use.&lt;/p&gt;

&lt;h1 id=&quot;hardened--security-step-2-setup-disable-all-unneeded-features-to-increase-security&quot;&gt;Hardened // Security Step 2: Setup, disable all unneeded features to increase security.&lt;/h1&gt;
&lt;p&gt;Everything will be done according to the Graphene OS manual.&lt;/p&gt;

&lt;p&gt;First we need to turn off the 2G/3G/5G network and use only LTE mode.
By default turn off the option to allow sensors.
Turn off all USB by default.
Turn off Bluetooth, Printing, NFC.
Keep Airplane Mode on.
Use power saving mode.
Screen set password/fingerprint and turn on password randomization.
Turn off developer functions
Disable OEM mode
Turn off positioning, camera, microphone (or cultivate good permissions control, which means you can’t allow permissions on the fly.)&lt;/p&gt;

&lt;p&gt;If you’ve done what I said above, you’ve basically got it all set up, and the next Hardened // Security Steps 3 ~ 4 are all about personal taste adjustments, or extreme security.&lt;/p&gt;

&lt;h1 id=&quot;hardened--security-step-3--disposable-container-protection-measures&quot;&gt;Hardened // Security Step 3 : Disposable Container Protection Measures&lt;/h1&gt;
&lt;p&gt;The concept is like a disposable virtual machine, with greater control over permissions / protection against forensics.
How to use: In the configuration file, turn on Guest Mode and check the box to remove guest activity. After following the steps above, the disposable container will be completely destroyed whenever you close the guest mode. With GrapheneOS’s perfect Sandbox isolation, this is basically a no-brainer!&lt;/p&gt;

&lt;h1 id=&quot;hardened--security-step-4--setting-up-an-environment-like-tails--whonix-to-connect-to-the-tor-network-100-of-the-time&quot;&gt;Hardened // Security Step 4 : Setting up an environment like Tails / Whonix to connect to the tor network 100% of the time.&lt;/h1&gt;
&lt;p&gt;Here we use inviZible Pro software to cover the whole network with Tor and exclude the Tor browser from the software. This way the two software will not interfere with each other.&lt;/p&gt;

&lt;p&gt;However, it is also important to realize that the security of Tor on Android is very weak anyway. Remember, it is highly recommended to use it with Hardened // Security Step 3!&lt;/p&gt;

&lt;h1 id=&quot;hardened--security-step-5--daily-browsinganonymous&quot;&gt;Hardened // Security Step 5 : Daily Browsing/Anonymous&lt;/h1&gt;
&lt;p&gt;I’m going to use Whonix’s distinction between pseudonymity and anonymity here. In any case, you should use a profile to separate the two and not merge them together.&lt;/p&gt;

&lt;p&gt;For example, for day-to-day browsing, you can only use a VPN on it, or not use a VPN tool. Because this identity means that you (the pseudonym) can know who you are. But not who you really are.&lt;/p&gt;

&lt;p&gt;Anonymity. That means you can only use TOR on it, and you can’t use your pseudonym identity, including your account, on Anonymous. (No one knows who you are), which also corresponds to the phrase: what person nothing&lt;/p&gt;

&lt;p&gt;Whonix is a compound of two words: who (“what person/s”) and nix (a German word that means “nothing”)&lt;/p&gt;

&lt;h1 id=&quot;misperceptionactualization-clarification&quot;&gt;Misperception/actualization clarification:&lt;/h1&gt;
&lt;p&gt;Everyone on this system thinks that you have to use Tor Browser/Tor related software to maximize the security/anonymity of the system. According to the official GrapheneOS statement, the lack of sandboxing in Tor/Firefox for Android creates an attack surface, including the fact that Firefox’s sandboxing is weak, as described by the developers of the Whonix system.&lt;/p&gt;

&lt;p&gt;Also, even using orbot/inviZible Pro to cover the entire system with Tor network is not a good idea, because of the following reasons: Fingerprint / DRM identification, the system mostly relies on profiles for solid security, isolation.&lt;/p&gt;

&lt;h1 id=&quot;glossary&quot;&gt;Glossary:&lt;/h1&gt;
&lt;p&gt;Fingerprint: A fingerprint is the equivalent of a unique identification mechanism for the device. Once a threat/enemy has a fingerprint, they know 100% who that person is and what they are looking for. The theory applies in detail to cell phone software. Browsers. The way to avoid 100% fingerprint recognition in Graphene OS is to use the Tor browser, and all software should run on the Tor browser.&lt;/p&gt;

&lt;p&gt;If you do install other software on your system, make sure it is 100% internet free. If it’s a game, or any other software that requires internet access, there is a high chance that your fingerprints will be recognized by the other party.&lt;/p&gt;
</description>
        <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2023/11/11/GarpheneOS-Security.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2023/11/11/GarpheneOS-Security.html</guid>
        
        
      </item>
    
      <item>
        <title>Announcing Wildland Client v0.1</title>
        <description>&lt;p&gt;On behalf of the whole &lt;a href=&quot;https://wildland.io/team&quot;&gt;team&lt;/a&gt;, I’m proud to announce the first &lt;a href=&quot;https://gitlab.com/wildland&quot;&gt;public release of Wildland client&lt;/a&gt;! This is a reference implementation of the Wildland protocol, which we have described in our &lt;a href=&quot;https://golem.foundation/resources/documents/wildland-w2h.pdf&quot;&gt;“Why, What and How” (aka W2H) paper&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Leaving aside all the usual disclaimers about how early-beta and for-power-users-only this version really is, I’d like to focus on what’s already working and possible :)&lt;/p&gt;

&lt;h2 id=&quot;the-client-functionality&quot;&gt;The client functionality&lt;/h2&gt;

&lt;p&gt;Firstly, you can connect multiple storage backends (S3 buckets, WebDAV servers, Dropbox accounts, etc) and expose them all as &lt;em&gt;one unified file system&lt;/em&gt; as shown on the screenshot below. We believe that this is how data management should really be done. Users should not be concerned with which service provider their data is currently being held on. Instead, we should be able to address our data using infrastructure-agnostic addressing. Whether our files live on my Dropbox, local NAS, some p2p-synced storage, or on my local disk, should be of secondary importance, and should not be included in addressing of the data.&lt;/p&gt;

&lt;p&gt;Secondly, Wildland natively implements what we call &lt;a href=&quot;https://docs.wildland.io/#multi-categorization&quot;&gt;multi-categorization&lt;/a&gt;. This means that every data container (the smallest unit of information on Wildland) can be assigned more than one address/path and can be accessed using any of them. Functionality-wise this is similar to having a directory on a traditional filesystem with multiple links, except that on Wildland every path is a first-class citizen. We believe that this feature is vital in making filesystems powerful enough to allow for their use as a primary tool for information and knowledge management. This is a broad and exciting topic and we will be talking more about it in future posts.&lt;/p&gt;

&lt;p&gt;Finally, the third highlight of this release is support for what we call &lt;a href=&quot;https://docs.wildland.io/#container-addressing&quot;&gt;cascading addressing&lt;/a&gt;. It can be thought of as an “upside-down DNS”, or a bottom-up scalable addressing scheme which does not require any centralized authority, like predefined DNS root servers. It’s important to note that this addressing scheme does not require any blockchain either.&lt;/p&gt;

&lt;h2 id=&quot;the-wildland-demo-forests&quot;&gt;The Wildland demo forests&lt;/h2&gt;

&lt;p&gt;Aside from today’s release of the client, we’re also opening up for public read-only access &lt;a href=&quot;https://docs.wildland.io/user-guide/public-forests.html&quot;&gt;two Wildland forests&lt;/a&gt; (a &lt;em&gt;forest&lt;/em&gt; is a namespace built around one user identity):&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;The &lt;em&gt;Pandora&lt;/em&gt; forest (a reference to the Avatar movie), which is a repository of memos, reports, documents, etc, which we’ve been using internally to help us with Wildland’s development. It’s a bit like a shared Dropbox folder, except that it uses abstracted storage and heavily utilizes multi-categorization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The &lt;em&gt;Ariadne&lt;/em&gt; forest, which is a very small forest containing bridges to other forests, specifically to the Pandora forest, and some other, internal forests, which are encrypted and not exposed for public use.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;whats-coming-up-next&quot;&gt;What’s coming up next?&lt;/h2&gt;

&lt;p&gt;There are more exciting things ahead of us which we plan to bring to you in the upcoming releases. These can be generally grouped into three areas:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Making Wildland &lt;em&gt;easier to use&lt;/em&gt; and set up. This means: better integration on various platforms, easy-to-use GUI, and – last but not least – an Ethereum-based marketplace for storage, followed by user-centered governance and GLM integration, as described in the &lt;a href=&quot;https://golem.foundation/resources/documents/wildland-w2h.pdf&quot;&gt;W2H paper&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Making Wildland &lt;em&gt;faster&lt;/em&gt; – primarily optimized mounting of large forests, as well as adding mechanisms for container content caching.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Making Wildland &lt;em&gt;more universal&lt;/em&gt;, which includes better integration with more storage backends, integration with various data sources, as well as adding support for compute backends attached to containers, allowing them to actively process the data inside containers.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our ultimate goal is to provide a set of tools for a user to be able to better manage their digital universe of information. And do so on their own terms, rather than remaining dependent on large service providers to that on behalf of us all.&lt;/p&gt;

&lt;p&gt;If you would like to try Wildland today, we suggest you start with &lt;a href=&quot;https://docs.wildland.io/#a-practical-introduction-to-wildland&quot;&gt;this introduction&lt;/a&gt;, which is then followed by step-by-step tutorials on how to mount and explore the above-mentioned demo forests, as well as perform many other tasks using Wildland.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/resources/WL-Finder-demo.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

</description>
        <pubDate>Fri, 11 Jun 2021 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2021/06/11/introducing-client-v0.1.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2021/06/11/introducing-client-v0.1.html</guid>
        
        
      </item>
    
      <item>
        <title>The Next Chapter: From the Endpoint to the Cloud</title>
        <description>&lt;p&gt;Earlier this year, I decided to take a sabbatical. I wanted to reflect on my
infosec work and decide what I would like to focus on in the coming years. As
you probably know, I’ve spent the last nine years mostly fighting the battle to
secure the endpoint, more specifically creating, developing, architecting, and
promoting &lt;a href=&quot;https://www.qubes-os.org/&quot;&gt;Qubes OS&lt;/a&gt;, as well as the more general
concept of &lt;a href=&quot;https://www.blackhat.com/eu-17/briefings.html#security-through-distrusting&quot;&gt;“Security through
Distrusting”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over these past nine years, Qubes OS has grown from a research-inspired
proof-of-concept into a reasonably mature, large open-source project with
dozens of &lt;a href=&quot;https://www.qubes-os.org/team/&quot;&gt;contributors&lt;/a&gt; and tens of thousands
of &lt;a href=&quot;https://www.qubes-os.org/statistics/&quot;&gt;users&lt;/a&gt;, including some high-profile
security &lt;a href=&quot;https://www.qubes-os.org/experts/&quot;&gt;experts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are still many challenges ahead for Qubes, however. The primary two are
improving hardware compatibility and UX. I think addressing these challenges
will mostly be an iterative process of gradual improvement, but it will
nonetheless require a lot of time and resources.&lt;/p&gt;

&lt;p&gt;Another challenge is the trustworthiness of the &lt;a href=&quot;https://blog.invisiblethings.org/papers/2015/x86_harmful.pdf&quot;&gt;x86
platform&lt;/a&gt;. Again,
I remain optimistic that many things could be improved on this front, as well
(see, for example, my proposal for a &lt;a href=&quot;https://blog.invisiblethings.org/papers/2015/state_harmful.pdf&quot;&gt;stateless laptop
design&lt;/a&gt;).
Admittedly, such work will require significantly more resources, but I know
there is a lot of interest in this area, and it just needs proper coordination
to happen.&lt;/p&gt;

&lt;p&gt;Despite all of these interesting challenges (especially with platform
trustworthiness), I’ve decided I’d like to switch my focus to something other
than endpoint security. While I still believe that the security of our digital
lives starts and ends with the trustworthiness of the client devices we use
(which today include much more than just laptops and desktops, of course), I
also recognize that the state of endpoint device security has significantly
improved over the past decade. At the same time, most of our data and activities
have migrated from local devices to the cloud.&lt;/p&gt;

&lt;p&gt;And yet, there are fundamental problems with &lt;a href=&quot;https://twitter.com/rootkovska/status/1051392157096001536&quot;&gt;cloud
trustworthiness&lt;/a&gt;, or
the lack thereof. These problems could be summarized as the need for users (i.e.
all of us) to be &lt;em&gt;forced&lt;/em&gt; to trust three different entities: (1) the service
providers who own our data (e.g. the vendor of your fitness tracking app), (2)
the hosting infrastructure owners, who can both access our data as well as deny
us use of the service at their discretion (e.g. AWS, Azure, GCP), and (3) the
networking infrastructure operators, who can also selectively cut us off from
the services (e.g. to implement some form of censorship).&lt;/p&gt;

&lt;p&gt;These are very important problems, in my opinion, and I’d like to work now on
making the cloud more trustworthy, specifically by limiting the amount of trust
we have to place in it.&lt;/p&gt;

&lt;p&gt;So, this month I’ve joined the &lt;a href=&quot;https://golem.network/&quot;&gt;Golem Project&lt;/a&gt; as a
Chief Strategy Officer, also doubling as Chief Security Officer (conveniently,
both roles have the same CSO acronym :) The double nature of my role emphasizes
the close relationships among the long-term roadmap, technical architecture,
as well as product- and operations-security in Golem.&lt;/p&gt;

&lt;p&gt;Why Golem? Because Golem is a very unique project. Golem has been on a mission
to build a “decentralized computer” out of a heterogeneous network of
third-party provided computers. Founded two years ago through a very successful
crowdfunding campaign, it instantly gained an impressive amount of funding,
which allowed it to build a strong development team (incidentally, mostly based
in my favorite city – Warsaw).&lt;/p&gt;

&lt;p&gt;The distributed funding model has also essentially eliminated two common
obstacles most tech startups face: lack of money to hire enough people and the
need to implement investors’ (rather than the founders’) agenda. In this
respect Golem seems to be as independent as one could realistically imagine.&lt;/p&gt;

&lt;p&gt;Most importantly, we (ITL), have already been
&lt;a href=&quot;https://blog.invisiblethings.org/2018/06/11/graphene-ng.html&quot;&gt;working&lt;/a&gt; with
Golem over the past year. During that time I’ve had enough time to get to know
some of the key people in the project, understand their personal agendas, and
conclude they might be very much inline with my own.&lt;/p&gt;

&lt;p&gt;As for the future of Qubes, I don’t think much will change here. In recent
years, &lt;a href=&quot;https://www.qubes-os.org/team/#marek-marczykowski-górecki&quot;&gt;Marek
Marczykowski-Górecki&lt;/a&gt;
has been effectively leading most of the day-to-day efforts with Qubes OS
development, while I’ve focused mostly on long-term architecture planning and
various research activities, such as our SGX-related work. Marek will continue
to lead Qubes now, so I’m reassured about the future of the project. I will also
remain as an advisor to the Qubes OS Project, as well as… its user, though I’ve
recently also been embracing other systems, including – of course – the cloud.&lt;/p&gt;

&lt;p&gt;Finally, I’d like to thank my (present and past) ITL colleagues. We have
undertaken quite a few projects together, of which Qubes OS is probably the most
challenging and spectacular. Yet it was hardly the only one. There was also all
the (allegedly
&lt;a href=&quot;https://twitter.com/dwizzzleMSFT/status/1006733071511519232&quot;&gt;pioneering&lt;/a&gt;)
offensive system security research done together with Rafał Wojtczuk and Alex
Tereshkin. This research was instrumental in our subsequent work on Qubes OS,
and I think it will again prove useful for my work on Golem.&lt;/p&gt;
</description>
        <pubDate>Thu, 25 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2018/10/25/the-next-chapter.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2018/10/25/the-next-chapter.html</guid>
        
        
      </item>
    
      <item>
        <title>Introducing graphene-ng: running arbitrary payloads in SGX enclaves</title>
        <description>&lt;p&gt;A few months ago, during &lt;a href=&quot;https://www.blackhat.com/eu-17/briefings.html#security-through-distrusting&quot;&gt;my keynote&lt;/a&gt; at Black Hat Europe, I was
discussing how we should be limiting the amount of trust when building computer
systems. Recently, a new technology from Intel has been gaining
popularity among both developers and researchers, a technology which promises a
big step towards such trust-minimizing systems. I’m talking about &lt;a href=&quot;https://software.intel.com/sgx&quot;&gt;Intel
SGX&lt;/a&gt;, of course.&lt;/p&gt;

&lt;p&gt;Intel SGX caught my attention for the first time about 5 years ago, a little
while before Intel has officially added information about it to the official
Software Developer’s Manual. I’ve written &lt;a href=&quot;https://blog.invisiblethings.org/2013/08/30/thoughts-on-intels-upcoming-software.html&quot;&gt;two&lt;/a&gt; &lt;a href=&quot;https://blog.invisiblethings.org/2013/09/23/thoughts-on-intels-upcoming-software.html&quot;&gt;posts&lt;/a&gt; about
my thoughts on this (then-upcoming) technology, which were a superposition of
both positive and negative feelings.&lt;/p&gt;

&lt;p&gt;Over the last 2 years or so, together with my team at ITL, we’ve been
investigating this fascinating technology a bit closer. Today I’d like to share
some introductory information on this interesting project we’ve been working on
together with our friends at &lt;a href=&quot;https://golem.network/&quot;&gt;Golem&lt;/a&gt; for several months now.&lt;/p&gt;

&lt;h2 id=&quot;enclave-based-computing&quot;&gt;Enclave-based computing&lt;/h2&gt;

&lt;p&gt;Recently the term “enclave-based” computing has been used increasingly often to
describe a form of security container which allows for computations which are
protected from the host, such as the external operating system, hypervisor, or
even interference from the low-level firmware such as the BIOS/SMM/UEFI.&lt;/p&gt;

&lt;p&gt;This is, naturally, in stark contrast to the usual definition of a security
container as used today (and as implemented by VMs of various sorts,
Linux/Docker containers, etc), which implies protection of the host from
whatever code runs inside the container. In other words: the enclaves and the
containers represent two different, complementary goals, and it is normally
envisioned that both will be deployed at the same time.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/enclaves_vs_containers.png&quot; alt=&quot;fig1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It’s not a surprise that people have been thinking about how to protect code and
data running on a potentially compromised host for quite some time.&lt;/p&gt;

&lt;p&gt;Even I wrote &lt;a href=&quot;https://blog.invisiblethings.org/2011/12/13/trusted-execution-in-untrusted-cloud.html&quot;&gt;a piece&lt;/a&gt; back in 2011, where I discussed how we could
attempt to somehow implement trusted execution within an untrusted cloud, utilizing
Intel TXT technology (which could be thought of as a logical predecessor of
Intel SGX). There has also been very interesting work done by &lt;a href=&quot;https://privatecore.com/vcage/index.html&quot;&gt;Private
Core&lt;/a&gt; (now Facebook), starting around 2012 and going on for a few
years, unfortunately never released to the public (?). But solutions based on
Intel TXT have been clumsy and vulnerable to some fundamental problems, such as
e.g. &lt;a href=&quot;https://invisiblethingslab.com/resources/bh09dc/Attacking%20Intel%20TXT%20-%20paper.pdf&quot;&gt;SMM attacks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today Intel SGX seems like a very promising candidate (and so far the only one?)
offering a reasonably good solution for enclave-based computing.&lt;/p&gt;

&lt;p&gt;But Intel is not the only one, there are also other technologies with &lt;a href=&quot;https://developer.amd.com/wp-content/resources/55766_SEV-KM%20API_Specification.pdf&quot;&gt;AMD
Secure Encrypted Virtualization (SEV)&lt;/a&gt; being another interesting
technology. Unfortunately, AMD SEV, while very promising at first sight, does
have serious security weaknesses, such as the &lt;a href=&quot;https://arxiv.org/pdf/1805.09604.pdf&quot;&gt;lack of integrity protection for
2nd-level page tables&lt;/a&gt;, and generally is
&lt;a href=&quot;https://twitter.com/CopperheadOS/status/771247082547974144&quot;&gt;believed&lt;/a&gt; to not to offer protection against malicious
hypervisors, but rather only against &lt;a href=&quot;https://lkml.org/lkml/2016/8/22/960&quot;&gt;accidental hypervisor
vulnerabilities&lt;/a&gt;. Hopefully in the future AMD will improve
the design and implementation of SEV.&lt;/p&gt;

&lt;p&gt;There are also attempts to create so called Trusted Execution Environments
(TEEs) on ARM-based systems, typically using the Trust Zone technology, which
might resemble the idea of enclave-based computing, in that the payloads are to
be protected from the main host OS. These, however, seem quite different to me,
architecture-wise, because in case of Trust Zone we really are talking about a
classic Security through Isolation Model, just with the hypervisor moved a level
down the stack. From the user- and developer- point of view, the similarity
might be more striking though. Not being an expert on ARM systems, there is also
a possibility I’m missing some crucial innovation here, which makes these
solutions also more similar to Intel SGX and AMD SEV.&lt;/p&gt;

&lt;p&gt;Intel SGX is a hardware extension, meaning one needs to have a reasonably modern
Intel processor in order to be able to use it. Typically this should not be a
problem for most modern laptops which are based on most of the &lt;a href=&quot;https://ark.intel.com/Search/FeatureFilter?productType=processors&amp;amp;SoftwareGuardExtensions=true&quot;&gt;recent Intel
processors&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But having an SGX-ready hardware is just half of the story, as one also needs
specially-designed software to make use of SGX-provided features. And Intel does 
offer an &lt;a href=&quot;https://software.intel.com/en-us/sgx-sdk&quot;&gt;SDK&lt;/a&gt; exactly for this purpose.&lt;/p&gt;

&lt;p&gt;So, how does one port an application to be usable within an SGX enclave? As it
turns out, that is not an easy task…&lt;/p&gt;

&lt;h2 id=&quot;intel-sgx-challenges-and-problems&quot;&gt;Intel SGX challenges and problems&lt;/h2&gt;

&lt;p&gt;It is not an easy task to port an application to run within an SGX container,
because Intel has envisioned SGX as a protection technology for only small parts
of the application code and data. Prime example includes protection of only the
crypto code (key generation, sign and decrypt operations), while leaving the
whole rest of the application wide open to the attacks from the host OS.&lt;/p&gt;

&lt;p&gt;This kind of thinking is not entirely new in the industry, where vendors
consider the protection of the &lt;em&gt;keys&lt;/em&gt; (which usually belong to the vendors, such
as e.g. the signing keys for bank transactions or decryption keys for
DRM-protected material) to be of primary concern, while putting less emphasis on
protection of the actual user data (e.g. the content of the
user’s email).&lt;/p&gt;

&lt;p&gt;There are more problems with SGX, however.&lt;/p&gt;

&lt;p&gt;First, Intel SGX has its own Remote Attestation scheme, which oddly, requires an
Intel-operated server, so called Intel Attestation Service (IAS), to be used to
verify the proof of attestation. This proof of attestation is called: “quote”
and it is the same name as used in “classic” TPM-based Remote Attestation,
although the SGX “quote” is a bit different. The Intel’s decision to
&lt;a href=&quot;https://tches.iacr.org/index.php/TCHES/article/view/879&quot;&gt;encrypt&lt;/a&gt; it (not just sign), effectively limiting its
verification only to Intel-operated servers seems questionable at best. Not only
does it introduce a single point of failure to &lt;em&gt;any&lt;/em&gt; infrastructure based on
SGX, but also gives Intel a possibility to stealthy spoof attestation results
for select users, this way facilitating selective plausibly deniable backdooring
(note that Intel can always build in a backdoor, just that a generic backdoor
within the silicon is hard to be used selectively, and surely is not plausibly
deniable).&lt;/p&gt;

&lt;p&gt;Another issue with SGX is the requirement for any SGX enclave to be signed
with Intel-blessed vendor’s signing key. In other words, it is not possible to
load an SGX enclave (other than in debug mode) without entering into a legal
contract with Intel. The rationale behind this is believed to be to prevent
blackbox malware within enclaves, something I (theoretically)
&lt;a href=&quot;https://blog.invisiblethings.org/2013/09/23/thoughts-on-intels-upcoming-software.html&quot;&gt;described&lt;/a&gt; in the early days of SGX…&lt;/p&gt;

&lt;p&gt;(BTW, in the SDM manual, Intel describes a special MSR resister which could be
used to provide a hash of a custom, so called, Launch Enclave, seemingly making
it possible to get around this requirement to have enclaves signed only by
Intel-blessed keys. Unfortunately, it is strongly believed that when one decides
to use a custom Launch Enclave, then the Remote Attestation would no longer
work, yielding the whole technology mostly useless…)&lt;/p&gt;

&lt;p&gt;There are also some implementation-level problems with SGX, which should be
mentioned here for completeness. One is the rather small limit for the amount of
protected memory accessible for &lt;em&gt;all&lt;/em&gt; the enclaves in the system, which is
called the Enclave Page Cache, or EPC. On today’s system this amounts to &lt;a href=&quot;https://software.intel.com/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/737218&quot;&gt;only
128 MB currently&lt;/a&gt;. Luckily, the Intel-provided driver (which is
part of the SGX SDK) performs on-the-fly paging of enclave memory.  This paging
goes to the DRAM, not to disk, so while there is some performance penalty
imposed by this operation, it is not terrible (in our experiments, for payloads
which utilize memory in a more-or-less linear fashion, this amounts to less than
30% overhead).  Of course the driver (or the host kernel) only sees the encrypted
and integrity-protected pages, so cannot steal, nor meaningfully rearrange them.&lt;/p&gt;

&lt;p&gt;Finally, one last problem, which however cannot be dismissed lightly, is the
existence of various side-channel attacks, which can leak secrets out of the
enclave’s code to the host OS. It is especially challenging to neutralize such
side channels, given the fact that the attacker can control the whole host OS.
No doubt Intel and other researchers will continue to research this area and
likely implement an increasing number of protections against such attacks (most
likely on the level of SDK/compiler?).&lt;/p&gt;

&lt;h2 id=&quot;running-whole--applications-in-sgx-enclaves&quot;&gt;Running whole  applications in SGX enclaves&lt;/h2&gt;

&lt;p&gt;Despite all the problems with SGX discussed above, I still believe this is a
technology with a great potential, and that most of the problems could be
solved, or at least improved upon significantly. But to make it truly useful,
especially for users, not just vendors, we really need to find generic ways of
how to run whole, unmodified applications within SGX enclaves. Pretty much like
if they were “VMs” of some kind.&lt;/p&gt;

&lt;p&gt;There are two key challenges with achieving this goal, however:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;First we need to expose a near-complete API such as POSIX or Win32 (or Linux
or Windows syscall API), so that the process running in the enclave could
behave as if it ran natively under the host OS. The challenge here is
that, naturally, we cannot simply pass through down to the host, because…
the host is untrusted in our threat model.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The other challenge is how to meaningfully bind the application inside the
enclave to some secret, which could later be used to construct a proof that
the application does indeed execute inside a valid SGX enclave. Here we would
like to prevent the most obvious attack against enclave-based computing which
works by having the attacker… only simulating that the process runs within
an enclave, but in reality the execution takes place in normal execution
mode (e.g. in case of Intel SGX, the attacker would skip the EINIT/EENTER
instructions).&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As for solving the first challenge, a few papers and projects have already been
presented: &lt;a href=&quot;https://www.microsoft.com/en-us/research/publication/shielding-applications-from-an-untrusted-cloud-with-haven/&quot;&gt;Microsoft Haven&lt;/a&gt;, &lt;a href=&quot;https://www.usenix.org/system/files/conference/osdi16/osdi16-arnautov.pdf&quot;&gt;SCONE&lt;/a&gt;, &lt;a href=&quot;https://github.com/oscarlab/graphene&quot;&gt;Graphene SGX&lt;/a&gt;,
and &lt;a href=&quot;http://www.comp.nus.edu.sg/~tsunami/papers/panoply_ndss17.pdf&quot;&gt;Panoply&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From the security point of view, the primary difference between these projects,
is how they implement the rich OS-like API, which is to be exposed to the
application within the enclave.&lt;/p&gt;

&lt;p&gt;On the one end of the spectrum are projects which take the “minimal TCB size”
approach, which means they try to pass-through as much API call logic to the
underlying host OS as possible, while performing some sanity checks on the
results returned from the host OS. This approach has been taken by Scone and
Panoply, and their rationale is that minimizing the amount of code within an SGX
enclave (i.e. the size of TCB), should be the primary goal.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/shim_vs_libOS.png&quot; alt=&quot;fig2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The alternative approach, embraced by Haven and Graphene, has been to “minimize
the untrusted interface” to the host OS. The rationale here is that it is the
size of the attack &lt;em&gt;surface&lt;/em&gt; that matters more, than the amount of code &lt;em&gt;inside&lt;/em&gt;
the enclave.&lt;/p&gt;

&lt;p&gt;I personally agree with the latter approach, because I believe that the size and
complexity of the external interface is more critical. After all if there is no
way for the attacker to reach the code inside (e.g. pass arbitrary parameters to
functions), then it is not so problematic that there might be bugs in this code.
By keeping the external interface small and simple, we can assure that with a
reasonable degree of assurance in practice. For this reason we have built our
solution, discussed below, on top of Graphene.&lt;/p&gt;

&lt;p&gt;The second challenge is often neglected, as authors (especially of academic
papers) tend to focus more on the first problem, often leaving proof of
execution within SGX enclave as “future work” (the MS Haven paper being a
notable exception here). Arguably, however, this is the most crucial aspect of
any enclave-based solution, as otherwise, no matter how secure the execution
environment, the attacker would always be able to essentially ruin the whole
scheme by using an emulation attack in which the actual payload will get
executed outside of the enclave (or within a real enclave, just such that is
controlled by the attacker).&lt;/p&gt;

&lt;p&gt;One “little detail” that should also be taken into account is how does the
application inside the enclave generate random numbers. Over decades operating
systems and applications have come up with various, often surprising ways to
generate randomness from different sources of entropy, such as e.g.  interrupts,
mouse, disk or networking use patterns, etc. When running within an enclave, we
should keep in mind that all such “external” events (and only external events
can bring entropy, right?) can be fully controlled (at last monitored) by the
host OS. This means the host OS can always learn any key the application would
generate inside the enclave, which in turn yields any Remote Attestation scheme
meaningless. Fortunately, there is a solution to this problem: a hardware
instruction for generating randomness: RDRAND. But if the application, for
whatever reason, does not use RDRAND (or a proper OS-service, which we intercept
in the libOS), but instead tries to employ some Do-It-Yourself method, then we
might have a serious problem.&lt;/p&gt;

&lt;h2 id=&quot;graphene-graphene-ng-and-golem&quot;&gt;Graphene, graphene-ng and Golem&lt;/h2&gt;

&lt;p&gt;Together with &lt;a href=&quot;https://golem.network/&quot;&gt;Golem&lt;/a&gt;, we have been working on a solution to the problem
of running arbitrary payloads (more specifically: Docker Linux-based containers)
for several months now, and I’d like to share a bit of a status of where we are
right now, and where we would like to get.&lt;/p&gt;

&lt;p&gt;Golem is building a decentralized compute cloud (think EC2 married with
SETI@home) and enclave-based computing offers a potential to solve two critical
problems any such decentralized network faces: 1) how to ensure users who
contribute compute power do indeed execute payloads for which they are being
paid, and 2) to offer confidentiality to payloads, so that the owners of the
computer performing the computations could not eavesdrop on the data being
processed.&lt;/p&gt;

&lt;p&gt;We (ITL) on the other hand, are also very interested in enclave-based computing,
with one natural application being for use in future versions of &lt;a href=&quot;https://www.qubes-os.org/&quot;&gt;Qubes
OS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As mentioned above, we have chosen to base our solution on Graphene SGX,
because its architecture seemed the most appealing to us, as explained in the
previous section.&lt;/p&gt;

&lt;p&gt;Unfortunately, what has looked good on architecture-level (or, to say more
directly: on paper), turned out to be much less usable in practice. Any more
complex payloads we tried to run under Graphene, such as Blender renderer
processing any more complex scenes, revealed dozens of bugs within the Graphene
LibOS implementation (mostly race conditions). Luckily these were not
security-relevant bugs within our threat model, because in this context we
assume the attacks are coming from the host, and not from the payload (and a
malicious payload can always be… malicious to itself and its own data, nothing
can be done about that).&lt;/p&gt;

&lt;p&gt;Golem also considers attacks coming from potentially malicious payloads
attacking the host. To prevent them they use a different sandboxing technology,
which does not rely on Graphene. This is an important detail to stress, because
Graphene actually does advertise itself as a framework to also sandbox the
payloads. Our quick analysis of the code revealed, however, that this extra
functionality does not work well and could be circumvented relatively easily.&lt;/p&gt;

&lt;p&gt;Another problem with the original Graphene project is no meaningful
support for proving to the remote party (i.e. the user) that the payload has
executed indeed in a proper enclave, properly-protected (the second challenge
discussed above).&lt;/p&gt;

&lt;p&gt;We’ve spent months finding and fixing the bugs within Graphene and also
designing and implementing support for ensuring the remote party the execution
and processing of their data has indeed been done within a properly protected
enclave.&lt;/p&gt;

&lt;p&gt;Our solution for this latter challenge has been designed for
batch-processing-like payloads, which take some files on input, perform
calculations (e.g. render part of the scene) and then create some output when
done. In the future it could be extended to cover more interactive payloads as
well. The user is offered a tool, which is responsible for automatically
verifying Remote Attestation proof, and encrypting the input file(s) using a
public key generated by our framework running within the enclave. This way the
user gains assurance that her data could be decrypted only by 1) a payload with
specific measurement (hash of the code or hash of the developer’s signing key),
2) running within a proper SGX enclave, 3) on proper, e.g. non-buggy hardware, 4)
with the proper set of properties (e.g. not in SGX debug mode).&lt;/p&gt;

&lt;p&gt;Given the amount of modifications we have introduced to Graphene, and also
because our needs to be able to progress with development significantly faster
than the original Graphene project has been doing recently, we’ve decided to
fork the project. We will be making the repository public in the coming weeks,
most likely after the summer holidays, together with a technical paper
describing the challenges I’ve quickly tried to summarize above. For today we
just would like to show off a short demo movie below :)&lt;/p&gt;

&lt;p&gt;We would also like to thank the original Graphene maintainers and all the
contributors for starting this exciting project!&lt;/p&gt;

&lt;h2 id=&quot;demo-time&quot;&gt;Demo time!&lt;/h2&gt;

&lt;p&gt;Without further ado, let’s take a look at the demo :)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://asciinema.org/a/f100sMr1v99pdIgRxU3d1okYj&quot;&gt;&lt;img src=&quot;https://asciinema.org/a/f100sMr1v99pdIgRxU3d1okYj.png&quot; alt=&quot;Demo video&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the demo above several steps are presented (they are to be done only by the
application vendors, not by users of the payloads):&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;First we’re building the base Docker container which contains the necessary
Graphene-based infrastructure: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;golem-sgx-template&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Then we’re creating a Dockerfile for an exemplary application container, in
this case for running Blender inside an SGX enclave (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;golem-sgx-blender&lt;/code&gt;):&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-Dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Inherit from Golem SGX based template:&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; golem-sgx-template:latest&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Install Blender:&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  We don't use Ubuntu repo, because it contains some older Blender version.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  The /wget_and_check.sh is a simple script exposed by the golem-sgx-template Docker&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  which verifies integrity of the downloaded components.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /blender/                                                                               
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;/wget_and_check.sh &lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;https://ftp.halifax.rwth-aachen.de/blender/release/Blender2.79/blender-2.79b-linux-glibc219-x86_64.tar.bz2&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;/tmp/blender.tar.bz2&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\
&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;43824a4e0b0c6de6fa34ff224eec44c1cc9f26a95f6f3c8c2558d1c05704183c&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;xjf /tmp/blender.tar.bz2 &lt;span class=&quot;nt&quot;&gt;--strip-components&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1 &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; /blender/

&lt;span class=&quot;c&quot;&gt;# (Automatically) create the manifest for the payload:&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WORKDIR&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; /blender/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; blender.manifest.template .&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;/prepare_manifest.sh /blender/blender

&lt;span class=&quot;c&quot;&gt;# Run the payload under Graphene:&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; [&quot;/graphene_sgx_run.sh&quot;, &quot;blender&quot;, \                                                         &lt;/span&gt;
     &quot;-t&quot;, &quot;1&quot;, \                                                                                 
     &quot;-b&quot;, &quot;/input/input.blend&quot;, \                                                                
     &quot;-P&quot;, &quot;/input/change_params.py&quot;, \                                                           
     &quot;--&quot;, &quot;1920&quot;, &quot;1080&quot;, &quot;4&quot;, &quot;50&quot;, &quot;/output/out.png&quot;]           
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As we can see the Dockerfile inherits from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;golem-sgx-template&lt;/code&gt;, and then
it’s a pretty standard Dockerfile, except for two things: 1) we need to run a
special script to create a so-called manifest for the payload (more on this
below), and 2) start the actual payload using the wrapper script
(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/graphene_sgx_run.sh&lt;/code&gt;, also included in the base Docker template), which takes
care of running the given executable under Graphene, ensuring specific
options are turned on (such as telling it to use SGX-capable PAL).&lt;/p&gt;

&lt;p&gt;The payload manifest mentioned above is a crucial thing: it contains a list of
all the files which should be made available to the payload running within the
SGX enclave. This includes the input and output files, which are automatically
encrypted and integrity-protected by a corresponding user-side tool, in such a
way that &lt;strong&gt;only the proper payload in a valid SGX enclave can read and write&lt;/strong&gt;
them. For Golem applications this process is going to be fully automatic (as
seen above), but for other cases the container vendor might need to tweak this
manifest by defining different lists of input and output files. The other files,
such as the list of all the libraries and other dependencies is generated
automatically and this should work for all the cases. More details in the
upcoming paper.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Now we’re ready to build and sign the final Docker image. Now the Docker
imaging hosting a given payload (in this case a Blender renderer) is
finalized (sealed via digital signature made above) and ready for users to
run it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Having such a final docker image, anyone can now run it (e.g. a compute node of
the Golem network) with a simple wrapper script, e.g.:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./../docker_run_with_sgx.sh -v &quot;`pwd`/sample_input:/input&quot; -v &quot;`pwd`/render_output:/output&quot; golem-sgx-blender-signed
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;future-plans-and-wishes&quot;&gt;Future plans and wishes&lt;/h2&gt;

&lt;p&gt;So, what are our plans and expectations for Intel SGX in the longer term?&lt;/p&gt;

&lt;p&gt;First and foremost we look forward to Intel doing the “SGX liberation”, as I
like to call it. This liberation should comprise two, independent aspects:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Liberating Remote Attestation, which means Intel should allow anyone, not
just its own IAS servers to perform Quote verifications (of course, it’s
perfectly fine, and probably justified if Intel will continue to operate and
offer IAS to those customers who find such a service convenient),&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Allowing to load enclaves signed with any key, not just one “blessed” by
Intel. But at the same time still allowing for meaningful Remote Attestation
to work. By meaningful attestation I understand one that performs signing of
the Quote using keys derived from the processor’s private key, of course.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Other aspects that we believe are crucial in further adoption of SGX technology
are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Allowing for a secure communication path between an enclave and a GPU. This is
important for both Golem-like applications, where the payload might want to
utilize GPU for computations, as well as for client-like applications, where we
would like some user applications, such as e.g. a messaging app or email
client, to be able to safely display decrypted content to the user, without
the fear of the (untrusted) host OS seeing and capturing it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Additionally allowing for secure communication with mouse and keyboard (or
generally HID devices), to facilitate safe use in client applications, such
as just mentioned messaging, email, banking and wallet-like applications.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Increase the amount of EPC to facilitate running big, complex payloads within
enclave with minimal performance impact.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Mon, 11 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2018/06/11/graphene-ng.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2018/06/11/graphene-ng.html</guid>
        
        
      </item>
    
      <item>
        <title>Qubes Air: Generalizing the Qubes Architecture</title>
        <description>&lt;p&gt;The Qubes OS project has been around for nearly 8 years now, since its &lt;a href=&quot;https://blog.invisiblethings.org/2010/04/07/introducing-qubes-os.html&quot;&gt;original
announcement&lt;/a&gt; back in April 2010 (and the actual origin
date can be traced back to November 11th, 2009, when an initial email
introducing this project was sent within ITL internally). Over these years Qubes
has achieved reasonable success: according to our estimates, it &lt;a href=&quot;https://www.qubes-os.org/statistics/&quot;&gt;has&lt;/a&gt;
nearly 30k regular users. This could even be considered a great success given
that 1) it is a new &lt;em&gt;operating system&lt;/em&gt;, rather than an &lt;em&gt;application&lt;/em&gt; that can be
installed in the user’s favorite OS; 2) it has introduced a (radically?) &lt;a href=&quot;https://www.qubes-os.org/video-tours/&quot;&gt;new
approach&lt;/a&gt; to managing one’s digital life (i.e. an explicit
partitioning model into security domains); and last but not least, 3) it has
very &lt;a href=&quot;https://www.qubes-os.org/hcl/&quot;&gt;&lt;em&gt;specific&lt;/em&gt; hardware requirements&lt;/a&gt;, which is the result of using Xen
as the hypervisor and Linux-based Virtual Machines (VMs) for networking and USB
qubes. (The term “qube” refers to a compartment – not necessarily a VM –
inside a Qubes OS system. We’ll explain this in more detail below.)&lt;/p&gt;

&lt;p&gt;For the past several years, we’ve been working hard to bring you &lt;a href=&quot;https://www.qubes-os.org/news/2017/07/31/qubes-40-rc1/&quot;&gt;Qubes
4.0&lt;/a&gt;, which features state-of-the-art technology not seen in previous
Qubes versions, notably the next generation &lt;a href=&quot;https://www.qubes-os.org/news/2017/10/03/core3/&quot;&gt;Qubes Core Stack&lt;/a&gt; and
our unique &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;Admin API&lt;/a&gt;. We believe this new platform (Qubes 4
represents a major rewrite of the previous Qubes codebase!) paves the way to
solving many of the obstacles mentioned above.&lt;/p&gt;

&lt;p&gt;The new, flexible architecture of Qubes 4 will also open up new possibilities,
and we’ve recently been thinking about how Qubes OS should evolve in the long
term. In this article, I discuss this vision, which we call Qubes Air. It should
be noted that what I describe in this article has not been implemented yet.&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;

&lt;p&gt;Before we take a look at the long-term vision, it might be helpful to understand
why we would like the Qubes architecture to further evolve. Let us quickly recap
some of the most important current weaknesses of Qubes OS (including Qubes 4.0).&lt;/p&gt;

&lt;h3 id=&quot;deployment-cost-aka-how-do-i-find-a-qubes-compatible-laptop&quot;&gt;Deployment cost (aka “How do I find a Qubes-compatible laptop?”)&lt;/h3&gt;

&lt;p&gt;Probably the biggest current problem with Qubes OS – a problem that prevents
its wider adoption – is the difficulty of finding a compatible laptop on which
to install it. Then, the whole process of needing to install a new &lt;em&gt;operating
system&lt;/em&gt;, rather than just adding a new &lt;em&gt;application&lt;/em&gt;, scares many people away.
It’s hard to be surprised by that.&lt;/p&gt;

&lt;p&gt;This problem of deployment is not limited to Qubes OS, by the way.  It’s just
that, in the case of Qubes OS, these problems are significantly more pronounced
due to the aggressive use of virtualization technology to isolate not just apps,
but also devices, as well as incompatibilities between Linux drivers and modern
hardware. (While these driver issues are not inherent to the architecture of
Qubes OS, they affected us nonetheless, since we use Linux-based VMs to handle
devices.)&lt;/p&gt;

&lt;h3 id=&quot;the-hypervisor-as-a-single-point-of-failure&quot;&gt;The hypervisor as a single point of failure&lt;/h3&gt;

&lt;p&gt;Since the beginning, we’ve relied on virtualization technology to isolate
individual qubes from one another. However, this has led to the problem of
over-dependence on the hypervisor. In recent years, as more and more top notch
researchers have begun scrutinizing Xen, a number of &lt;a href=&quot;https://xenbits.xen.org/xsa/&quot;&gt;security bugs&lt;/a&gt;
have been discovered. While &lt;a href=&quot;https://www.qubes-os.org/security/xsa/&quot;&gt;many&lt;/a&gt; of them did not affect the
security of Qubes OS, there were still too many that did. :(&lt;/p&gt;

&lt;p&gt;Potential Xen bugs present just one, though arguably the most serious, security
problem. Other problems arise from the underlying architecture of the x86
platform, where various inter-VM side- and covert-channels are made possible
thanks to the aggressively optimized multi-core CPU architecture, most
spectacularly demonstrated by the recently published &lt;a href=&quot;https://meltdownattack.com/&quot;&gt;Meltdown and Spectre
attacks&lt;/a&gt;. Fundamental problems in other areas of the underlying
hardware have also been discovered, such as the &lt;a href=&quot;https://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.html&quot;&gt;Row Hammer Attack&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This leads us to a conclusion that, at least for some applications, we would
like to be able to achieve better isolation than currently available hypervisors
&lt;em&gt;and&lt;/em&gt; commodity hardware can provide.&lt;/p&gt;

&lt;h2 id=&quot;how&quot;&gt;How?&lt;/h2&gt;

&lt;p&gt;One possible solution to these problems is actually to “move Qubes to the
cloud.” Readers who are allergic to the notion of having their private
computations running in the (untrusted) cloud should not give up reading just
yet. Rest assured that we will also discuss other solutions not involving the
cloud. The beauty of Qubes Air, we believe, lies in the fact that all these
solutions are largely isomorphic, from both an architecture and code point of
view.&lt;/p&gt;

&lt;h2 id=&quot;example-qubes-in-the-cloud&quot;&gt;Example: Qubes in the cloud&lt;/h2&gt;

&lt;p&gt;Let’s start with one critical need that many of our customers have expressed:
Can we have “Qubes in the Cloud”?&lt;/p&gt;

&lt;p&gt;As I’ve emphasized over the years, the essence of Qubes does not rest in the Xen
hypervisor, or even in the simple notion of “isolation,” but rather in the
&lt;a href=&quot;https://invisiblethingslab.com/resources/2014/Software_compartmentalization_vs_physical_separation.pdf&quot;&gt;careful decomposition&lt;/a&gt; of various workflows, devices, apps
across securely compartmentalized containers. Right now, these are mostly
desktop workflows, and the compartments just happen to be implemented as Xen
VMs, but neither of these aspects is essential to the nature of Qubes.
Consequently, we can easily imagine Qubes running on top of VMs that are hosted
in some cloud, such as Amazon EC2, Microsoft Azure, Google Compute Engine, or
even a decentralized computing network, such as &lt;a href=&quot;https://golem.network/&quot;&gt;Golem&lt;/a&gt;. This is illustrated (in
a very simplified way) in the diagram below:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/attachment/wiki/posts/qubes-cloud.png&quot;&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-cloud.png&quot; alt=&quot;Simplified Qubes-as-a-Service scenario&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It should be clear that such a setup automatically eliminates the deployment
problem discussed above, as the user is no longer expected to perform any
installation steps herself. Instead, she can access Qubes-as-a-Service with just
a Web browser or a mobile app. This approach may trade security for convenience
(if the endpoint device used to access Qubes-as-a-Service is insufficiently
protected) or privacy for convenience (if the cloud operator is not trusted).
For many use cases, however, the ability to access Qubes from any device and any
location makes the trade-off well worth it.&lt;/p&gt;

&lt;p&gt;We said above that we can imagine “Qubes running on top of VMs” in some cloud,
but what exactly does that mean?&lt;/p&gt;

&lt;p&gt;First and foremost, we’d want the &lt;a href=&quot;https://www.qubes-os.org/news/2017/10/03/core3/&quot;&gt;Qubes Core Stack&lt;/a&gt; connected to
that cloud’s management API, so that whenever the user executes, say,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-create&lt;/code&gt; (or, more generally, issues any &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;Admin API&lt;/a&gt; call, in
this case &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.Create.*&lt;/code&gt;) a new VM gets created and properly connected in
the Qubes infrastructure.&lt;/p&gt;

&lt;p&gt;This means that most (all?) Qubes Apps (e.g. Split GPG, PDF and image
converters, and many more), which are built around qrexec, should Just Work (TM)
when run inside a Qubes-as-a-Service setup.&lt;/p&gt;

&lt;p&gt;Now, what about the Admin and GUI domains? Where would they go in a
Qubes-as-a-Service scenario? This is an important question, and the answer is
much less obvious. We’ll return to it below. First, let’s look at a couple more
examples that demonstrate how Qubes Air could be implemented.&lt;/p&gt;

&lt;h2 id=&quot;example-hybrid-mode&quot;&gt;Example: Hybrid Mode&lt;/h2&gt;

&lt;p&gt;Some users might decide to run a subset of their qubes (perhaps some personal
ones) on their local laptops, while using the cloud only for other, less
privacy-sensitive VMs.  In addition to privacy, another bonus of running some of
the VMs locally would be much lower GUI latency (as we discuss below).&lt;/p&gt;

&lt;p&gt;The ability to run some VMs locally and some in the cloud is what I refer to as
&lt;em&gt;Hybrid Mode&lt;/em&gt;. The beauty of Hybrid Mode is that the user doesn’t even have to
be aware (unless specifically interested!) in whether a particular VM is running
locally or in the cloud. The Admin API, qrexec services, and even the GUI,
should all automatically handle both cases. Here’s an example of a Hybrid Mode
configuration:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/attachment/wiki/posts/qubes-cloud-hybrid.png&quot;&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-cloud-hybrid.png&quot; alt=&quot;Qubes hybrid scenario&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another benefit of Hybrid Mode is that it can be used to host VMs across several
different cloud providers, not just one. This allows us to solve the problem of
over-dependence on a single isolation technology, e.g. on one specific
hypervisor. Now, if a fatal security bug is discovered that affects one of the
cloud services hosting a group of our VMs, the vulnerability will not
automatically affect the security of our other groups of VMs, since the other
groups may be hosted on different cloud services, or not in the cloud at all.
Crucially, different groups of VMs may be run on different underlying
containerization technologies and different hardware, allowing us to diversify
our risk exposure against any single class of attack.&lt;/p&gt;

&lt;h2 id=&quot;example-qubes-on-air-gapped-devices&quot;&gt;Example: Qubes on “air-gapped” devices&lt;/h2&gt;

&lt;p&gt;This approach even allows us to host each qube (or groups of them) on a
physically distinct computer, such as a Raspberry PI or &lt;a href=&quot;https://inversepath.com/usbarmory&quot;&gt;USB Armory&lt;/a&gt;.
Despite the fact that these are physically separate devices, the Admin API
calls, qrexec services, and even GUI virtualization should all work seamlessly
across these qubes!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/attachment/wiki/posts/qubes-airgap.png&quot;&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-airgap.png&quot; alt=&quot;Qubes with some qubes running on &amp;quot;air-gapped&amp;quot; devices&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For some users, it may be particularly appealing to host one’s &lt;a href=&quot;https://www.qubes-os.org/doc/split-gpg/&quot;&gt;Split GPG
backend&lt;/a&gt; or password manager on a physically separate qube. Of course,
it should also be possible to run normal GUI-based apps, such as office suites,
if one wants to dedicate a physically separate qube to work on a sensitive
project.&lt;/p&gt;

&lt;p&gt;The ability to host qubes on distinct physical devices of radically different
kinds opens up numerous possibilities for working around the security problems
with hypervisors and processors we face today.&lt;/p&gt;

&lt;h2 id=&quot;under-the-hood-qubes-zones&quot;&gt;Under the hood: Qubes Zones&lt;/h2&gt;

&lt;p&gt;We’ve been thinking about what changes to the current Qubes architecture,
especially to the &lt;a href=&quot;https://www.qubes-os.org/news/2017/10/03/core3/&quot;&gt;Qubes Core Stack&lt;/a&gt;, would be necessary to make
the scenarios outlined above easy (and elegant) to implement.&lt;/p&gt;

&lt;p&gt;There is one important new concept that should make it possible to support all
these scenarios with a unified architecture. We’ve named it &lt;strong&gt;Qubes Zones&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Zone&lt;/strong&gt; is a concept that combines several things together:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;An underlying “isolation technology” used to implement qubes, which may or
may not be VMs. For example, they could be Raspberry PIs, USB Armory devices,
Amazon EC2 VMs, or Docker containers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The inter-qube communication technology. In the case of qubes implemented as
Xen-based VMs (as in existing Qubes OS releases), the Xen-specific shared
memory mechanism (so called Grant Tables) is used to implement the
communication between qubes. In the case of Raspberry PIs, Ethernet
technology would likely be used. In the case of Qubes running in the cloud,
some form of cloud-provided networking would provide inter-qube
communication.  Technically speaking, this is about how Qubes’ vchan would be
implemented, as the qrexec layer should remain the same across all possible
platforms.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;A “local copy” of an &lt;em&gt;Admin qube&lt;/em&gt; (previously referred to as the “AdminVM”),
used mainly to orchestrate VMs and make policing decisions for all the qubes
within the Zone. This Admin qube can be in either “Master” or “Slave” mode,
and there can only be one Admin qube running as Master across all the Zones
in &lt;em&gt;one Qubes system&lt;/em&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Optionally, a “local copy” of &lt;em&gt;GUI qube&lt;/em&gt; (previously referred to as the “GUI
domain” or “GUIVM”). As with the Admin qube, the GUI qube runs in either
Master or Slave mode. The user is expected to connect (e.g. with the RDP
protocol) or log into the GUI qube that runs in Master mode (and only that
one), which has the job of combining all the GUI elements exposed via the
other GUI qubes (all of which must run in Slave mode).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Some technology to implement storage for the qubes running within the Zone.
In the case of Qubes OS running Xen, the local disk is used to store VM
images (more specifically, in Qubes 4.0 we use &lt;a href=&quot;https://github.com/QubesOS/qubes-issues/issues/1842&quot;&gt;Storage
Pools&lt;/a&gt; by default). In the case of a Zone composed of a
cluster of Raspberry PIs or similar devices, the storage could be a bunch of
micro-SD cards (each plugged into one Raspberry PI) or some kind of network
storage.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;/attachment/wiki/posts/qubes-zones.png&quot;&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-zones.png&quot; alt=&quot;Qubes Zones is the key new concept for Qubes Air&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So far, this is nothing radically new compared to what we already have in Qubes
OS, especially since we have nearly completed our effort to abstract the Qubes
architecture away from Xen-specific details – an effort we code-named &lt;a href=&quot;https://blog.invisiblethings.org/2013/03/21/introducing-qubes-odyssey-framework.html&quot;&gt;&lt;em&gt;Qubes
Odyssey&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What &lt;em&gt;is&lt;/em&gt; radically different is that we now want to allow more than one Zone to
exist in a single Qubes system!&lt;/p&gt;

&lt;p&gt;In order to support multiple Zones, we have to provide transparent proxying of
qrexec services across Zones, so that a qube need not be aware that another qube
from which it requests a service resides in a different zone.  This is the main
reason we’ve introduce multiple “local” Admin qubes – one for each Zone.  Slave
Admin qubes are also bridges that allow the Master Admin qube to manage the
whole system (e.g. request the creation of new qubes, connect and set up storage
for qubes, and set up networking between qubes).&lt;/p&gt;

&lt;h2 id=&quot;under-the-hood-qubes-interfaces&quot;&gt;Under the hood: qubes’ interfaces&lt;/h2&gt;

&lt;p&gt;Within one Zone, there are multiple &lt;em&gt;qubes&lt;/em&gt;. Let me stress that the term “qube”
is very generic and does not imply any specific technology. It could be a VM
under &lt;em&gt;some&lt;/em&gt; virtualization system. It could be some kind of a container or a
physically separate computing device, such as a Raspberry PI, Arduino board, or
similar device.&lt;/p&gt;

&lt;p&gt;While a qube can be implemented in many different ways, there are certain
features it should have:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;A qube should implement a &lt;a href=&quot;https://github.com/QubesOS/qubes-core-vchan-xen&quot;&gt;vchan endpoint&lt;/a&gt;. The actual technology on
top of which this will be implemented – whether some shared memory within a
virtualization or containerization system, TCP/IP, or &lt;a href=&quot;https://tools.ietf.org/html/rfc1149&quot;&gt;something
else&lt;/a&gt; – will be specific to the kind
of Zone it occupies.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;A qube should implement a &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/&quot;&gt;qrexec&lt;/a&gt; endpoint, though this should be very
straightforward if a vchan endpoint has already been implemented. This
ensures that most (all?) the qrexec services, which are the basis for most
of the integration, apps, and services we have created for Qubes, should
Just Work(TM).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Optionally, for some qubes, a GUI endpoint should also be implemented (see
the discussion below).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;In order to be compatible with Qubes &lt;a href=&quot;https://blog.invisiblethings.org/2011/09/28/playing-with-qubes-networking-for-fun.html&quot;&gt;networking&lt;/a&gt;, a qube should expect
&lt;em&gt;one&lt;/em&gt; uplink network interface (to be exposed by the management technology
specific to that particular Zone), and (optionally) multiple downlink
network interfaces (if it is to work as a proxy qube, e.g. VPN or
firewalling qube).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Finally, a qube should expect two kinds of volumes to be exposed by the
Zone-specific management stack:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;one read-only, which is intended to be used as a root filesystem by the
qube (the management stack might also expose an auxiliary volume for
implementing copy-on-write illusion for the VM, like the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;volatile.img&lt;/code&gt;
we currently expose on Qubes),&lt;/li&gt;
      &lt;li&gt;and one read-writable, which is specific to this qube, and which is
intended to be used as home directory-like storage.
This is, naturally, to allow the implementation of Qubes &lt;a href=&quot;https://www.qubes-os.org/getting-started/#appvms-qubes-and-templatevms&quot;&gt;templates&lt;/a&gt;, a
mechanism that we believe brings not only a lot of convenience but also some
&lt;a href=&quot;https://www.qubes-os.org/news/2017/04/26/qubes-compromise-recovery/&quot;&gt;security benefits&lt;/a&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;gui-virtualization-considerations&quot;&gt;GUI virtualization considerations&lt;/h2&gt;

&lt;p&gt;Since &lt;a href=&quot;https://www.qubes-os.org/attachment/wiki/QubesArchitecture/arch-spec-0.3.pdf&quot;&gt;the very beginning&lt;/a&gt;, Qubes was envisioned as a system for
desktop computing (as opposed to servers). This implied that &lt;a href=&quot;https://www.qubes-os.org/doc/gui/&quot;&gt;GUI
virtualization&lt;/a&gt; was part of the core Qubes infrastructure.&lt;/p&gt;

&lt;p&gt;However, with some of the &lt;em&gt;security-optimized&lt;/em&gt; management infrastructure we have
recently added to Qubes OS, i.e. &lt;a href=&quot;https://www.qubes-os.org/news/2015/12/14/mgmt-stack/&quot;&gt;Salt stack integration&lt;/a&gt; (which
significantly shrinks the attack surface on the system TCB compared to more
traditional “management” solutions), the &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;Qubes Admin API&lt;/a&gt; (which
allows for the fine-grained decomposition of management roles), and deeply
integrated features such as &lt;a href=&quot;https://www.qubes-os.org/getting-started/#appvms-qubes-and-templatevms&quot;&gt;templates&lt;/a&gt;, we think Qubes Air may also be useful
in some non-desktop applications, such as the embedded appliance space, and
possibly even on the server/services side. In this case, it makes perfect sense
to have qubes not implement GUI protocol endpoints.&lt;/p&gt;

&lt;p&gt;However, I still think that the primary area where Qubes excels is in securing
desktop workflows. For these, we need GUI &lt;del&gt;virtualization&lt;/del&gt;multiplexing, and
the qubes need to implement GUI protocol endpoints. Below, we discuss some of
the trade-offs involved here.&lt;/p&gt;

&lt;p&gt;The Qubes &lt;a href=&quot;https://www.qubes-os.org/doc/gui/&quot;&gt;GUI protocol&lt;/a&gt; is optimized for security. This means that
the protocol is designed to be extremely simple, allowing only for very simple
processing on incoming packets, thus significantly limiting the attack surface
on the GUI daemon (which is usually considered trusted). The price we pay for
this security is the lack of various optimizations, such as on-the-fly
compression, which others protocols, such as VNC and RDP, naturally offer. So
far, we’ve been able to get away with these trade-offs, because in current Qubes
releases the GUI protocol runs over Xen shared memory. DRAM is very fast (i.e
has low latency and super-high bandwidth), and the implementation on Xen smartly
makes use of page &lt;em&gt;sharing&lt;/em&gt; rather than memory &lt;em&gt;copying&lt;/em&gt;, so that it achieves
near native speed (of course with the limitation that we don’t expose GPU
functionalities to VMs, which might limit the experience in some graphical
applications anyway).&lt;/p&gt;

&lt;p&gt;However, when qubes run on remote computers (e.g in the cloud) or on physically
separate computers (e.g. on a cluster of Raspberry PIs), we face the potential
problem of graphics performance. The solution we see is to introduce a local
copy of the GUI qube into each zone. Here, we make the assumption that there
should be a significantly faster communication channel available between qubes
within a Zone than between Zones.  For example, inter-VM communication within
one data center should be significantly faster than between the user’s laptop
and the cloud. The Qubes GUI protocol is then used between qubes and the local
GUI qube within a single zone, but a more efficient (and more complex) protocol
is used to aggregate the GUI into the Master GUI qube from all the Slave GUI
qubes.  Thanks to this combined setup, we still get the benefit of a reasonably
secure GUI. Untrusted qubes still use the Qubes secure GUI protocol to
communicate with the local GUI qube. However, we also benefit from the greater
efficiency of remote access-optimized protocols such as RDP and VNC to get the
GUI onto the user’s device over the network. (Here, we make the assumption that
the Slave GUI qubes are significantly more trustworthy than other
non-privileged qubes in the Zone. If that’s not the case, &lt;em&gt;and&lt;/em&gt; if we’re also
worried about an attacker who has compromised a Slave GUI qube to exploit a
potential bug in the VNC or RDP protocol in order to attack the Master GUI
qube, we could still resort to the fine-grained Qubes Admin API to limit the
potential damage the attacker might inflict.)&lt;/p&gt;

&lt;h2 id=&quot;digression-on-the-cloudification-of-apps&quot;&gt;Digression on the “cloudification” of apps&lt;/h2&gt;

&lt;p&gt;It’s hard not to notice how the model of desktop applications has changed over
the past decade or so, where many standalone applications that previously ran on
desktop computers now run in the cloud and have only their frontends executed in
a browser running on the client system. How does the Qubes compartmentalization
model, and more importantly Qubes as a &lt;em&gt;desktop&lt;/em&gt; OS, deal with this change?&lt;/p&gt;

&lt;p&gt;Above, we discussed how it’s possible to move Qubes VMs from the user’s local
machine to the cloud (or to physically separate computers) without the user
having to notice. I think it will be a great milestone when we finally get
there, as it will open up many new applications, as well as remove many
obstacles that today prevent the easy deployment of Qubes OS (such as the need
to find and maintain dedicated hardware).&lt;/p&gt;

&lt;p&gt;However, it’s important to ask ourselves how relevant this model will be in the
coming years. Even with our new approach, we’re still talking about classic
standalone desktop applications running in qubes, while the rest of the world
seems to be moving toward an app-as-a-service model in which everything is
hosted in the cloud (e.g. Google Docs and Microsoft Office 365).  How relevant
is the whole Qubes architecture, even the cloud-based version, in the
app-as-a-service model?&lt;/p&gt;

&lt;p&gt;I’d like to argue that the Qubes architecture still makes perfect sense in this
new model.&lt;/p&gt;

&lt;p&gt;First, it’s probably easy to accept that there will always be applications that
users, both individual and corporate, will prefer (or be forced) to run locally,
or at least on trusted servers. At the same time, it’s very likely that these
same users will want to embrace the general, public cloud with its multitude of
app-as-a-service options. Not surprisingly, there will be a need for isolating
these workloads from interfering with each other.&lt;/p&gt;

&lt;p&gt;Some examples of payloads that are better suited as traditional, local
applications (and consequently within qubes), are MS Office for sensitive
documents, large data-processing applications, and… networking and USB drivers
and stacks. The latter things may not be very visible to the user, but we can’t
really offload them to the cloud. We have to host them on the local machine, and
they present a huge attack surface that jeopardizes the user’s other data and
applications.&lt;/p&gt;

&lt;p&gt;What about isolating web apps from each other, as well as protecting the host
from them? Of course, that’s the primary task of the Web browser. Yet, despite
vendors’ best efforts, browser security measures are still being circumvented.
Continued expansion of the APIs that modern browsers expose to Web applications,
such as &lt;a href=&quot;https://en.wikipedia.org/wiki/WebGL&quot;&gt;WebGL&lt;/a&gt;, suggests that this state of affairs may not significantly
improve in the foreseeable future.&lt;/p&gt;

&lt;p&gt;What makes the Qubes model especially useful, I think, is that it allows us to
put the whole browser in a container that is isolated by stronger mechanisms
(simply because Qubes does not have to maintain all the interfaces that the
browser must) and is managed by Qubes-defined policies. It’s rather natural to
imagine, e.g. a Chrome OS-based template for Qubes (perhaps even a
unikernel-based one), from which lightweight browser VMs could be created,
running either on the user’s local machine, or in the cloud, as described above.
Again, there will be pros and cons to both approaches, but Qubes should support
both – and mostly seamlessly from the user’s and admin’s points of view (as
well the Qubes service developer’s point of view!).&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Qubes Air is the next step on our roadmap to making the concept of “Security
through Compartmentalization” applicable to more scenarios. It is also an
attempt to address some of the biggest problems and weaknesses plaguing the
current implementation of Qubes, specifically the difficulty of deployment and
virtualization as a single point of failure. While Qubes-as-a-Service is one
natural application that could be built on top of Qubes Air, it is certainly not
the only one. We have also discussed running Qubes over clusters of physically
isolated devices, as well as various hybrid scenarios. I believe the approach to
security that Qubes has been implementing for years will continue to be valid
for years to come, even in a world of apps-as-a-service.&lt;/p&gt;

</description>
        <pubDate>Mon, 22 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2018/01/22/qubes-air.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2018/01/22/qubes-air.html</guid>
        
        
      </item>
    
      <item>
        <title>Introducing the Next Generation Qubes Core Stack</title>
        <description>&lt;p&gt;This is the 2nd post from the “cool things coming in Qubes 4.0” series, and it
discusses the next generation Qubes Core Stack version 3, which is the heart of
the new Qubes 4.x releases. The &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;previous part&lt;/a&gt; discussed the
Admin API which we also introduced in Qubes 4.0 and which heavily relies on this
new Qubes Core Stack.&lt;/p&gt;

&lt;h2 id=&quot;qubes-core-stack-vs-qubes-os&quot;&gt;Qubes Core Stack vs. Qubes OS&lt;/h2&gt;

&lt;p&gt;Qubes Core Stack is, as the name implies, the core component of Qubes OS. It’s
the glue that connects all the other components together, and which allows users
and admins to interact with and configure the system. For the record, the other
components of the Qubes system include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;VM-located core agents (implementing e.g. qrexec endpoints used by various
Qubes services),&lt;/li&gt;
  &lt;li&gt;VM-customizations (making the VMs lightweight and working well with seamless
GUI virtualization),&lt;/li&gt;
  &lt;li&gt;Qubes GUI virtualization (the protocol, VM-located agents, and daemons
located in the GUI domain which, for now, happens to be the same as dom0),&lt;/li&gt;
  &lt;li&gt;GUI domain customizations (Desktop Environment customizations, decoration
coloring plugin, etc),&lt;/li&gt;
  &lt;li&gt;The AdminVM distribution (various customizations, special services, such as
for receiving and verifying updates, in the future: custom distro),&lt;/li&gt;
  &lt;li&gt;The Xen hypervisor (with a bunch of customization patches, occasional
hardening) or - in the future - some other virtualising or containerizing
software or technology,&lt;/li&gt;
  &lt;li&gt;Multiple “Qubes Apps” (various services built on top of Qubes qrexec
infrastructure, such as: trusted PDF and Image converters, Split GPG, safe
USB proxies for HID devices, USB proxy for offering USB devices (exposed via
qvm-usb), Yubikey support, USB Armory support, etc)&lt;/li&gt;
  &lt;li&gt;Various ready-to-use templates (e.g. Debian-, Whonix-based), which are used
to create actual VMs, i.e. provide the root filesystem to the VMs,&lt;/li&gt;
  &lt;li&gt;Salt Stack integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And all these components are “glued together” by the Qubes Core Stack. The
diagram below illustrates the location of all these components in the overall
system architecture. Unlike many other Qubes architecture diagrams, this one
takes an AppVM-centric approach. (Click the image for the full size version.)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-components.png&quot; alt=&quot;Qubes system components&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There are also a bunch of additional components not shown on the diagram above,
and which technically are not part of a Qubes system, but which are instrumental
in &lt;em&gt;building&lt;/em&gt; of the system:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;qubes-builder,&lt;/li&gt;
  &lt;li&gt;template-builder,&lt;/li&gt;
  &lt;li&gt;tons of automatic tests,&lt;/li&gt;
  &lt;li&gt;as well as all the supporting infrastructure for building, testing and
distributing Qubes and the updates, and hosting of the website and
documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see Qubes is a pretty complex creature, and the Qubes Core Stack is
central to its existence.&lt;/p&gt;

&lt;h2 id=&quot;qubes-vms-the-building-blocks-for-explicit-partitioning-model&quot;&gt;Qubes VMs: the building blocks for Explicit Partitioning Model&lt;/h2&gt;

&lt;p&gt;Qubes implements &lt;em&gt;explicit partitioning&lt;/em&gt; security model, which means that users
(and/or admins) can define multiple &lt;em&gt;security domains&lt;/em&gt; and decide what these
domains can and cannot do. This is a different model than the popular sandboxing
model, as implemented by increasingly many applications and products today,
where every application is automatically sandboxed and some more-or-less
pre-defined set of rules is used to prevent behaviour considered “unsafe”
(whatever that might mean…). I believe the explicit partitioning model
provides many benefits over the sandboxing model, among the most important one
being that it is information-oriented, rather than application-oriented. In
other words it tries to limit damage to the (user’s) data, rather to the
(vendor’s) code and infrastructure.&lt;/p&gt;

&lt;p&gt;There have always been a few different kinds of VMs in Qubes: AppVMs, Template
VMs, Standalone VMs, NetVMs, ProxyVMs, DispVM, etc. In Qubes 4 we have slightly
simplified and cleaned up these categories.&lt;/p&gt;

&lt;p&gt;First we’ve hidden the PV vs HVM distinction. Now each VM has a property named
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virt_mode&lt;/code&gt; which is used to decide whether it should be virtualized using Xen
para-virtualization (PV), full virtualization with auxiliary qemu in isolated
“stub domain” (HVM), or – in the near future – as full virtualization
&lt;em&gt;without&lt;/em&gt; qemu and the additional stub domain (PVH). This means we no longer
classify VMs as PV vs HVMs, because every VM can be easily switched between
various modes of virtualization with a flip of a property.&lt;/p&gt;

&lt;p&gt;We also no longer distinguish between AppVMs, NetVMs and Proxy VMs. Instead,
each VM has a property &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;provides_network&lt;/code&gt;, which is false by default, except for
the VMs which we want to expose networking to other VMs (e.g. because they might
have some networking device assigned, such as cellular modem or WiFi device, or
because they act as VPNs or proxies of some sort).&lt;/p&gt;

&lt;p&gt;We discuss what the properties are and how to check/set them, later in this
article.&lt;/p&gt;

&lt;p&gt;So, to recap, starting with Qubes 4.0 we have only the following classes of VMs:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppVM&lt;/code&gt; - covers what we called AppVMs, NetVMs, and ProxyVMs in earlier Qubes
releases,&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DispVM&lt;/code&gt; - defined by not having a persistent private image across VM
reboots (see also below),&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TemplateVM&lt;/code&gt; - these provide root filesystem for AppVMs, the semantics
haven’t changed in Qubes 4,&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StandaloneVM&lt;/code&gt; - these are like AppVMs, but are &lt;em&gt;not&lt;/em&gt; based on any
TemplateVM,&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AdminVM&lt;/code&gt; a singleton (i.e. a class which has only one instance), which
represents the Administrator VM (Up until recently called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;, a term
we’re departing from, given it is Xen-specific).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One can list all the VM classes known to the stack using the following command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-create --help-classes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;BTW, we’ve been recently promoting the use of alternative names to “VM(s)”, such
as domain(s), and - more recently - “qube(s)”. This is to stress the connection
between Qubes and virtualization technology is less tight that many might
perceive. Another reason is that, we believe, for many users these alternative
terms might be more friendly than “VMs”, which apparently have strong technical
connotation. The author is quite used to the term VM, however, so should be
excused for (ab)using this term throughout her writings.&lt;/p&gt;

&lt;h2 id=&quot;properties-features-and-tags&quot;&gt;Properties, Features and Tags&lt;/h2&gt;

&lt;p&gt;Each VM (domain) in Qubes can have a number of properties, features and tags,
which describe both how it should behave, as well as what features or services
it offers to other VMs:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Properties&lt;/strong&gt;, as the name suggests, are used to change the behaviour of the
VM and/or how it is treated by the Qubes Core Stack. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virt_mode&lt;/code&gt; property
mentioned above is a good example. For a list of other properties, take a
look &lt;a href=&quot;https://dev.qubes-os.org/projects/core-admin/en/latest/qubes.html#properties&quot;&gt;here&lt;/a&gt;. A command which can be used to list, read and
set properties for a VM is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-prefs&lt;/code&gt; (see below).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt; are very similar to properties, except that they are mostly
opaque to the Core (unlike properties, which are well defined and sanitized).
Features are essentially a dictionary of ‘key=value’ pairs assigned to each
VM. They can be used in various places outside of the main logic of the Core
Stack, specifically in &lt;a href=&quot;https://dev.qubes-os.org/projects/core-admin/en/latest/qubes-ext.html&quot;&gt;Core Extensions&lt;/a&gt;. A new tool in
Qubes 4 used to inspect or set features is called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-features&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;A good example of a mechanism implemented on top of features are
&lt;strong&gt;services&lt;/strong&gt;, which have been reimplemented in Qubes 4. Services are used to
let the VM agents know about whether various additional services, such as
Network Manager, should be enabled or not. Indeed, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-service&lt;/code&gt; tool now
(i.e.  in Qubes 4.0) internally simply creates features named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service.XYZ&lt;/code&gt;,
where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XYZ&lt;/code&gt; is the name of the service passed to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-service&lt;/code&gt;. It also takes
care of interpreting the true/false values.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Finally, each VM can also have some &lt;strong&gt;tags&lt;/strong&gt; associated with it. Unlike
features, tags do not have a value – a VM can either have a specific tag
(“can be tagged with it”) or not. Unlike properties, they are not interpreted
by any core logic of the Core Stack. The sole purpose of tags is that they
can be used for qrexec policy rules, as discussed below. (This is also the
reason why we wanted to keep them absolutely simple – any complexity within
qrexec policy parsing code would definitely be asking for troubles…).&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last but not least, we should mention that each of the VM has a &lt;strong&gt;unique
name&lt;/strong&gt; associated with it. VM names in Qubes are like filenames in the
filesystem – not only they are unique, but they also are used as a primary
way of identifying VMs, especially for security-related decisions (e.g. for
qrexec policy construction, see below).&lt;/p&gt;

&lt;p&gt;And just as one can get away with using generic tagging schemes in place of
referring to paths and filenames in some security systems, similarly in Qubes OS
one can refer to tags (mentioned above and discussed later) in the policy
(but currently not in firewalling rules).&lt;/p&gt;

&lt;p&gt;Internally, a VM’s name is implemented as the property
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; and thus can be read using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-prefs&lt;/code&gt;. It cannot be changed, however,
because, starting with Qubes 4.0, we treat it as an immutable property.
User-exposed tools, however, do have a “VM rename” operation, which is
implemented as creating a copy of the VM with the new name and removing the old
VM. Thanks to the new volume
manager we also introduced in Qubes 4 (and which will be the topic of another
post), this operation is actually very cheap, disk-wise.&lt;/p&gt;

&lt;p&gt;So, let us now start a console in AdminVM (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;) and play a bit with these
mechanisms.&lt;/p&gt;

&lt;p&gt;Let’s start with something very simple and let us take a look at the properties
of the AdminVM (in the current Qubes implemented by Xen’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs dom0
default_dispvm  D  fedora-25-dvm
label           -  black
name            D  dom0
qid             D  0
uuid            D  00000000-0000-0000-0000-000000000000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As we can see, there aren’t many properties for the AdminVM, and none of them
can be modified by the user or admin. While we’re here, we should mention there
exists a similar tool, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes-prefs&lt;/code&gt; which allows one to view and modify the
&lt;strong&gt;global system properties&lt;/strong&gt;, and these properties should not be confused with
the properties of the AdminVM:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qubes-prefs
check_updates_vm       D  True
clockvm                -  sys-net
default_dispvm         -  fedora-25-dvm
default_fw_netvm       D  None
default_kernel         -  4.9.45-21
default_netvm          -  sys-firewall
default_pool           D  lvm
default_pool_kernel    -  linux-kernel
default_pool_private   D  lvm
default_pool_root      D  lvm
default_pool_volatile  D  lvm
default_template       -  fedora-25
stats_interval         D  3
updatevm               -  sys-firewall
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, let’s inspect an ordinary AppVM, say &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; (which is one of the default
VMs created by the installer, but, of course, the user might have it named
differently):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs work
autostart             D  False
backup_timestamp      D
debug                 D  False
default_dispvm        D  fedora-25-dvm
default_user          D  user
gateway               D
include_in_backups    D  True
installed_by_rpm      D  False
ip                    D
kernel                D  4.9.45-21
kernelopts            D  nopat
label                 -  blue
mac                   D  00:16:3E:5E:6C:00
maxmem                D  4000
memory                D  400
name                  -  work
netvm                 -  None
provides_network      D  False
qid                   -  8
qrexec_timeout        D  60
stubdom_mem           U
stubdom_xid           D  6
template              -  fedora-25
template_for_dispvms  D  False
updateable            D  False
uuid                  -  fab9a577-2531-4971-bce1-ca0c9b511f27
vcpus                 D  2
virt_mode             D  hvm
visible_gateway       D
visible_ip            D
visible_netmask       D
xid                   D  5
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We see lots of properties which have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D&lt;/code&gt; flag displayed, which indicates the
property uses the core-provided default value. In most cases the user is able to
override these values for specific VMs. For example the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virt_mode&lt;/code&gt; property is
by default set to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hvm&lt;/code&gt; for all AppVMs, which means that full virtualization
mode is used for the domain, but we can override this for specific VM(s) with
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pv&lt;/code&gt; and thus force them to be virtualized using para-virtualization mode, which
is what the installer scripts do for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-net&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-usb&lt;/code&gt; VMs in Qubes
4.0-rc1 in order to work around problems with PCI passthrough support that we’ve
observed on some platforms.&lt;/p&gt;

&lt;p&gt;As a simple exercise with changing the property, we can switch off networking
for one of the AppVMs by setting its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;netvm&lt;/code&gt; property to an empty value:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs --set work netvm &quot;&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can now confirm that indeed the VM named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; has no network. E.g. we can
use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt; command (it should print &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt; in the column which indicated the
netvm), or open a terminal in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; VM itself and try to see if there is a
virtual networking device exposing the network (we can e.g. use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ifconfig&lt;/code&gt;
or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ip a&lt;/code&gt; commands).&lt;/p&gt;

&lt;p&gt;Instead of setting an empty value as the netvm, we could have also set some
other VM, thus forcing the networking traffic to pass through that other VM,
e.g. to route all the VM’s traffic through a Whonix Tor gateway:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs --set work netvm sys-whonix
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The VM which we want to use as the provider of networking services to other VMs,
such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-whonix&lt;/code&gt; in the example above, should have its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;provides_network&lt;/code&gt;
property set to true.&lt;/p&gt;

&lt;p&gt;To revert back to the system-default netvm (as specified by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes-prefs&lt;/code&gt;),
we can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--default&lt;/code&gt; switch:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs --default work netvm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now let us take a look at the features and services. It might be most
illustrative to look at both of these mechanisms together. Let’s suppose we
would like to enable the Network Manager service in some VM. Perhaps we would
like to use it to create a VPN connection terminated in one of the AppVMs, say
in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; VM. (An alternative option would be to create a separate VM, say
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work-vpn&lt;/code&gt;, set its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;provides_network&lt;/code&gt; property to true, enable the
network-manager service in there, and use it to provide networking to the other
VMs, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;To enable the Network Manager service and a handy widget that shows the status
of the VPN, we can do:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-service --enable work network-manager
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This should result in the following output:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-service work
network-manager  on
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We see the service is enabled, and if we restart the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; VM, we should see
the Network Manager widget appear in the tray.&lt;/p&gt;

&lt;p&gt;Now let’s view the features of this same VM:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-features work
service.network-manager  1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can now clearly see how the services are internally implemented on top of
features. This is done internally by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-services&lt;/code&gt; command and by the
scripts in the VMs, which interpret specifically-formatted features as services.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-service&lt;/code&gt; tool also takes care about properly setting and interpreting
the true/false and empty/non-empty strings to make sense for services states
(on/off), eliminating user mistakes.&lt;/p&gt;

&lt;p&gt;One thing left for us to explore are tags, discussed above, but we will defer
this discussion until a later chapter, which talks about qrexec policy, as tags
are exclusively for use within policies. For now, suffice to say, that there is
a dedicated tool, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-tags&lt;/code&gt; used to check and set/modify the tags for each of
the VM (in addition to some tags being automatically created by the Core Stack,
such as e.g. the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;created-by-XYZ&lt;/code&gt; tag, discussed in the previous article on
Admin API).&lt;/p&gt;

&lt;p&gt;As a final note we should stress one more time that VM names, despite being
normal property, are special in that the are immutable. In order to change the
name one needs to 1) create a new VM, 2) import the volume from the original VM
(using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.volume.CloneFrom&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.volume.CloneTo&lt;/code&gt; calls), as well
as 3) copy all the properties, tags, and features from the original VM, and
4) remove the original VM.&lt;/p&gt;

&lt;p&gt;Each of these operations can be controlled independently via qrexec policy.
While this might seem like a superficial complication at first sight, we believe
it allows to simplify the implementation, as well as to minimize the amount of
potential mistakes when creating policies, notably when there is more than one
management VMs in the system, such as e.g. the (de-privileged) GUI domain and
some corporate-owned (but also semi-privileged) management VM. This has been
discussed in more details in the &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;previous post on Admin API&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;disposable-vms-redesigned&quot;&gt;Disposable VMs redesigned&lt;/h2&gt;

&lt;p&gt;We have also redesigned how Disposable VMs (DispVMs) work in Qubes 4.0. Before
4.0, DispVMs had two kinds of largely unrelated characteristics: 1) being
disposable, i.e. having no persistent private image, and 2) booting from
pre-created savefiles in order to save on startup time.&lt;/p&gt;

&lt;p&gt;In Qubes 4.0 we have redefined DispVMs solely by this first property, i.e.
private-image-not-having, which we believe to be the essential characteristics
of a Disposable VM. The underlying mechanism, e.g.  whether the VM is restored
from a savefile to speed up the startup time, might or might not be implemented
for any VM and should not concern the user.&lt;/p&gt;

&lt;p&gt;Another major change to DispVMs semantics in Qubes 4 (largely allowed by this
relaxation of DispVM definition) is that any of the AppVMs can be now used as a
template for the DispVM.&lt;/p&gt;

&lt;p&gt;This provides lots of flexibility, e.g. it’s easy to create a customized DispVM
for signing PDF documents, or various disposable service VMs, such as Net- and
VPN- VMs. One just creates a normal AppVM, sets everything up there, e.g. loads
keys, configures VPNs, connects to known WiFi networks, and then shuts down the
AppVM and in place of it starts a DispVM based on that AppVM.&lt;/p&gt;

&lt;p&gt;This way, whenever one has a gut feeling that something’s wrong with the VM
(e.g.  because one just connected a USB stick to copy some slides), it’s easy to
just restart the DispVM in question and benefit from a new clean root
filesystem!  Admittedly sometimes this might not be enough to get rid of an
infection, as discussed in the recent post on &lt;a href=&quot;https://www.qubes-os.org/news/2017/04/26/qubes-compromise-recovery/&quot;&gt;Compromise
Recovery&lt;/a&gt;, but for many cases this feature is highly desirable.&lt;/p&gt;

&lt;p&gt;But opening up this flexibility comes at a price. We have to be careful about
which VMs can create which DispVMs. After all, it would be a disaster to allow
your casual Internet-browsing AppVM to spawn a DispVM based on your sensitive
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; AppVM. The casual Internet-browsing VM could have the new DispVM open a
malicious file that compromises the DispVM. The compromised DispVM would then be
able to leak sensitive work-related data, since it uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; VM as its
template.&lt;/p&gt;

&lt;p&gt;There are two mechanisms in place to prevent such mistakes:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Each AppVM has a property called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template_for_dispvms&lt;/code&gt;, which controls
whether this VM can serve as a template for Disposable VMs (i.e., whether any
DispVMs based on this VM are allowed in the system. By default,
this property is false for all AppVMs and needs to be manually enabled.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The choice of the template (i.e. specific AppVM) for the Disposable VM must
be provided by the qrexec policy (which the source VM cannot modify), and
defaults to the source VM’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;default_dispvm&lt;/code&gt; property, which by default has a
value as specified via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes-prefs&lt;/code&gt;. The resulting AppVM must have the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template_for_dispvms&lt;/code&gt; property set, or otherwise an error will occur.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here we will take a look at how the template can be specified explicitly when
starting the DispVM from dom0:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-run --dispvm=work --service qubes.StartApp+firefox
Running 'qubes.StartApp+firefox' on $dispvm:work
$dispvm:work: Refusing to create DispVM out of this AppVM, because template_for_dispvms=False
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As mentioned above, we also need to explicitly enable use of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; AppVM as
Disposable VMs templates:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-prefs --set work template_for_dispvms True
[user@dom0 ~]$ qvm-run --dispvm=work --service qubes.StartApp+firefox
Running 'qubes.StartApp+firefox' on $dispvm:work
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We will look into how the DispVM can be specified via qrexec policy in a later
chapter below.&lt;/p&gt;

&lt;h2 id=&quot;qubes-remote-execution-qrexec-the-underlying-integration-framework&quot;&gt;Qubes Remote Execution (qrexec): the underlying integration framework&lt;/h2&gt;

&lt;p&gt;Qubes OS is more than just a collection of isolated domains (currently
implemented as Xen VMs). The essential feature of Qubes OS, which sets
it apart from ordinary virtualization systems, is the unique way in which it
&lt;em&gt;securely integrates&lt;/em&gt; these isolated domains for use in a single endpoint
system.&lt;/p&gt;

&lt;p&gt;It’s probably accurate to say that the great majority of our efforts is on
building this integration in a manner so that it doesn’t ruin the isolation that
Xen provides to us.&lt;/p&gt;

&lt;p&gt;There are several layers of integration infrastructure in Qubes OS, as depicted
in the following diagram (click for full size) and described below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/qubes-integration.png&quot; alt=&quot;Integration layers in Qubes OS&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;First, there is the Xen-provided mechanism based on shared memory for
inter-VM communication (it’s called “grant tables” in Xen parlance). This is
then used to implement various Xen-provided drivers for networking and
virtual disk (called “block backends/frontends” by Xen). Generally, any
virtualization or containerization system provides some sort of similar
mechanisms, and we could easily use of any them on Qubes, because our Core
Stack uses libvirt to configure these mechanisms. Qubes does have some
specific requirements, however, the most unique one being that we want to put
the backends in unprivileged VMs, rather than in dom0 (or host or root
partition, however it is called in other systems). This is one of the reasons
why Xen still is our hypervisor of choice – most (all?) other systems assume
all the backends to be placed in the privileged domain, which clearly is
undesirable from the security point of view.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Next, we have the Qubes infrastructure layer, which builds on top of the
Xen-provided shared memory communication mechanism. The actual layer of
abstraction is called “vchan”. If we moved to another hypervisor, we would
need to have vchan implemented on top of whatever inter-VM infrastructure
that other hypervisor was to make available to us. Various Qubes-specific
mechanisms, such as our security-optimized GUI virtualization, builds on top
of vchan.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Finally, and most importantly, there is the Qubes-specific qrexec
infrastructure, which also builds on top of vchan, and which exposes
socket-like interfaces to processes running inside the VMs. This
infrastructure is governed by a centralized policy (enforced by the AdminVM).
Most of the Qubes-specific services and apps are built on top of qrexec, with
the notable exception of GUI virtualization, as mentioned earlier.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s important to understand several key properties of this qrexec
infrastructure, which distinguish it from other, seemingly similar, solutions.
First, qrexec does not attempt to perform any serialization (à la RPC). Instead,
it exposes only a simple “pipe”, pretty much like a TCP layer. This allows us to
keep the code which handles the incoming (untrusted) data very simple. Any kind
of (de-)serialization and parsing is offloaded to the specific code which has
been registered for that particular service (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;This might seem like a superficial win. After all, the data needs to be
de-serialized and parsed &lt;em&gt;somewhere&lt;/em&gt;, so why would it matter where exactly?
True, but what this model allows us to do is to selectively decide how much
risk we want to take for any specific domain by allowing (or not) specific
service calls from (specific or all) other domains.&lt;/p&gt;

&lt;p&gt;For example, by decoupling the (more complex) logic of data parsing as used by
the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; service from the core code of qrexec we can eliminate
potential attacks on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; server code by not allowing e.g. any
of the VMs tagged &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;personal&lt;/code&gt; to issue this call to any of the VMs tagged &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt;,
while at the same time still allowing all of these VMs to communicate with the
default clockvm (by default &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-net&lt;/code&gt;, adjustable via policy redirect as
discussed below) to request the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.GetDate&lt;/code&gt; service. We would not have such
a flexibility in trust partitioning if our qrexec infrastructure had
serialization built in (e.g. if it was implementing a protocol like DBus between
VMs). Of course, specific services might decide to use some complex serializing
protocols on top of qrexec (e.g. DBus) very easily, because qrexec connection is
seen as a socket by applications running in the VMs.&lt;/p&gt;

&lt;p&gt;Another important characteristic is the policing of qrexec, which is
something we discuss in the next section.&lt;/p&gt;

&lt;p&gt;Let’s write a simple qrexec service, which would be illustrative for what we
just discussed. Imagine we want to get the price of a Bitcoin (BTC), but the VM
where we need it has no network connectivity, perhaps because it contains some
very sensitive data and we want to cut off as much interfaces to the untrusted
external world as possible.&lt;/p&gt;

&lt;p&gt;In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt; VM we will create our simple server with the following body:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl -s https://blockchain.info/q/24hrprice
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above should be pasted into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/etc/qubes-rpc/my.GetBTCprice&lt;/code&gt;
file in our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt; AppVM (let’s name it… &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt;). Let’s also test if
the service work (still from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt; VM):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@untrusted ~]$ sudo chmod +x /etc/qubes-rpc/my.GetBTCprice
[user@untrusted ~]$ /usr/local/etc/qubes-rpc/my.GetBTCprice
(...)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We should see the recent price of Bitcoin displayed.&lt;/p&gt;

&lt;p&gt;Now, let’s create a network-disconnect, trusted AppVM called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wallet&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-create wallet -l blue --property netvm=&quot;&quot;
[user@dom0 ~]$ qvm-ls
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now from a console in this new AppVM, let’s try to call our newly created
service:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@wallet ~]$ qrexec-client-vm untrusted my.GetBTCprice
(...)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above command will invoke the (trusted) dialog box asking to confirm the
request and select the destination VM. For this experiment just select
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt; from the “Target” drop-down list and acknowledge (in case you wonder
why the target VM is specified twice – once in the requesting VM and for the
2nd time in the trusted dialog box: we will discuss it in the next section). You
should see the price of the bitcoin printed as a result.&lt;/p&gt;

&lt;p&gt;Before we move on to discussing the flexibility of qrexec policies, let’s pause
for a moment and recap what has just happened:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;The network-disconnected, trusted VM called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wallet&lt;/code&gt; requested the service
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my.GetBTCprice&lt;/code&gt; from a VM named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt;. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wallet&lt;/code&gt; VM had no way to
get the price of BTC, because it has no networking (for security).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;After the user confirmed the call (by clicking on the trusted
dialog box, or by having a specific &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allow&lt;/code&gt; policy, as discussed below), it
got passed to the destination VM: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The qrexec agent running in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;untrusted&lt;/code&gt; VM invoked the handling
code for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my.GetBTCprice&lt;/code&gt; service. This code, in turn, performed a number
of complex actions: it TCP-connected to some server on the internet
(blockchain.info), performed some very complex crypto handshake to establish
an HTTPS connection to that server, then retrieved some complex data over
that connection, and finally returned the price of Bitcoin. There’s
likely hundreds of thousands lines of code involved in this operation.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Finally, whatever the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my.GetBTCprice&lt;/code&gt; service returned on its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stdout&lt;/code&gt; was
automagically taken by qrexec agent and piped back to the requesting VM, our
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wallet&lt;/code&gt; VM.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wallet&lt;/code&gt; VM got the data it wanted &lt;em&gt;without&lt;/em&gt; the need to get involved in
all these complex operations, which take hundreds of thousands of lines of code
talking to untrusted computers over the network.  That’s how we can improve the
security of this process without spending effort on auditing or hardening
the programs used (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Of course that was a very simple example. But a very similar approach is used
among many Qubes services. E.g. system updates for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt; are downloaded in
untrusted VMs and exposed to (otherwise network-disconnected) &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt; via the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.ReceiveUpdates&lt;/code&gt; service (which later verifies digital signatures on the
packages). Another example is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.PdfConvert&lt;/code&gt;, which offloads the complex
parsing and rendering of PDFs to Disposable VMs and retrieves back only a very
simple format that is easily verified to be non-malicious. This simple format is
then converted back to a (now trusted) PDF.&lt;/p&gt;

&lt;h2 id=&quot;more-expressive-qrexec-policies&quot;&gt;More expressive qrexec policies&lt;/h2&gt;

&lt;p&gt;Because pretty much everything in Qubes which provides integration over the
compartmentalized domains is based on qrexec, it is imperative to have a
convenient (i.e. simple to use), secure (i.e. simple in implementation) yet
expressive enough mechanism to control who can request which qrexec services
from whom. Since the original qrexec policing was introduced in Qubes
release 1, the mechanism has undergone some slight gradual improvements.&lt;/p&gt;

&lt;p&gt;We still keep the policy as a collection of simple text files, located in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/policy/&lt;/code&gt; directory in the AdminVM (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;). This allows for
automating of the policy packaging into RPM (trusted) packages, as well policy
customization from within our integrated Salt Stack via (trusted) Salt state
files.&lt;/p&gt;

&lt;p&gt;Now, one of the coolest features we’ve introduced in Qubes 4.0 is the ability to
tag VMs and use these to make policy decisions.&lt;/p&gt;

&lt;p&gt;Imagine we have several work-related domains. We can now tag all them with some
tag of our choosing, say &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 user ~]$ qvm-tags itl-email add work
[user@dom0 user ~]$ qvm-tags accounting add work
[user@dom0 user ~]$ qvm-tags project-liberation add work
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now we can easily construct a qrexec policy, e.g. to constrain the file (or
clipbooard) copy operation, so that it’s allowed only between the VMs tagged as
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; (while preventing file transfer to and from any VM &lt;em&gt;not&lt;/em&gt; tagged with
work) – all we need is to add the following 3 extra rules in the policy file
for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 user ~]$ cat /etc/qubes-rpc/polisy/qubes.FileCopy
(...)
$tag:work   $tag:work   allow
$tag:work   $anyvm      deny
$anyvm      $tag:work   deny

$anyvm      $anyvm      ask
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can do the same for clipboard, just need to place the same 3 rules in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.ClipboardPaste&lt;/code&gt; policy file.&lt;/p&gt;

&lt;p&gt;Also, as already discussed in the previous post on &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;Admin API&lt;/a&gt;,
the Core Stack automatically tags VMs with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;created-by-XYZ&lt;/code&gt; tag, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XYZ&lt;/code&gt; is
replaced by the name of the VM which invoked the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.Create*&lt;/code&gt; service.
This allows to automatically constrain power of specific management VMs to only
manage its “own” VMs, and not others. Please refer to the article linked above
for the examples.&lt;/p&gt;

&lt;p&gt;Furthermore, Disposable VMs can also be referred to via tags in the policy, for
example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Allow personal VMs to start DispVMs created by the user via guidom:
$tag:created-by-guidom $dispvm:$tag:created-by-guidom allow

# Allow corpo-managed VMs to start DispVMs based on corpo-owned AppVMs:
$tag:created-by-mgmt-corpo $dispvm:$tag:created-by-mgmt-corpo allow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course, we can also explicitly specify Disposable VMs using the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$dispvm:&amp;lt;name_of_appvm_to_use_as_template&amp;gt;&lt;/code&gt; syntax, e.g. to allow AppVMs tagged
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; to request qrexec service from a Disposable VM created off
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work-printing&lt;/code&gt; AppVM (as noted earlier, the “work-printing” would need to have
it’s property &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template_for_dispvms&lt;/code&gt; set for this to work):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$anyvm    $dispvm:work-printing allow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In Qubes 4.0 we have also implemented more strict control over the destination
argument for qrexec calls. Until Qubes 4.0, the source VM (i.e., the VM that
calls a service) was responsible for providing a valid destination VM name to
which it wanted to direct the service call (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; or
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.OpenInVM&lt;/code&gt;). Of course, the policy always had the last say in this
process, and if the policy had a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deny&lt;/code&gt; rule for the specific case, the service
call was dropped.&lt;/p&gt;

&lt;p&gt;What has changed in Qubes 4.0 is that whenever the policy says &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ask&lt;/code&gt; (in
contrast to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allow&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deny&lt;/code&gt;), then the VM-provided destination is essentially
ignored, and instead a trusted prompt is displayed in dom0 to ask the user to
select the destination (with a convenient drop down list).&lt;/p&gt;

&lt;p&gt;(One could argue that the VM-provided destination argument in qrexec policy call
is not entirely ignored, as it might be used to select a specific qrexec policy
line, in case there were a few matching, such as:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$anyvm work allow
$anyvm work-web ask,default_target=work-web
$anyvm work-email ask

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In that case, however, the VM-provided call would still be overridden by the
user choice in case the rule #2 was selected.)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/core3-qrexec-prompt.png&quot; alt=&quot;The redesigned qrexec policy confirmation windows&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A prime example of where this is used is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; service. However, we
should note that for most other services, in a well configured system, there
should be very few &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ask&lt;/code&gt; rules. Instead most policies should be either &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;allow&lt;/code&gt;
or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deny&lt;/code&gt;, thereby relieving the user from having to make a security decision with every
service invocation. Even the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; service should be additionally guarded by
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deny&lt;/code&gt; rules (e.g. forbidding any file transfers between personal and
work-related VMs), and we believe our integrated Salt Management Stack should be
helpful in creating such policies in larger deployments of Qubes within
corporations.&lt;/p&gt;

&lt;p&gt;Here comes in handy another powerful feature of qrexec policy: the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;target=&lt;/code&gt;
specifier, which can be added after the action keyword. This forces the call to
be directed to the specific destination VM, no matter what the source VM
specified. A good place to make use of this is in policies for starting various
Disposable VMs.  For example, we might have a special rule for Disposable VMs
which can be invoked only from VMs tagged with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; (e.g. for the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.OpenInVM&lt;/code&gt; service):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$tag:work $dispvm allow,target=$dispvm:work-printing
$anyvm    $dispvm:work-printing deny 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first line means that every DispVM created by a VM tagged with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt; will
be based on (i.e., use as its template) the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work-printing&lt;/code&gt; VM. (Recall that, in
order for this to succeed, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work-printing&lt;/code&gt; VM also has to have its
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template_for_dispvms&lt;/code&gt; property set to true.) The second line means that any
&lt;em&gt;other&lt;/em&gt; VM (i.e., any VM not tagged with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt;) will be denied from creating
DispVMs based on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work-printing&lt;/code&gt; VM.&lt;/p&gt;

&lt;h2 id=&quot;qubesxml-qubesd-and-the-admin-api&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubesd&lt;/code&gt;, and the Admin API&lt;/h2&gt;

&lt;p&gt;Since the beginning, Qubes Core Stack kept all the information about the Qubes
system’s (persistent) configuration within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/qubes/qubes.xml&lt;/code&gt; file.
This has included information such as what VMs are defined, on which templates
they are based, how they are network-connected, etc. This file has never been
intended to be edited by the user by hand (except for rare system
troubleshooting). Instead, Qubes has provided lots of tools, such as
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-create&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-prefs&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes-prefs&lt;/code&gt;, and many more, which operate or
make use of the information from this file.&lt;/p&gt;

&lt;p&gt;In Qubes 4.x we’ve introduced the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubesd&lt;/code&gt; daemon (service) which is now the
only entity which has direct access to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt; file, and which exposes a
well-defined API to other tools. This API is used by a few internal tools
running in dom0, such as some power management scripts, qrexec policy checker,
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubesd-query(-fast)&lt;/code&gt; wrapper, which in turn is used to expose most parts of
this API to other VMs via the qrexec infrastructure. This is what we call Admin
API, and which we I described in the &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;previous post&lt;/a&gt;. While the
mapping between Admin API and the internal qubesd API is nearly “one-to-one”,
the primary difference is that Admin API is subject to policy mechanism via
qrexec, while the qubesd-exposed API is not policed, because it is only exposed
locally within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;. This architecture is depicted below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/qubesd-arch.png&quot; alt=&quot;qubesd architecture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As discussed in the &lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;post about Admin API&lt;/a&gt;, we have put lots of
thought into designing the API in such a way as to allow effective split between
the user and admin roles. Security-wise this means that admins should be able to
manage configurations and policies in the system, but not be able to access the
user data (i.e. AppVMs’ private images). Likewise it should be possible to
prevent users from changing the policies of the system, while allowing them to
use their data (but perhaps not export/leak them easily outside the system).&lt;/p&gt;

&lt;p&gt;For completeness I’d like to mention that both qrexec and firewalling policies
are &lt;em&gt;not&lt;/em&gt; included in the central &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt; file, but rather in separate
locations, i.e. in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/policy/&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/lib/qubes/&amp;lt;vmname&amp;gt;/firewall.xml&lt;/code&gt; respectively. This allows for easy
updating of the policy files, e.g. from within trusted RPMs that are installed
in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt; and which might be brining new qrexec services, or from whatever tool
used to create/manage firewalling policies.&lt;/p&gt;

&lt;p&gt;Finally, a note that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubesd&lt;/code&gt; (as in “qubes-daemon”) should not be confused with
[qubes-db][https://github.com/QubesOS/qubes-core-qubesdb] (as in
“qubes-database”). The latter is a Qubes-provided, security-optimized abstraction
for exposing static informations from one VMs to others (mostly from AdminVM),
and which is used e.g. for the agents in the VMs to get to know the VM’s name,
type and other configuration options.&lt;/p&gt;

&lt;h2 id=&quot;the-new-attack-surface&quot;&gt;The new attack surface?&lt;/h2&gt;

&lt;p&gt;With all these changes to the Qubes Core Stack, an important question comes to
mind: how do all these changes affect the security of the system?&lt;/p&gt;

&lt;p&gt;In an attempt to provide somewhat meaningful answer to that question, we should
first observe that there exists a number of obvious configurations (including
the default one) of the system, in which there should be no security regression
compared to previous Qubes versions.&lt;/p&gt;

&lt;p&gt;Indeed, by not allowing any other VM to access the Admin API (which is what the
default qrexec policy for Admin API does), we essentially reduce the attack
surface onto the Core Stack to what is has been in the previous versions (modulo
potentially more complex policy parser, as discussed below).&lt;/p&gt;

&lt;p&gt;Let us now imagine exposing some subset of the Admin API to select, trusted
management VMs, such as the upcoming GUI domain (in Qubes 4.1). As long as we
consider these select VMs as “trusted”, again the situation does not seem to be
any worse that what it was before (we can simply think of dom0 as having
comprised these additional VMs in previous versions of Qubes. Certainly there is
no security benefit here, but likewise there is no added risk).&lt;/p&gt;

&lt;p&gt;Now let’s move a step further and relax our trustworthiness requirement for this,
say, GUI domain. We will now consider it only “somewhat trustworthy”. The whole
promise of the new Admin API is that, with a reasonably policed Admin API (see
also the previous post), even if this domain gets compromised, this will not
result in full system compromise, and ideally only in some kind of a DoS where
none of the user data will get compromised. Of course, in such a situation there
is additional attack surface that should be taken into account, such as the
qubesd-exposed interface. In case of a hypothetical bug in the implementation of
the qubesd-exposed interface (which is heavily sanitized and also written in
Python, but still) the attacker who compromised our “somewhat trustworthy” GUI
domain might compromise the whole system. But then again, let’s remember that
without the Admin API we would not have a “somewhat trustworthy” GUI domain in the
first place, and if we assume it was possible for the attacker to compromise
this VM, then she would also be able to compromise &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt; in earlier Qubes
versions. That would be fatal without any additional preconditions (e.g. for a
bug in qubesd).&lt;/p&gt;

&lt;p&gt;Finally, we have the case of a “largely untrusted” management VM. The typical
scenario could be a management VM “owned” by an organization/corporation. As
explained in the previous post, the Admin API should allow us to grant such a VM
authority over only a subset of VMs, specifically only those which it created,
and not any other (through the convenient &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;created-by-XYZ&lt;/code&gt; tags in the policy).
Now, if we consider this VM to become compromised, e.g. as a result of the
organization’s proprietary management agents getting compromised somehow, then
it becomes a very urging question to answer how buggy the qubesd-exposed
interface might be. Again, on most (all?) other client system, such a situation
would be fatal immediately (i.e. no additional attacks would be required after
the attacker compromised the agent), while on Qubes this would only be the
prelude for trying another attacks to get to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One other aspect which might not be immediately clear is the trade-off between a
more flexible architecture, which e.g. allows to create mutually untrusted
management VMs on the one hand, and the increased complexity of e.g. the policy
checker, which is required to now also understand new keywords such as the
previously introduced &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$dispvm:xyz&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$tag:xyz&lt;/code&gt;. In general we believe that if
we can introduce a significant new security improvement on architecture level,
which allows to further decompose the TCB of the system, than it is worth it.
This is because architecture-level security should always go first, before
implementation-level security. Indeed, the latter can always be patched, and in
many cases won’t be critical (because e.g. smart architecture will keep it
outside of the TCB), while the architecture very often cannot be so easily
“fixed”. In fact this is the prime reason why we have Qubes OS, i.e. because
fixing of the monolithic architecture of the mainstream OSes has seemed hopeless
to us.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;The new Qubes Core Stack provides a very flexible framework for managing a
compartmentalized desktop (client) oriented system. Compared to previous Qubes
Core Stacks, it offers much more flexibility, which translates to ability to
further decompose the system into more (largely) mutually untrusting parts.&lt;/p&gt;

&lt;p&gt;Some readers might wonder how does the Qubes Core Stack actually compare to
various popular cloud/server/virtualization management APIs, such as
OpenStack/EC2 or even Docker?&lt;/p&gt;

&lt;p&gt;While at first sight there might be quite a few similarities related to
management of VMs or containers, the primary differentiating factor is that
Qubes Core Stack has been designed and optimized to bring user one &lt;em&gt;desktop&lt;/em&gt;
system built on top of multiple isolated domains (currently implemented as Xen
Virtual Machines, but in the future maybe on top of something else), rather than
for management of service-oriented infrastructure, where the services are
largely independent from each other and where the prime consideration is
scalability.&lt;/p&gt;

&lt;p&gt;The Qubes Core Stack is Xen- and virtualization-independent, and should be
easily portable to any compartmentalization technology.&lt;/p&gt;

&lt;p&gt;In the upcoming article we will take a look at the updated device and new volume
management in Qubes 4.0.&lt;/p&gt;

</description>
        <pubDate>Tue, 03 Oct 2017 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2017/10/03/core3.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2017/10/03/core3.html</guid>
        
        
      </item>
    
      <item>
        <title>Qubes OS 4.0-rc1 has been released!</title>
        <description>&lt;p&gt;Finally, after years of work, we’re releasing the first release candidate for
Qubes 4.0!&lt;/p&gt;

&lt;h2 id=&quot;next-generation-qubes-core-stack-for-better-integration&quot;&gt;Next Generation Qubes Core Stack for better integration&lt;/h2&gt;

&lt;p&gt;No doubt this release marks a major milestone in Qubes OS development. The
single most import undertaking which sets this release apart, is the &lt;strong&gt;complete
rewrite of the Qubes Core Stack&lt;/strong&gt;. We have a separate set of posts detailing the
changes (Why/What/How), and the first post is planned to be released in the
coming 2 weeks.&lt;/p&gt;

&lt;p&gt;This new Core Stack allows to easily extend the Qubes Architecture in new
directions, allowing us to finally build (in a clean way) lots of things we’ve
wanted for years, but which would have been too complex to build on the “old”
Qubes infrastructure. The new &lt;strong&gt;Qubes Admin API&lt;/strong&gt;, which we introduced in a
&lt;a href=&quot;https://www.qubes-os.org/news/2017/06/27/qubes-admin-api/&quot;&gt;recent post&lt;/a&gt;, is a prime example of one such feature.
(Technically speaking, we’ve neatly put the Admin API at the heart of the new
Qubes Core Stack so that it really is part of the Core Stack, not merely an
“application” built on top of it.)&lt;/p&gt;

&lt;p&gt;There are many more benefits that the new Core Stack brings besides the Admin
API. Just to name a few that might be most visible to the user or admin:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Simpler to customize and more flexible Disposable VMs,&lt;/li&gt;
  &lt;li&gt;More flexible and expressive (qrexec) policy definitions,&lt;/li&gt;
  &lt;li&gt;Flexible VM volume manager (easy to keep VMs on external drives, or in
memory-only),&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;… and many more! The new Core Stack also brings lots of simplifications for
developers of Qubes-specific apps and services. Again, we plan to publish posts
about all these cool new features in the coming weeks and months.&lt;/p&gt;

&lt;p&gt;One last important comment is that all the work we have done in this area has
been Xen-agnostic, aligned with our &lt;a href=&quot;https://blog.invisiblethings.org/2013/03/21/introducing-qubes-odyssey-framework.html&quot;&gt;long-stated goal&lt;/a&gt; to make
Qubes easily portable between different VMMs (hypervisors) and even non-VM-based
systems, such as container-based ones.&lt;/p&gt;

&lt;h2 id=&quot;fully-virtualized-vms-for-better-isolation&quot;&gt;Fully virtualized VMs for better isolation&lt;/h2&gt;

&lt;p&gt;Another important change in this release (this time Xen-specific) is that we
have &lt;strong&gt;ditched para-virtualized mode and embraced fully-virtualized mode for
Qubes VMs&lt;/strong&gt;. The reason for this move has been entirely security-related, as
explained &lt;a href=&quot;https://github.com/QubesOS/qubes-secpack/blob/master/QSBs/qsb-024-2016.txt#L92-L132&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://www.qubes-os.org/news/2016/07/21/new-hw-certification-for-q4/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Originally, we planned to utilize the PVH mode of virtualization, which combines
the benefits of processor virtualization technologies (VT-x and EPT), allowing
for simpler code in the hypervisor, thus improving security, with
paravirtualized drivers for better performance and improved security due to
simplified interfaces to virtualized devices. Even though we have &lt;a href=&quot;https://blog.invisiblethings.org/2012/03/03/windows-support-coming-to-qubes.html&quot;&gt;long been
using&lt;/a&gt; isolated &lt;em&gt;stub domains&lt;/em&gt; to keep device I/O
emulators outside of the TCB, these stub domains themselves run in PV mode,
which we are now moving away from.&lt;/p&gt;

&lt;p&gt;Sadly, due to the Linux kernel still not fully supporting this PVH mode
(specifically problems with &lt;a href=&quot;http://markmail.org/message/ddds3tb4b23gmtgo&quot;&gt;booting the kernels in this mode&lt;/a&gt;),
we decided to go with the HVM-based VMs for this rc1 release. We plan to switch
to full PVH either in the later rc-releases, or in 4.1, depending on the
progress of PVH support in the Linux kernel.&lt;/p&gt;

&lt;p&gt;Also, as an additional last-minute issue, we discovered that PCI pass-through
does not work that well on some systems when using HVM virtualization. Typically
this affects USB VMs and only on some systems. Nevertheless, as a precaution, in
the default installation we decided to switch the mode of virtualization for
these VMs back to PV mode. (The new Core Stack allows one to do this with the
flip of a &lt;del&gt;switch&lt;/del&gt;property :). Here our rationale is that it’s still much
better to have PV-based isolation for USB VMs rather than not having USB
controllers isolated at all! Again, we anticipate this will be resolved in the
upcoming rc-releases.&lt;/p&gt;

&lt;h2 id=&quot;new-approach-to-uxui-for-better-integration&quot;&gt;New approach to UX/UI for better integration&lt;/h2&gt;

&lt;p&gt;In Qubes 4.0 we also &lt;a href=&quot;https://github.com/QubesOS/qubes-issues/issues/2132&quot;&gt;decided&lt;/a&gt; to &lt;strong&gt;redesign the User
Experience (UX)&lt;/strong&gt; a little bit.  Aligned with our long-term vision to hide as
much of the Qubes internals from the casual user as practically viable, we made
a bold move and… &lt;strong&gt;removed the Qubes Manager altogether!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead, we believe it makes more sense to utilize as much of the infrastructure
already built by professional UX designers as possible. Consequently, most of
the Qubes persistent configuration (creation of new VMs, changing their settings
as well as the global ones) is accessible through the standard application menu
aka “Start Menu”. In addition, we wrote two tiny widgets, which should work with
most desktop environments compatible with Qubes (currently this list includes
the default Xfce4, the once-default KDE, the community-maintained i3, and
awesome). These widgets are used to show live info about the &lt;em&gt;running&lt;/em&gt; system
state, such as which VMs are currently running, their memory usage, as well as
which devices are available to connect to different VMs (and yes, now it is
possible to connect USB devices using the GUI, a long requested feature by many
of our users).&lt;/p&gt;

&lt;p&gt;Advanced Qubes users will surely appreciate, on the other hand, the much more
flexible and powerful &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-*&lt;/code&gt; tools, such as the completely rewritten &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt;
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-prefs&lt;/code&gt;, to name just two (again, more on them in the upcoming posts).&lt;/p&gt;

&lt;h2 id=&quot;better-compatibility-and-all-the-rest&quot;&gt;Better compatibility and all the rest&lt;/h2&gt;

&lt;p&gt;Besides the above, there have been lots of other improvements and bug fixes
compared to the 3.2 release. We list most of them in the &lt;a href=&quot;https://www.qubes-os.org/doc/releases/4.0/release-notes/&quot;&gt;release
notes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Perhaps one worth singling out here, in the context of hardware compatibility,
is the upgrade of the default dom0 distribution to Fedora 25. (Before we
decompose dom0 into separate GUI and Admin VMs, which we plan to do in 4.1, the
dom0 distribution determines how well the GPU is supported.)&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Qubes 4.0 is a significant milestone on our roadmap to implement a reasonably
secure desktop/client OS based on the “Security by Compartmentalization”
principle (using “Explicit Partitioning Model”, in contrast to the recently
popular “Sandboxing Model”).&lt;/p&gt;

&lt;p&gt;This is the first release candidate of a largely rewritten complex system, and
no doubt early adopters will discover some rough edges here and there. Despite
our increasingly sophisticated automatic testing infrastructure, this is simply
unavoidable. Consequently, if you want to use Qubes for production, stick to
Qubes 3.2 &lt;a href=&quot;https://www.qubes-os.org/doc/version-scheme/#release-schedule&quot;&gt;until we release&lt;/a&gt; the stable version of Qubes 4.0.&lt;/p&gt;

&lt;p&gt;But if you would like to start learning and experimenting with the advanced new
features that 4.0 brings, such as the Admin API, or would like to help us reach
a stable 4.0 more quickly, or you’re just curious, or want to show off to your
friends what a bleeding edge system you have, then please do so and go straight
to the [download page]!&lt;/p&gt;

&lt;p&gt;On behalf of the whole &lt;a href=&quot;https://www.qubes-os.org/team/&quot;&gt;Qubes OS Core Team&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;joanna.&lt;/p&gt;

</description>
        <pubDate>Mon, 31 Jul 2017 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2017/07/31/qubes-40-rc1.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2017/07/31/qubes-40-rc1.html</guid>
        
        
      </item>
    
      <item>
        <title>Introducing the Qubes Admin API</title>
        <description>&lt;p&gt;This post starts the “cool things coming in Qubes 4.0” series and focuses on
what we call the “Qubes Admin API.” This should not be confused with Qubes &lt;a href=&quot;https://www.qubes-os.org/doc/salt/&quot;&gt;Salt
Stack integration&lt;/a&gt;, which we have already introduced in Qubes 3.2.&lt;/p&gt;

&lt;h2 id=&quot;high-level-overview&quot;&gt;High-level overview&lt;/h2&gt;

&lt;p&gt;Let’s start with a high-level architecture picture of how the Admin API fits
into the Qubes OS architecture:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachment/wiki/posts/admin-api.png&quot; alt=&quot;Qubes Admin API architecture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see, the main concept behind the Admin API is to let &lt;em&gt;select&lt;/em&gt; VMs
preform various &lt;em&gt;select&lt;/em&gt; administrative functions over the Qubes OS system.&lt;/p&gt;

&lt;p&gt;If this idea scares the hell out of you, then, my dear reader, we’re on the same
side. Indeed, if we’re not careful, we can use the Admin API to shoot ourselves
in the foot.  Moreover, it might look like we’re actually adding complexity and
enlarging the amount of trusted code (TCB) in Qubes OS. All good intuitions. But
below I argue that the opposite actually holds, i.e. that the Admin API allows
us to actually &lt;em&gt;shrink&lt;/em&gt; the amount of trusted code, &lt;em&gt;simplify&lt;/em&gt; trust
relationships in the system, and ultimately to improve the overall security at
the end of the day. It’s a bit like comparing SSH to Telnet. Admittedly, at
first sight, the SSH protocol has much more complexity than Telnet, yet no one
questions today that SSH is actually significantly more secure than the much
simpler Telnet.&lt;/p&gt;

&lt;p&gt;So, let’s first quickly look at examples of why we have introduced the Admin
API, i.e. what problems it helps to solve and how.&lt;/p&gt;

&lt;h2 id=&quot;management-vms&quot;&gt;Management VMs&lt;/h2&gt;

&lt;p&gt;For Qubes OS to become suitable for use in large organizations and/or corporate
environments, it inevitably must become remotely manageable by entities such as
corporate IT departments. There are, of course, many ways to implement this, but
most would punch too many holes in the Qubes security model.  For example, if we
wanted to run some management agent in dom0, this would not only open up
possible ways of attacking the whole system by exploiting potential bugs in the
agent itself, but it would also require us to allow networking in dom0, exposing
it to a number of additional attacks.&lt;/p&gt;

&lt;p&gt;The Admin API solves this problem elegantly without requiring network access to
dom0, and we show exactly how below.&lt;/p&gt;

&lt;p&gt;Additionally, the Admin API nicely complements our existing &lt;a href=&quot;https://www.qubes-os.org/doc/salt/&quot;&gt;Salt Stack
integration&lt;/a&gt;. While the latter is perfect for pre-configuration at install time,
the former is ideal for ongoing system maintenance, monitoring, and on-demand
provisioning of VMs.&lt;/p&gt;

&lt;p&gt;Last but not least, we’ve designed the Admin API with the goal of allowing very
strict “need to know” (and “need to do” for that matter) rules. This means that
it should be possible to have admin roles (implemented as specific VMs) that
would be able to e.g. provision and manage a user’s AppVMs, &lt;strong&gt;but not be able to
read the user’s data!&lt;/strong&gt; Of course, this is more tricky than it might seem when
we look at the diagram above, and I discuss some of the catches and solutions
below. We hope this will pave the way for organizations to embrace the idea of
&lt;strong&gt;non-privileged admins&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-gui-domain&quot;&gt;The GUI domain&lt;/h2&gt;

&lt;p&gt;In the current Qubes architecture we’ve combined two different subsystems: 1)
the (trusted) GUI subsystem and 2) the Admin stack. They’re both in the same VM:
the almighty dom0.&lt;/p&gt;

&lt;p&gt;This has somewhat made sense, since the GUI subsystem, which comprises the
Window Manager, X server and graphics drivers, must be trusted anyway. After
all, the GUI subsystem “sees” all your sensitive data, and it can also mimic any
user actions by injecting keystrokes and/or mouse movements.&lt;/p&gt;

&lt;p&gt;Also, in contrast to traditional desktop systems, the Qubes GUI subsystem is
very well isolated from the external world (user apps, USB devices, networking,
etc.), which means there is very little chance of compromising it from the
outside.&lt;/p&gt;

&lt;p&gt;Yet, there are several good reasons to move the GUI code away from the Admin VM
(i.e. dom0) to a separate, &lt;em&gt;less&lt;/em&gt; trusted and &lt;em&gt;less&lt;/em&gt; privileged VM:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;The possibility of efficiently separating the user and admin roles. This is
somewhat complementary to the admin de-privileging mentioned above and
discussed in more detail at the end of this post.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Protection against hypothetical attacks compromising the GPU via DP/HDMI
ports.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The option to use a much smaller, less bloated, more difficult to
backdoor-by-the-vendor (ideally reproducibly buildable) distro for dom0.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;More freedom in choosing the software stack for the GUI: the actual OS (e.g.
Windows instead of Linux?); more recent, less trusted GPU drivers (e.g.
proprietary instead of from the Linux tree); more choices with regard to
desktop environments and window managers; and an easier upgrade cycle for
this whole stack.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Reliable logging, which can be separated and protected from both user and
admin interference.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The possibility of implementing a bunch of cool features, which otherwise
(i.e. if the GUI were in dom0) would be too risky to even consider, such as:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;p&gt;Exposing the GUI domain through VNC or RDP to other computers, allowing for
screen sharing or a Qubes network appliance.&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;GPU/OpenGL virtualization for AppVMs.&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Perhaps even Qubes-as-a-Service running in the cloud?&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I should note that, as of Qubes 4.0, we still don’t have a separate GUI domain,
but we plan to implement this in the upcoming 4.1 release (and some work has
already been done here, in fact). The Admin API will be instrumental in this
undertaking.&lt;/p&gt;

&lt;h2 id=&quot;safe-third-party-templates&quot;&gt;Safe third-party templates&lt;/h2&gt;

&lt;p&gt;One of the “bottlenecks” we’ve been experiencing recently with Qubes is that
there is a growing number of people interested in creating and maintaining
various, more-or-less exotic TemplateVMs for Qubes. But there is a problem with
allowing (untrusted) third parties to maintain Qubes templates: the templates
need to be installed in dom0.&lt;/p&gt;

&lt;p&gt;The primary “carriers” for bringing things into dom0 are digitally-signed RPMs.
Of course, the digital signatures are always checked by code in dom0 before the
RPMs are processed. While this is an important checkpoint, let there be no
misunderstanding: this cannot do anything to stop malicious RPMs if the author
has signed, either intentionally or accidentally, a malicious RPM. And RPMs can
be malicious very easily, as they contain lots of wrapping scripts, such as pre-
and post-install scripts. We have thus been always very careful with enabling
third-party repository definitions in dom0.&lt;/p&gt;

&lt;p&gt;The Admin API comes to the rescue. You can now process the template’s RPM (check
signature, unpack, execute scripts) within a normal, possibly untrusted VM (even
a Disposable VM), and then use the Admin API to request installation of the
template &lt;em&gt;files&lt;/em&gt; (not the RPM!) in dom0. The difference is huge, because now
we’re just asking the Qubes Core Stack to use the content of an opaque file,
i.e.  the VM image, to fill a newly-created LVM volume (which is done by
executing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt; in dom0, so without parsing the untrusted volume content),
instead of performing a very complex package installation operation (i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rpm
-i some-community-template.rpm&lt;/code&gt;). (In Qubes 4.0, we switched to using LVM
storage by default for all VM images; more details in an upcoming post.)&lt;/p&gt;

&lt;p&gt;Needles to say, not every VM would be able to request template installation in
dom0.  For this to work, the &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/&quot;&gt;qrexec&lt;/a&gt; policy would need to allow the set of
Admin API calls needed for this (see below for practical examples).&lt;/p&gt;

&lt;p&gt;Also, let’s be clear: if the third-party template maintainer turns out to be
malicious (or the computer on which she builds the template turns out to be
compromised), then the user will end up with a compromised template, and each
and every AppVM based on or created from this template will be compromised also.
But the whole point is that &lt;em&gt;other&lt;/em&gt; AppVMs, those based on &lt;em&gt;other&lt;/em&gt; templates
(e.g. the built-in ones) won’t be compromised. Furthermore, the user might, in
some cases, prevent the compromised AppVMs from doing any significant damage,
e.g. by using the Qubes firewall to limit their ability to leak out data, or
even by running the AppVMs completely disconnected from all networking.&lt;/p&gt;

&lt;h2 id=&quot;sandboxed-paranoid-backup-restores&quot;&gt;Sandboxed Paranoid Backup Restores&lt;/h2&gt;

&lt;p&gt;Very similar to creating a new template is a backup restore operation. And just
as we want to allow less-trusted third-parties to provide templates, in the case
of backups we want to be able to restore backups made on a potentially
compromised machine (e.g. an older version of Qubes OS that contained a &lt;a href=&quot;https://www.qubes-os.org/security/xsa/&quot;&gt;Xen bug
vulnerability&lt;/a&gt; or perhaps a backdoored BIOS) without compromising
the rest of our new system. This concept, known as &lt;strong&gt;Paranoid Backup Restore
mode&lt;/strong&gt; has been described in more detail in a &lt;a href=&quot;https://www.qubes-os.org/news/2017/04/26/qubes-compromise-recovery/&quot;&gt;separate post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As described in that post, one of the problems with the present implementation
of the Paranoid Backup Restore Mode is the need to parse the complex backup
format.  And this very action can now be done from within a Disposable VM using
the Admin API.&lt;/p&gt;

&lt;h2 id=&quot;policing-the-admin-api-and-catches&quot;&gt;Policing the Admin API (and catches!)&lt;/h2&gt;

&lt;p&gt;Because the Admin API has been implemented on top of &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/&quot;&gt;qrexec&lt;/a&gt;, it can be policed
using the standard &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/#qubes-rpc-administration&quot;&gt;qrexec policy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This might sound easy, but, as usual, the devil’s in the details. Take a look
again at the high-level diagram above. We see that, not surprisingly, all the
Admin API-related qrexec services have the same destination: dom0. While this
allows us to make somewhat meaningful policies (e.g. mgmtvm1 can invoke
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.List&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.property.List&lt;/code&gt;, but not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.Create&lt;/code&gt;), this is
far from what one might like to have. Indeed, we would like to say that a given
VM can invoke certain Admin API calls &lt;em&gt;only for specific AppVMs&lt;/em&gt; and cannot
touch other sets of AppVMs.&lt;/p&gt;

&lt;p&gt;To make this finer-grained policing possible, we need a simple trick: the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destination&lt;/code&gt; argument for all Admin API calls should be interpreted on a
slightly higher level than the qrexec protocol level. Our qrexec policy allows
us to easily achieve this approach, thanks to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;target=&lt;/code&gt; keyword used in the
policy for all of the Admin API calls, as shown below.  This also explains why
the &lt;a href=&quot;https://www.qubes-os.org/doc/admin-api/&quot;&gt;Admin API table&lt;/a&gt; has a column titled “dest”.&lt;/p&gt;

&lt;p&gt;We can thus easily express policies for the Admin API with much more granularity
and flexibility. For example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat /etc/qubes-rpc/policy/admin.vm.Create
mgmt-corpo  $adminvm    allow

$ cat /etc/qubes-rpc/policy/admin.vm.property.Set+netvm
mgmt-corpo  $tag:created-by-mgmt-corpo allow,target=$adminvm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first rule above allows the VM named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mgmt-corpo&lt;/code&gt; to create new VMs in the
system. Each such VM will automatically get &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/#extra-keywords-available-in-qubes-40-and-later&quot;&gt;tagged&lt;/a&gt; with the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;created-by-mgmt-corpo&lt;/code&gt; tag. We can further refer to this tag in the policy, as
shown in the second rule above, to allow said management VM to &lt;strong&gt;operate only on
the VMs that it created&lt;/strong&gt;. This rule allows the management VM to change the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;netvm&lt;/code&gt; property on any of the VMs that it has created.  Note that we have
introduced a new keyword: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$adminvm&lt;/code&gt;, which is the new preferred way to refer to
dom0 in both policies and qrexec calls.&lt;/p&gt;

&lt;p&gt;In Qubes, VMs are identified by their names, which the Qubes Core Stack ensures
are unique within the system. (This is similar to how paths and filenames
uniquely identify files on any filesystem). The use of names, instead of GUIDs,
makes it easier for humans to write and audit policies.  This means that if the
user decides to rename the management VM, the above example rules will need to
be adjusted. Luckily, there is no Admin API call to request the renaming of the
VM. (We specifically block setting of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; property via the Admin API).&lt;/p&gt;

&lt;p&gt;Indeed, in Qubes 4.0 we have decided to make the VM’s name an immutable property
of the VM object. Once the user creates a VM, the name is set in stone.&lt;/p&gt;

&lt;p&gt;About the only way to effectively change the name of a VM, starting from Qubes
4.0, is to perform the clone operation. It’s important to note that the clone
operation in Qubes 4.0 differs from Qubes 3.x and earlier. In 4.0, it might be
more accurate to say that we’re cloning the VM’s &lt;em&gt;volume&lt;/em&gt;, rather than cloning
the entire VM. This is because the new clone operation can only be performed
between two already existing VMs, and the operation requires two steps realized
by two separate calls: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.volume.CloneFrom&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.volume.CloneTo&lt;/code&gt;. The first call is typically called by the VM that
manages the source VM, i.e. the one whose volume we want to clone, and the
second call is expected to be called by whatever VM manages the destination VM
(of course these might be the same management VM, e.g. the GUI domain in a
single-user, unmanaged system).&lt;/p&gt;

&lt;p&gt;This ensures that one management VM (perhaps one running some corporate
management agent) cannot impersonate one of the VMs managed by another
management VM (perhaps the user-operated GUI domain).&lt;/p&gt;

&lt;h2 id=&quot;simple-monitoring-vm-demo&quot;&gt;Simple monitoring VM demo&lt;/h2&gt;

&lt;p&gt;Alright, enough theory and hand-waving. Let’s now get our hands dirty with some
command-line, shall we?&lt;/p&gt;

&lt;p&gt;All the examples below have been run on a pre-rc1 release of Qubes 4.0, but they
should work just the same on the “final” 4.0-rc1, which is expected to be
released “very soon” (TM) after the publication of this post.&lt;/p&gt;

&lt;p&gt;First, let’s start with something very simple:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-create --label yellow test-mon
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/policy/admin.vm.List&lt;/code&gt; and add the following two rules:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;test-mon $adminvm allow,target=$adminvm
test-mon $anyvm allow,target=$adminvm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first rule is required to get a list of all the VMs in the system, while the
second is required to query about the state of each of those VMs. Note that the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$anyvm&lt;/code&gt; keyword does &lt;em&gt;not&lt;/em&gt; include dom0 (aka the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$adminvm&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If we also want to allow the monitoring VM to query various properties of the
VMs in the system, we should also add the second rule to the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.property.Get&lt;/code&gt; file (or else &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt; run in our VM won’t display any
more info besides the name, type, and power state of the other VMs in the
system).&lt;/p&gt;

&lt;p&gt;Likewise we should also allow the VM to query the list of labels defined in the
system, by inserting the first rule above (i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test-mon $adminvm
allow,target=$adminvm&lt;/code&gt;) in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.label.List&lt;/code&gt; policy.&lt;/p&gt;

&lt;p&gt;Now, let’s start our new monitoring VM, switch to its console, and run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-run -a test-mon gnome-terminal
[user@test-mon ~]$ qvm-ls

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Above we 1) created a new VM named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test-mon&lt;/code&gt;, 2) added a qrexec policy to allow
this VM to issue the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.List&lt;/code&gt; Admin API call, 3) started the VM, and
finally 4) ran &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt; inside it. It should show the same output as when you
run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-ls&lt;/code&gt; in your dom0 console!&lt;/p&gt;

&lt;p&gt;One cool thing you can use this for is to provide IP address resolution for
Qubes AppVMs in some ProxyVM, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-firewall&lt;/code&gt;. Then, when running a
network monitoring tool, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tcpdump&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wireshark&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;iftop&lt;/code&gt;, you would
get nicely resolved IP addresses into Qubes VM names. :)&lt;/p&gt;

&lt;p&gt;Take a look at the Admin API calls &lt;a href=&quot;https://www.qubes-os.org/doc/admin-api/&quot;&gt;table&lt;/a&gt; to see what other calls
your monitoring VM might want to use. We might add more in the future, e.g. to
allow measuring (i.e. hashing) of various things, such as the policy used,
template root images, etc.&lt;/p&gt;

&lt;h2 id=&quot;simple-management-vm-demo&quot;&gt;Simple management VM demo&lt;/h2&gt;

&lt;p&gt;Now, let’s move on to something more serious. We shall now create a real
management VM:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-create --label green test-mgmt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We will first create a rule to allow our VM to create new VMs in the system by
adding the following rule to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.Create.AppVM&lt;/code&gt; policy:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;test-mgmt $adminvm allow,target=$adminvm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can actually be even more picky and add this rule to the file:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.Create.AppVM+fedora-25&lt;/code&gt;, which would allow the creation of templates
based only on the (already installed) template named “fedora-25”. Similarly, we
could allow only select VM properties to be read or modified. You can read more
about qrexec policy arguments and policing them &lt;a href=&quot;https://www.qubes-os.org/doc/qrexec3/#qubes-rpc-administration&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, we will add the following rule to
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/policy/include/admin-local-rwx&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;test-mgmt $tag:created-by-test-mgmt allow,target=$adminvm

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This rule is where the Admin API really shines. As previously discussed, it
allows our VM to manage only those VMs that it previously created, and not any
other VM in the system!&lt;/p&gt;

&lt;p&gt;Notice the file in which this rule was placed: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;include/admin-local-rwx&lt;/code&gt;.  This
is a special &lt;em&gt;include&lt;/em&gt; file. Before we explain what these new files are and how
they work, let’s briefly discuss how Admin API calls are classified in Qubes
4.0.&lt;/p&gt;

&lt;p&gt;Each Admin API call can be classified as having either global or local scope.
Global scope means that it can somehow affect (or query) the whole system state,
while local scope means that it can only operate on some subset of the VMs (e.g.
those granted via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;created-by-&lt;/code&gt; tag mentioned above). If a call seems like
it fits into both the local and global scope categories, then it is classified
as a global call.&lt;/p&gt;

&lt;p&gt;Additionally, each call can be assigned one or more of these three attributes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;R(eading)&lt;/li&gt;
  &lt;li&gt;W(riting)&lt;/li&gt;
  &lt;li&gt;X(ecuting)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The R-calls do not affect the state of the system. They only return information
about the system (or specific VMs). Both the W- and X-calls affect the state of
the system, but while the W-calls change the persistent state (e.g. create new
VMs, adjust properties of the VMs, or change firewall policies), the X-calls
affect only the volatile state (e.g. start/stop VMs).&lt;/p&gt;

&lt;p&gt;Now back to our special include files. We provide 4 predefined includes (all in
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/policy/include/&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-global-ro&lt;/code&gt; – for all R-calls with global scope&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-global-rwx&lt;/code&gt; – for all RWX-calls with global scope&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-local-ro&lt;/code&gt;  – for all R-calls with local scope&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-local-rwx&lt;/code&gt;  – for all RWX-calls with local scope&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each individual policy file (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/qubes-rpc/admin.vm.List&lt;/code&gt;) includes one
of the above files at the beginning. Thus, by adding a rule to one of these
default include files, we conveniently apply the rules for all the calls
mentioned above (unless the user modifies the specific per-call policies not to
include these default files for some reason). In addition, both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-local-ro&lt;/code&gt;
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-global-ro&lt;/code&gt; also include &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-local-rwx&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-global-rwx&lt;/code&gt;,
respectively.&lt;/p&gt;

&lt;p&gt;Before we test things, we need to allow two more R-calls, which are needed due
to a temporary limitation of the current implementation of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-*&lt;/code&gt; tools,
which always attempt to acquire the list of all the VMs in the system. So, we
need to either grant access to all the &lt;em&gt;global&lt;/em&gt; R-calls (note that we added the
rule above to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-local-rwx&lt;/code&gt;, so this time we would also have to add the rule
to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin-global-ro&lt;/code&gt;), or we need to be more precise by selectively allowing
only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.List&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.label.List&lt;/code&gt; calls to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$adminvm&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;test-mgmt $adminvm allow,target=$adminvm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In upcoming releases (beyond 4.0-rc1) we plan to remove this limitation,
allowing for the possibility of management VMs that cannot get a complete list of all the VMs in the system.&lt;/p&gt;

&lt;p&gt;Now, let’s see how our new management VM works:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@test-mgmt ~]$ qvm-create --label green managed-work
[user@test-mgmt ~]$ qvm-create --label red managed-research
[user@test-mgmt ~]$ qvm-create --label green managed-vpn
[user@test-mgmt ~]$ qvm-prefs managed-work netvm managed-vpn
[user@test-mgmt ~]$ qvm-prefs managed-research netvm sys-whonix
[user@test-mgmt ~]$ qvm-ls
[...]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With the commands above — all executed inside &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test-mgmt&lt;/code&gt; — we did a few
things: 1) we created three AppVMs: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-work&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-research&lt;/code&gt;, and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-vpn&lt;/code&gt;, 2) we set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-vpn&lt;/code&gt; as the network provider (“NetVM” in Qubes
parlance) for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-work&lt;/code&gt;, and we also 3) set the system’s default
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-whonix&lt;/code&gt; as a network provider for the other VM.&lt;/p&gt;

&lt;p&gt;There are some potential problems with this solution, though. First,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-whonix&lt;/code&gt; is not really managed by us, but rather by the user (or perhaps by
some other management VM; we — the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test-mgmt&lt;/code&gt; — can’t even tell due to the
strict policy we used). Second, all the AppVMs we created above are based on the
default template, which is also not managed by us. Finally, we would also like
to be able to pre-configure some VMs for the user, e.g. configure the VPN
client, firewall rules, pre-install some software in the VMs, etc.&lt;/p&gt;

&lt;p&gt;One way to solve all these problems in one step is to have our management VM
bring its own template(s), which will be used to create the AppVMs that it will
subsequently be managing. This is indeed very simple:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@test-mgmt ~]$ wget https://repository.my-big-organization.com/qubes-work-template-1.0.0.rpm
# Check the digital signature perhaps? :)
[user@test-mgmt ~]$ sudo dnf install qubes-work-template-1.0.0.rpm
[user@test-mgmt ~]$ qvm-prefs managed-work template qubes-work-template
[user@test-mgmt ~]$ qvm-prefs managed-research template qubes-work-template
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The template installation step, which is done inside the management VM (rather
than in dom0) works because its post-installation scripts automatically execute
commands such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-template-postprocess&lt;/code&gt; (which, in Qubes 4.0, replaces the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qvm-add-template&lt;/code&gt; command along with a bunch of other tasks). These, in turn,
are piped over Admin API calls to dom0 (provided that the qrexec policy allows
for it, of course). Actually, to support the template installation fully, one
would also need to allow the management VM to request the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.PostInstall&lt;/code&gt;
call to the newly-installed TemplateVM. (Note this call is not part of the Admin
API, because it is implemented by the template itself.) This call wraps many of
the actions that must be performed after the template gets installed, such as
determining whether it runs the Qubes GUI agent and allowing it to properly set
features for the newly-installed template (more about this feature in an
upcoming post).&lt;/p&gt;

&lt;p&gt;The same could be done, of course, for the templates used by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;managed-vpn&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sys-whonix&lt;/code&gt;. (Presumably, these would be different templates from the “work”
template, but they don’t have to be.) These custom templates would likely
already bring most of the pre-configuration needed for the user. However, if
some additional work was needed, e.g. putting in some user credentials for the
VPN, this could be achieved using e.g. the standard &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.VMShell&lt;/code&gt; service.
This service would, however, need to be specifically enabled, as by default
&lt;strong&gt;Admin API calls do not imply that the management VM has the ability to execute
arbitrary commands in the VMs it manages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A better alternative would be to use the upcoming &lt;a href=&quot;https://github.com/QubesOS/qubes-issues/issues/2867&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.InstallPackage&lt;/code&gt;
service&lt;/a&gt;, which we’re planning to introduce shortly
after releasing Qubes 4.0. Note that this will not be an Admin API call, because
it’ll be serviced entirely by the destination VM without any help from the Qubes
Core Stack (other than policy enforcement).&lt;/p&gt;

&lt;p&gt;The attentive reader will be quick to point out that package installation in a
VM is really no different, from a security point of view, from arbitrary code
execution, but I argue below that there are important differences that can be
used to limit the (ab)use of admin power.&lt;/p&gt;

&lt;h2 id=&quot;towards-non-privileged-admins&quot;&gt;Towards non-privileged admins&lt;/h2&gt;

&lt;p&gt;As more and more of our activities move to the world of computers, it’s becoming
increasingly worrying that there is a privileged group of admins who have nearly
unlimited power over the (digital) lives of us mere mortal &lt;em&gt;users&lt;/em&gt;.
Interestingly, it is not only users who do not feel comfortable with omnipotent
admins, but also the organizations who hire the admins, and even some of the
admins themselves. (E.g., some admins may not want the legal liability that
comes along with having that power.) Hence, the reduction of admin privileges
seems like one of the rare cases in which the interests of individual users and
large organizations align.&lt;/p&gt;

&lt;p&gt;Let’s now think about how can we use the Admin API to make Qubes less prone to
admin abuse.  First, let’s observe that none of the Admin API calls grant direct
code execution inside any of the managed VMs or dom0.&lt;/p&gt;

&lt;p&gt;So, how can we configure and provision the managed VMs then, if not with
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.VMShell&lt;/code&gt;? As already mentioned above, there are a few other, better,
options:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Bring a pre-configured template.&lt;/li&gt;
  &lt;li&gt;Provision secrets using a dedicated service. In the most trivial case, just
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.FileCopy&lt;/code&gt; (typically combined with a pre-configured template, which
expects, e.g. VPN credentials, to be copied into:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/QubesIncoming/mgmt/vpn-credentials/&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Request the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.InstallPackage&lt;/code&gt; service mentioned above (which can only
trigger the installation of a package from an &lt;em&gt;already-defined&lt;/em&gt; repository of
the VM).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At the end of the day, of course, admins choose and install software for the
user, so they can always decide to install malicious software. But it should be
clear that there is a difference between the unconstrained ability to simply
read user data or execute arbitrary commands in the user’s VM vs. the need to
deploy specially backdoored software, potentially also bypassing auditing and
signature checking policies. The main goal is to prevent the admin from direct
attacks that can copy (i.e. steal) user data or inject backdoors in an unnoticed
way.&lt;/p&gt;

&lt;p&gt;Additionally, we should point out that, while currently &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin.vm.volume.Import&lt;/code&gt;
does &lt;em&gt;not&lt;/em&gt; enforce any signature checking on the imported VM volumes (e.g. for
newly installed templates), this could be relatively easily implemented via a
dedicated Qubes Core Stack &lt;em&gt;extension&lt;/em&gt; (more about extensions in the upcoming
post).&lt;/p&gt;

&lt;h2 id=&quot;tricky-backup-operations&quot;&gt;Tricky backup operations&lt;/h2&gt;

&lt;p&gt;Speaking of copying VM images (notably, their private volumes), we cannot avoid
mentioning backups. After all, the very essence of a backup operation is to copy
user data and store it somewhere in case things go wrong. This operation is, of
course, in the domain of admins, not users. So we had to figure out how to allow
making backups without revealing user data.&lt;/p&gt;

&lt;p&gt;Part of the solution to this problem is something we have long had on Qubes OS.
Our unique backup system allows us to write backups into &lt;em&gt;untrusted&lt;/em&gt; VMs (and,
e.g., copy them to an untrusted NAS or USB device). This is possible because we
perform the backup crypto operations in dom0, not in the destination VM.&lt;/p&gt;

&lt;p&gt;However, when separating the roles of admins and users, we need a way to provide
the backup &lt;em&gt;passphrase&lt;/em&gt; in such a way that the management VM (which ordered the
backup creation) will not be able to sniff it.&lt;/p&gt;

&lt;p&gt;The way we decided to tackle this problem in the Admin API is through the
introduction of &lt;a href=&quot;https://www.qubes-os.org/doc/admin-api/#backup-profile&quot;&gt;backup profiles&lt;/a&gt;: simple files that must be created in dom0 and
that contain the list of VMs to backup, as well as the command to obtain the
passphrase to encrypt the backup. The command might be, e.g., a trivial
qrexec-call to some VM (over which the admin doesn’t have control!), perhaps
extracting the passphrase from some Hardware Security Module.&lt;/p&gt;

&lt;h2 id=&quot;towards-sealed-off-dom0&quot;&gt;Towards sealed-off dom0&lt;/h2&gt;

&lt;p&gt;Ideally, we would like to de-privilege both the admin and user roles enough that
neither can interfere with the other. This means, e.g., that the admin will not
have access to the user’s data, while the user cannot interfere with the admin’s
policies. Of course, at bottom, there will still be dom0 with its ultimate
control over the system, but perhaps it could be sealed off in such a way that
neither admins nor users can modify system-wide policies, VM images, or dom0
software.&lt;/p&gt;

&lt;p&gt;One approach to this would be to use a digitally-signed filesystem in dom0 (in
additional to an encrypted filesystem, which we’ve been using since the
beginning).  When (or if) combined with a hardware-enforced root of trust, such
as Intel Boot Guard, Intel TXT, or perhaps Intel SGX, this would make it
difficult both for the user and for any attacker who might gain physical access
to the laptop (e.g. an Evil Maid) to get access to VM images (where user data
are kept, or where backdoors might be injected), system configuration (which
includes various policies), and other critical files.&lt;/p&gt;

&lt;p&gt;The keys to dom0 could be generated during installation and kept by some special
admins (superadmins?), split between several of an organization’s admins (and
perhaps also the user), or even discarded after initial provisioning.  Different
deployment scenarios would have different requirements here.&lt;/p&gt;

&lt;p&gt;Skeptics might argue that if one has physical access to the computer, then it’s
always possible to bypass any sort of secure/trusted boot, or
remote-attestation-based scheme. Probably true, but please keep in mind that the
primary goal is to de-privilege admins so that they cannot easily steal users’
data, not to de-privilege users. If the user is willing to spend tens or
hundreds of thousands of dollars on mounting an attack, then this same user will
likely also find other ways to leak the crucial data, perhaps using methods not
involving computers at all. So this is mostly about keeping users away from
admin tasks in order to allow the smooth operation of both user and admin
activities.&lt;/p&gt;

&lt;p&gt;Similarly, admins (and developers!) can always insert backdoors, but we want to
make it as expensive and as auditable as possible.&lt;/p&gt;

&lt;p&gt;All this is planned for beyond even Qubes 4.1, most likely for Qubes 5.0. But
we’ve just built the architectural foundation required to implement this new
kind of security model for endpoint devices (and perhaps not just for
endpoints?).&lt;/p&gt;

&lt;h2 id=&quot;power-to-the-power-users&quot;&gt;Power to the (power) users&lt;/h2&gt;

&lt;p&gt;But what about individual power users?  After all, there is a group of people
who are not only not interested in having their (endpoint) system managed by
someone else, but who actually have an allergic reaction to even the remote
possibility of this being an option in their systems. Likewise, any kind of user
“lock-down” idea is perceived as taking away their basic freedoms.&lt;/p&gt;

&lt;p&gt;The Qubes Project wishes to avoid taking sides in this battle between
locked-down computing vs. user-tinkerable computing. Instead, we would like to
provide tools that allow both scenarios to be realized, recognizing that there
are legitimate scenarios for both approaches.&lt;/p&gt;

&lt;p&gt;First of all, it should be clear that Qubes OS, i.e. the software, cannot lock
anybody down. This is because the only way to lock down a computer is to have
its &lt;em&gt;hardware&lt;/em&gt; implement the locking.&lt;/p&gt;

&lt;p&gt;Admittedly, the system might cooperate with the hardware to sustain the locking,
e.g. by not allowing arbitrary programs to be executed. But with Qubes OS being
open source this is never going to be a problem, because those who don’t agree
with our decisions regarding role compartmentalization will always be able to
build the whole OS from scratch with whatever modifications they desire.&lt;/p&gt;

&lt;p&gt;Second, the separation of admin and user duties should be considered on a
logical level. In scenarios where the same person plays all three roles – user,
administrator, and super-administrator – it is still preferable for Qubes OS to
implement this compartmentalized model of roles. In such scenarios, it just so
happens that a single person possesses the keys/passphrases to all of the roles.&lt;/p&gt;

&lt;p&gt;But then, one might wonder, what prevents employees from using Qubes systems
configured this way (i.e. all power to the user) within organizations, and thus
bypassing any organization-imposed policies? That’s simple: remote attestation
of some sort (Secure/Trusted Boot + TPM, Intel TXT, Intel SGX, maybe even
something else…).&lt;/p&gt;

&lt;p&gt;So it all comes down to this: either the user “roots” her own Qubes system and
has unlimited power (and yet, she might still want to logically separate these
powers within the system), or she plays by the rules of some organization (and,
at minimum, doesn’t have the keys to dom0, while perhaps ensuring that no one
else has them either) and is able to pass the organization’s remote attestation
checks and get access to some (organization-provided) data and services.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;The new Qubes Admin API represents a new approach to endpoint management, which
has been optimized for symmetric user/admin role separation. Not only is the
user prohibited from interfering with admin-enforced policies; the admin is
equally prohibited from stealing or otherwise interfering with the user’s data.
Furthermore, it is possible to implement multiple mutually distrusting or
semi-distrusting management VMs.&lt;/p&gt;

&lt;p&gt;The Qubes Admin API has been enabled by the new generation of the Qubes Core
Stack, which we’re introducing in Qubes 4.0, and which I will describe in
further detail in an upcoming post. Meanwhile, we hope to release Qubes 4.0-rc1
in the coming weeks. :)&lt;/p&gt;

&lt;p&gt;Finally, I’d like to point out that nothing discussed in this post has been
Xen-specific. This is aligned with our long-term vision of making Qubes work
seamlessly on many different platforms: different hypervisors, container
technologies, and possibly even more!&lt;/p&gt;

</description>
        <pubDate>Tue, 27 Jun 2017 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2017/06/27/qubes-admin-api.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2017/06/27/qubes-admin-api.html</guid>
        
        
      </item>
    
      <item>
        <title>Compromise recovery on Qubes OS: individual VMs &amp; full system cases</title>
        <description>&lt;p&gt;Occasionally fuckups happen, even with &lt;a href=&quot;https://www.qubes-os.org/security/bulletins/&quot;&gt;Qubes&lt;/a&gt; (although &lt;a href=&quot;https://www.qubes-os.org/security/xsa/&quot;&gt;not as
often&lt;/a&gt; as some think).&lt;/p&gt;

&lt;p&gt;What should we – users or admins – do in such a situation? Patch, obviously.
But is that really enough? What good is patching your system if it might have
already been compromised a week earlier, before the patch was released, when
an adversary may have learned of the bug and exploited it?&lt;/p&gt;

&lt;p&gt;That’s an inconvenient question for many of us – computer security
professionals – to answer. Usually we would mutter something about Raising the
Bar(TM), the high costs of targeted attacks, attackers not wanting to burn 0-days, or only
nation state actors being able to afford such attacks, and that in case one is on their
list of targets, the game is over anyway and no point in fighting. Plus some
&lt;a href=&quot;https://xkcd.com/538/&quot;&gt;classic cartoon&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While the above line of defense might work (temporarily), it really doesn’t
provide for much comfort, long term, I think. We need better answers and better
solutions. This post, together with a recently introduced feature in Qubes OS
3.2 and (upcoming) 4.0, is an attempt to offer such a solution.&lt;/p&gt;

&lt;p&gt;We start first with a relatively easy problem, namely recovery of a
(potentially) compromised AppVM(s). Then we tackle the significantly more
serious problem which is handling the situation of a (potentially) compromised
system, including subverted dom0, hypervisor, BIOS and all the other software.
We discuss how Qubes OS can help handle all these cases, below.&lt;/p&gt;

&lt;h2 id=&quot;digression-about-detecting-compromises&quot;&gt;Digression about detecting compromises&lt;/h2&gt;

&lt;p&gt;But before we move on, I’d like to say a few words about detecting system
compromises, be that compromises of VMs (which actually are also systems in
themselves) or the whole physical system.&lt;/p&gt;

&lt;p&gt;The inconvenient and somehow embarrassing truth for us – the malware experts –
is that there does not exist any reliable method to determine if a given system
is &lt;em&gt;not&lt;/em&gt; compromised. True, there is a number of conditions that can warn us
that the system is compromised, but there is no limit on the number of checks
that a system must pass in order to be deemed “clean”.&lt;/p&gt;

&lt;p&gt;This means that in many situations it might be reasonable to perform “compromise
recovery” for a system or system(s), even though we might not have any explicit
indication of a compromise. Instead, the only justification might be &lt;a href=&quot;https://xkcd.com/1180/&quot;&gt;some gut
feeling&lt;/a&gt;, some unusual “coincidence” just observed (e.g.
sudden spectacular series of successes of our competitor), or knowledge about a
fatal vulnerability that we just learnt could have been reliably used to attack
our systems. Or maybe you left your laptop in a hotel room and various entrance
indicators suggest &lt;a href=&quot;https://blog.invisiblethings.org/2009/10/15/evil-maid-goes-after-truecrypt.html&quot;&gt;somebody paid you a visit&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;I’m writing this all to actually make two important points:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;As we don’t have reliable indicators when to initiate the recovery procedure,
it’s desirable for the procedure to be as simple and cheap to perform as
possible. Because we might want to do it often, and just in case.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Instead of expecting the recovery procedure to reveal compromises details
(and let us do the attribution, and catch the bad guys), instead we might
want to shift our goals and expect something else: namely that once we
performed it, we will start over from a clean system.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;handling-appvm-compromises&quot;&gt;Handling AppVM compromises&lt;/h2&gt;

&lt;p&gt;Let’s discuss first how can we deal with a (potentially) compromised AppVM (or
some system VM).&lt;/p&gt;

&lt;p&gt;How come a VM might become compromised? Perhaps because of some bug in a Web
browser or email client, opening a maliciously prepared PDF file, installation
of some backdoored software, or gazillion of other potential issues that might
lead to a compromise of an AppVM.&lt;/p&gt;

&lt;p&gt;It’s worth reiterating here that the Qubes OS &lt;a href=&quot;https://www.qubes-os.org/security/goals/&quot;&gt;security model&lt;/a&gt; assumes AppVM
compromises as something that will happen on a regular basis.&lt;/p&gt;

&lt;p&gt;I believe that, even if all the sharpest vulnerability researchers could spend
all their lives auditing all the application software we use, and finally
identify all the relevant bugs, this process would never catch up with the pace
at which &lt;em&gt;new&lt;/em&gt; bugs are being added by application developers into new apps, or
even into newer versions of the apps previously audited.&lt;/p&gt;

&lt;p&gt;Additionally, I don’t believe that advances in so called “safe languages” or
anti-exploitation technology could significantly change this landscape. These
approaches, while admittedly effective in many situations, especially against
memory-corruption-based vulnerabilities, cannot address other broad categories
of software vulnerabilities, such as security bugs in application logic,
nor stop malicious (or compromised) vendors from building backdoors
intentionally into their software.&lt;/p&gt;

&lt;h3 id=&quot;reverting-appvms-root-image-back-to-a-clean-known-state&quot;&gt;Reverting AppVM’s root image back to a clean known state&lt;/h3&gt;

&lt;p&gt;Qubes OS offers a very convenient mechanism to revert root filesystems of any
AppVM back to a known good state. All the user needs to do is to restart the
specific AppVM. This trick works thanks to the Qubes OS &lt;a href=&quot;https://www.qubes-os.org/doc/templates/&quot;&gt;template
mechanism&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s difficult to overestimate convenience and simplicity of this mechanism.
Something strange just happened while browsing the Web? PDF viewer crashed while
opening an attachment? File manager (or the whole VM) crashed while navigating
to some just-downloaded ZIP-unpacked directory? Just reboot the AppVM! If you’re
slow at clicking, need to shutdown and start a heavy application like a Web
browser, and your CPU is of moderate speed, the whole operation will take about
30 seconds.&lt;/p&gt;

&lt;h3 id=&quot;the-pesky-home-directory&quot;&gt;The pesky home directory&lt;/h3&gt;

&lt;p&gt;Reverting the root filesystem of the AppVM to a good known (trusted) state might
be a neat trick, but for more sophisticated attacks, especially attacks
targeting Qubes OS, it might not be enough.&lt;/p&gt;

&lt;p&gt;This is because, besides the root filesystem, each AppVM has also what we call a
&lt;a href=&quot;https://www.qubes-os.org/doc/template-implementation/&quot;&gt;“private” image (volume)&lt;/a&gt;. This is where e.g. the content of the
home directory (i.e. the user data) is stored. And for obvious reasons the home
directory is something that needs to persist between AppVM restarts.&lt;/p&gt;

&lt;p&gt;Unfortunately it’s not quite correct to say that the AppVM’s private image
contains only “user data”. In reality it might contain also scripts and programs,
including such that would be auto-executed upon each new AppVM start. Bash’s
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bash_profile&lt;/code&gt;, or files in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.config/autostart/*.desktop&lt;/code&gt; are
prime examples, but there are many more.  E.g. some configuration files in
various Web browser profiles (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prefs.js&lt;/code&gt;). And there are also
Qubes-specific &lt;a href=&quot;https://www.qubes-os.org/doc/config-files/&quot;&gt;configuration and customization scripts&lt;/a&gt; (found
in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/rw/config/&lt;/code&gt; directory). An attacker can use any of these, and probably
many more, depending on which other applications the user regularly uses, to
persist her code within a specific AppVM. Additionally, an attacker can
potentially use bugs in any of the software that is always, or often, run in
the AppVM, such as a bug in Nautilus (file manager) or some PDF viewer.&lt;/p&gt;

&lt;p&gt;Qubes offers three mechanisms how to deal with this problem:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;It is possible to mount one VM’s private image as a volume to another
AppVM. One can then run whatever malware scanner or investigative software in
that other AppVM. This operation is indeed very easy to do:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[joanna@dom0 ~]$ qvm-block -A --ro admin-ir dom0:/var/lib/qubes/appvms/personal/private.img
[root@admin-ir user]# mount -o ro /dev/xvdi /mnt/personal/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;By using Qubes &lt;a href=&quot;https://www.qubes-os.org/doc/copying-files/&quot;&gt;secure file copy&lt;/a&gt; operation. Specifically the
user might copy the whole home directory to a new AppVM, and then analyze,
verify and start using (the verified) data in a new, non-compromised AppVM:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@personal ~]$ qvm-copy-to-vm admin-ir /home/user/
[user@admin-ir ~]$ ll ~/QubesIncoming/personal/user/
total 36
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Desktop
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Documents
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Downloads
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Music
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Pictures
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Public
drwx------ 5 user user 4096 Mar  9 13:10 QubesIncoming
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Templates
drwxr-xr-x 2 user user 4096 Dec  2 21:22 Videos
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;By having “cleaning” scripts in the root filesystem (so they could execute
before the private image gets mounted/used) which, when activated, would
sanitize, clean and/or remove most (all?) of the scripts that are in the home
directory. Assuming such cleaning script is effective (i.e. does not misses
any place in the home directory which would be used to persist attacker’s
code), the user might just 1) upgrade the vulnerable software in the
template, 2) restart the AppVM. It’s worth stressing that, as the upgrading
of the vulnerable software takes place in a TemplateVM (instead of the
compromised AppVM), the attacker who exploited the vulnerability previously,
has no way of blocking the upgrade.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first method described above, while most familiar to those used to do
forensic analysis on traditional systems, is also the least secure, because it
exposes the target AppVM (i.e. the one to which we mount the private image of
the compromised AppVM) to potential attacks on the volume and filesystem parsing
code.&lt;/p&gt;

&lt;p&gt;The second method (Qubes inter-VM file copy) avoids this problem. But, of
course, some method of sanitization or scanning of the files copied from the
compromised machine will be needed (remember that the compromised AppVM might
have sent &lt;em&gt;whatever&lt;/em&gt; if felt like sending!). Some users might want to run more
traditional, AV-like scanners, while others might want to employ approaches
similar to e.g. one used by &lt;a href=&quot;https://blog.invisiblethings.org/2013/02/21/converting-untrusted-pdfs-into-trusted.html&quot;&gt;Qubes PDF converters&lt;/a&gt;. Perhaps
in some scenarios even better approaches could be used, e.g. verifying code
repositories by checking digital signatures.&lt;/p&gt;

&lt;p&gt;The third method has not been officially merged into Qubes yet, and it is
unclear how effective (complete) it could be in practice, but some discussions
about it, accompanied by an early implementation, can be found on the &lt;a href=&quot;https://groups.google.com/forum/#!msg/qubes-users/AghENQx00Pk/5qYPguBHAwAJ&quot;&gt;mailing
list&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.invisiblethings.org/resources/appvm-ir-private-img-mounting.png&quot; alt=&quot;Compromise recovery for individual AppVM&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;handling-other-system-vms-compromises&quot;&gt;Handling other system VMs compromises&lt;/h3&gt;

&lt;p&gt;Much easier to recover should be various ServiceVMs, such as USB- and net- VMs.
In most cases these do not require any significant user customisations or data
(maybe except for saved list of WiFi networks and their passphrases). In this
case their recovery should be as easy as just removing and recreating the VM in
question.&lt;/p&gt;

&lt;p&gt;One could go even further and imagine that all ServiceVMs should be &lt;a href=&quot;https://blog.invisiblethings.org/2010/06/01/disposable-vms.html&quot;&gt;Disposable
VMs&lt;/a&gt;, i.e. without any persistent storage (no private image). In this
case full recovery would be achieved by simply restarting the VM. Thanks to the
&lt;a href=&quot;https://www.qubes-os.org/doc/mgmt/&quot;&gt;Admin API&lt;/a&gt; that is coming in Qubes 4.0 this approach might become
easy to implement and might get implemented in the 4.1 or later version.&lt;/p&gt;

&lt;h2 id=&quot;recovering-from-a-full-qubes-system-compromise&quot;&gt;Recovering from a full Qubes system compromise&lt;/h2&gt;

&lt;p&gt;So far we’ve been discussing situations when one or more Qubes VMs are
compromised, and we have seen how Qubes’ compartmentalized architecture
helps us to recover from such unpleasant situations reasonably well.&lt;/p&gt;

&lt;p&gt;But occasionally we learn about bugs that allow an attacker to compromise the
whole Qubes OS system. In the nearly 8 years of Qubes OS, there have been at
least 4 such fatal bugs, and this justifies having a designated procedure for
reacting to such cases. We look at this method below.&lt;/p&gt;

&lt;h3 id=&quot;introducing-the-paranoid-backup-restore-mode&quot;&gt;Introducing the “paranoid” backup restore mode&lt;/h3&gt;

&lt;p&gt;In order to provide a meaningful option for users to recover from a full Qubes
system compromise, we have &lt;a href=&quot;https://github.com/QubesOS/qubes-issues/issues/2737&quot;&gt;introduced “Paranoid Mode”&lt;/a&gt;
for the backup restore procedure. (The mode is also known as “Plan B” mode.)&lt;/p&gt;

&lt;p&gt;The idea behind this is very simple: the user makes a backup of a compromised
machine (running the backup creation on this very machine), then restores it on
a newly installed, clean Qubes system.&lt;/p&gt;

&lt;p&gt;The catch is that this special mode of backup restoration must assume that the
backup material might have been maliciously prepared in order to exploit the
backup restoring code and attempt to take over the new system.&lt;/p&gt;

&lt;p&gt;Naturally, backup encryption and HMAC-based integrity protection becomes
meaningless in this case, as the attacker who has compromised the original
system on which the backup was created might have been able to get her malicious
backup content properly signed with the valid user passphrase. We discuss how we
made our backup restoration code (reasonably) resistant to such attacks below.&lt;/p&gt;

&lt;p&gt;Now, without further ado, a quick sample of how this new mode is used in
practice:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[user@dom0 ~]$ qvm-backup-restore --help
Usage: qvm-backup-restore [options] &amp;lt;backup-dir&amp;gt; [vms-to-be-restored ...]

Options:
(...)
  -d APPVM, --dest-vm=APPVM
                        Specify VM containing the backup to be restored
  -e, --encrypted	The backup is encrypted
  -p PASS_FILE, --passphrase-file=PASS_FILE
                        Read passphrase from file, or use '-' to read from
                        stdin
  -z, --compressed	The backup is compressed
  --paranoid-mode, --plan-b
                        Treat the backup as untrusted, don't restore things
                        potentially compromising security, even when properly
                        authenticated. See man page for details.


[user@dom0 ~]$ qvm-backup-restore --paranoid-mode --ignore-missing -d sys-usb /media/disk/backup.bin
Please enter the passphrase to verify and (if encrypted) decrypt the backup:
Checking backup content...
Extracting data: 1.0 MiB to restore
paranoid-mode: not restoring dom0 home

The following VMs are included in the backup:

----------------------------+-------+---------------------+-------+---------------+--------+
                       name |  type |            template | updbl |         netvm |  label |
----------------------------+-------+---------------------+-------+---------------+--------+
                 {test-net} |   Net |           fedora-24 |       |           n/a |    red | &amp;lt;-- Original template was 'fedora-23'
      [test-template-clone] |   Tpl |                 n/a |   Yes | *sys-firewall |  black |
          test-standalonevm |   App |                 n/a |   Yes | *sys-firewall |   blue |
                  test-work |   App |           fedora-24 |       |      test-net |  green | &amp;lt;-- Original template was 'fedora-23'
           {test-testproxy} | Proxy |           fedora-24 |       |             - | yellow | &amp;lt;-- Original template was 'fedora-23'
 test-custom-template-appvm |   App | test-template-clone |       | *sys-firewall |  green |
               test-testhvm |   HVM |                 n/a |   Yes | *sys-firewall | orange |
    test-template-based-hvm |   HVM |    test-hvmtemplate |       | *sys-firewall |    red |
         [test-hvmtemplate] |   Tpl |                 n/a |   Yes | *sys-firewall |  green |

The above VMs will be copied and added to your system.
Exisiting VMs will NOT be removed.
Do you want to proceed? [y/N] y
(...)
-&amp;gt; Done. Please install updates for all the restored templates.
-&amp;gt; Done.
[user@dom0 ~]$
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After the backup restoration we end up with a fresh system that consists of:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Clean dom0, hypervisor, and default system/service VM,&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;some number of potentially compromised VMs (those restored
from the untrusted system),&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;some number of clean, non-compromised AppVMs.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The user can immediately start using either of the AppVMs, even the
compromised ones, without endangering any other VMs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.invisiblethings.org/resources/paranoid-backup-restore.png&quot; alt=&quot;Overview of Qubes system compromise recovery&quot; /&gt;&lt;/p&gt;

&lt;p&gt;However, a few things will not get restored when running in paranoid mode, and
these include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Any dom0 modifications, such as the wallpaper and other desktop environment
customizations (it’s impossible to sanitize these and securely restore, yet
these should be relatively easy to recreate with “a few clicks”),&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;qrexec policies and firewall rules (what good could be these policies if
coming from compromised system anyway?)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;all non-basic properties for the restored VMs, such as PCI device
assignments.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It should be clear that any attempt to restore any of the above might easily
jeopardize the whole idea of paranoid restoration procedure.&lt;/p&gt;

&lt;h2 id=&quot;qubes-os-vs-conventional-systems&quot;&gt;Qubes OS vs conventional systems?&lt;/h2&gt;

&lt;p&gt;It’s worth stressing the difference that Qubes architecture makes here.  In case
of a traditional monolithic OS, it is, of course, also possible to migrate to a
newly installed, clean system. But users of these systems face two challenges:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;First, in order to copy the user data from an old, compromised system, one
needs to somehow mount some kind of mass storage device to a new, clean
system. Typically this would be a USB disk, or a directly-connected SATA-like
disk. But this action exposes the clean system to a rather significant attack
vector coming from 1) the malicious USB device, 2) malformed partitions or
other volume meta-data, and 3) malformed filesystem metadata. All these
attacks would require a bug in the clean system’s USB, storage, or filesystem
parsing stack, of course. But these bugs might be completely different bugs
than the bugs we might suspect the attacker used to infect the first system
(as a reminder: we perform all these recovery procedures because we learned
about some fatal bug in some critical software, e.g. a Web browser for a
monolithic system, or Xen for Qubes).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;But even if we neglect the potential attacks discussed in the previous point,
still we face a very uncomfortable situation: perhaps we just successfully
transferred all the data from the old system, but how could we securely use
them now? If we “click-open” any of the files, we endanger to compromise our
freshly installed system, for the attacker might have modified any or all of
our files after the compromise. This would bring us back to the point we
started. A traditional solution would be to restore from an earlier,
before-the-compromise-happened backup. Only that, as discussed above, we
often lack any good tools to determined when exactly did the compromise
happen. Not to mention we would need to sacrifice all the recent work when
implementing this strategy.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Qubes mechanism described in this article has been designed to prevent any
of these scenarios.&lt;/p&gt;

&lt;h3 id=&quot;under-the-hood-of-the-backup-restore-paranoid-mode&quot;&gt;Under-the-hood of the backup restore “paranoid mode”&lt;/h3&gt;

&lt;p&gt;So, how have we designed and implemented this paranoid backup restore mode on
Qubes OS? To understand our design decision, as well as the current limitations,
it is helpful to realize that we want to avoid attacks coming on three different
levels of abstractions:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;System-level attacks (e.g. malicious USB, malformed filesystem metadata)&lt;/li&gt;
  &lt;li&gt;Backup parsing-level (e.g. XML parser for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt; file)&lt;/li&gt;
  &lt;li&gt;Backup interpretation-level (“semantic” level)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Qubes architecture has been designed to prevent level 1 attacks, long before we
decided to tackle the problem of malicious backups. This is achieved both
through &lt;a href=&quot;http://invisiblethingslab.com/resources/2014/Software_compartmentalization_vs_physical_separation.pdf&quot;&gt;careful compartmentalization&lt;/a&gt;, as well as
through the actual architecture of the backup system, which assumes that
whatever domain (VM) that provides the backup should not be trusted.&lt;/p&gt;

&lt;p&gt;Level 2 attacks mentioned above is more problematic. The primary attack surface
in case of backup restore procedure on Qubes is parsing of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt; that
is part of the backup and which contains crucial information about the VMs being
restored (which template they are based on, which network VMs they should be
connected to, etc). In case of normal (i.e. non-paranoid mode) backup
restoration, even though the backup file is being served from an untrusted
entity (e.g. a usbvm), the attacker cannot control the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;qubes.xml&lt;/code&gt; file, because
the whole backup is crypto authenticated. Unfortunately, in the scenario we’re
considering here, this protection doesn’t work anymore, as explained above.&lt;/p&gt;

&lt;p&gt;In order to properly defend against attacks on the XML parser in the backup
restoring code, we need to sandbox the code which does the actual parsing. Yet,
it’s somehow problematic how such a sandboxed code could still perform its
stated goal or creating the actual restored VMs. Luckily, the new &lt;a href=&quot;https://www.qubes-os.org/doc/mgmt/&quot;&gt;Admin (aka
Mgmt) API&lt;/a&gt;, which we have introduced in Qubes 4.0, is an ideal
mechanism for this job.&lt;/p&gt;

&lt;p&gt;Unfortunately this API is not available on Qubes 3.2, which means we cannot
easily sandbox the backup parsing code there. In this respect we would need to
trust the Python’s implementation to be somehow correct and not exploitable.&lt;/p&gt;

&lt;p&gt;Finally, there is Level 3 of potential attacks. These would exploit potential
semantic vulnerabilities in backup restoration, such as injecting a
malformed property name for one of the to-be-restored VMs in such a way that,
when actually used later by the Qubes core code, this might result in the
attacker’s code execution. For example some properties are used to build paths
(e.g. kernel name for PVMs), or perhaps are passed to eval()-like functions.&lt;/p&gt;

&lt;p&gt;In order to prevent such logic vulnerabilities, we have decided to write from
scratch special code (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SafeQubesVmCollection()&lt;/code&gt;) which parses the backup and
creates VMs from it. The difference which makes this code special is
that it only takes into account some minimal set of properties, i.e. those which
we consider safe (for example it ignores PCI device assignments, doesn’t restore
firewall rules, etc). Additionally it skips dom0’s home directory and
implements other limitations, as already mentioned earlier.&lt;/p&gt;

&lt;p&gt;One nice thing about the upcoming Qubes 4.0 &lt;a href=&quot;https://qubes-core-admin.readthedocs.io/en/latest/&quot;&gt;core stack&lt;/a&gt; and
the &lt;a href=&quot;https://www.qubes-os.org/doc/mgmt/&quot;&gt;Admin API&lt;/a&gt; is that it is trivial to take this safe backup
restoration code and run it in other-than-dom0 VM, e.g. a Disposable VM.  Then,
assuming this VM will be allowed to request specific Admin API qrexec services
(e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mgmt.vm.Create.*&lt;/code&gt;), everything will work as before. But, this time, the
XML parser will run sandboxed within a VM, not in Dom0, as in Qubes 3.2. This is
illustrated on the diagram below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.invisiblethings.org/resources/paranoid-backup-restore-under-the-hood.png&quot; alt=&quot;Qubes Paranoid Mode implementation using Admin API in Qubes 4.0&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Qubes architecture provides some unique benefits when recovering from
compromised (one or more) AppVMs. These include: 1) easy way to revert back to
good known root filesystem for all template-based VMs, 2) ability to safely
migrate select data from compromised AppVM to new VMs, 3) easy way to recover
from compromised system VMs, such as net- and USB- VMs, and 4) ability to
reliably upgrade vulnerable software within AppVMs by performing the upgrade in
the template, instead of in the (compromised) AppVM, and then restarting the
AppVM.&lt;/p&gt;

&lt;p&gt;But even more spectacularly, the newly introduced “paranoid” backup restore mode
offers a simple and generic way to recover from full system compromises.&lt;/p&gt;

&lt;h2 id=&quot;faq&quot;&gt;FAQ&lt;/h2&gt;

&lt;h3 id=&quot;i-dont-get-whats-all-the-fuzz-about-here-how-is-this-different-from-any-other-os&quot;&gt;I don’t get what’s all the fuzz about here? How is this different from any other OS?&lt;/h3&gt;

&lt;p&gt;Please (re-)read &lt;a href=&quot;#qubes-os-vs-conventional-systems&quot;&gt;this section&lt;/a&gt; and &lt;a href=&quot;#summary&quot;&gt;summary
section&lt;/a&gt; again.&lt;/p&gt;

&lt;h3 id=&quot;for-full-system-recovery-is-it-enough-to-reinstall-qubes-os-still-on-the-same-hardware&quot;&gt;For full system recovery, is it enough to reinstall Qubes OS still on the same hardware?&lt;/h3&gt;

&lt;p&gt;If our x86-based computers were more trustworthy, or at least more
&lt;a href=&quot;https://blog.invisiblethings.org/papers/2015/state_harmful.pdf&quot;&gt;stateless&lt;/a&gt;, it would be enough to just reinstall the OS from
scratch and stay on the same machine. Unfortunately, as of today, this might not
be enough, because once the attack gained access to dom0/hypervisor, she &lt;a href=&quot;https://blog.invisiblethings.org/papers/2015/x86_harmful.pdf&quot;&gt;might
be able&lt;/a&gt; to seriously compromise the underlying hardware and
persist malware in such a way that it can survive further system
reinstallations.&lt;/p&gt;

&lt;h3 id=&quot;wait-i-thought-qubes-os-offered-protection-against-these-pesky-smmfirmware-malware&quot;&gt;Wait, I thought Qubes OS offered protection against these pesky SMM/firmware malware?&lt;/h3&gt;

&lt;p&gt;Correct. Qubes OS, unlike most other systems, has been designed to keep all the
malware away from interacting with the real, sensitive hardware, thus preventing
various BIOS/firmware attacks (even if the attacker managed to compromise one or
more of the VMs). However, once there is a fatal vulnerability in the core
software that is used to implement Qubes security model, e.g. in the Xen
hypervisor, then this protection no longer works. Sorry.&lt;/p&gt;

&lt;h3 id=&quot;alright-but-in-practice-do-i-really-need-to-get-a-new-machine&quot;&gt;Alright, but in practice, do I really need to get a new machine?&lt;/h3&gt;

&lt;p&gt;Unfortunately no one can provide any good answer to that question. Each user
must decide by themselves.&lt;/p&gt;

&lt;h3 id=&quot;wouldnt-it-be-easier-to-just-use-disposable-vms-for-everything&quot;&gt;Wouldn’t it be easier to just use Disposable VMs for everything?&lt;/h3&gt;

&lt;p&gt;Unfortunately, the “Just use Disposable VMs” is not a magical solution for all
the security problems. In particular, whenever we want to persist user
data/customisations/configuration across AppVM restarts (and we want to do that
in majority of cases), the use of DispVMs does not provide significant benefits
over traditional AppVMs. In some &lt;em&gt;special&lt;/em&gt; scenarios this might make sense, like
e.g. for the case of service VMs &lt;a href=&quot;#handling-other-system-vms-compromises&quot;&gt;mentioned
above&lt;/a&gt;. However, it doesn’t seem
feasible to have a &lt;em&gt;generic&lt;/em&gt; solution that would be able to selectively copy
back &lt;em&gt;and&lt;/em&gt; sanitize user files before a DispVM shuts down, for later use of
these files in another DispVM. And without sanitization, the solution becomes
equivalent to… just using a standard AppVM.&lt;/p&gt;

</description>
        <pubDate>Wed, 26 Apr 2017 00:00:00 +0000</pubDate>
        <link>https://blog.invisiblethings.org/2017/04/26/qubes-compromise-recovery.html</link>
        <guid isPermaLink="true">https://blog.invisiblethings.org/2017/04/26/qubes-compromise-recovery.html</guid>
        
        
      </item>
    
  </channel>
</rss>
