3 This is an "unfunded mandate", I'm afraid; I can't work on this. And
4 it's a reasonable amount of work.
6 It is, however, based on a long, long acquaintance with the problem
7 space. This is something I was thinking about doing for the old
8 Zero-Knowledge Freedom system back in 2000, because of bugs we kept
9 finding and attacks we kept coming up with.
11 If you want to discuss this, I'm jbash at-sign velvet period com .
15 A lot of code runs inside amnesia: big programs like Web browsers,
16 Pidgin (with plugins), OpenOffice (eek!), etc. Each of those programs
17 will (not may, but definitely will) have security holes that will leak
18 the real IP address of the machine, and possibly other information.
20 They will also have holes that will allow remote sites to execute
21 arbitrary code sent back through Tor connections. This code can then
22 grovel through /sys, /proc, and wherever else, and extract an endless
23 number of hardware serial numbers, MAC addresses, unique combinations
24 of configuration elements, and so forth, any of which may identify the
25 user's machine to the remote attacker. That's especially true if the
26 remote attacker is in a position to ask a manufacturer who bought a
27 given piece of hardware, but that's not the only way of using the
30 Exploit code can also try to disable or circumvent the local firewall
31 and send traffic that doesn't go through Tor. There are a lot of
32 tricks for doing this, especially because all it takes is one packet,
33 sent from any part of the system, to a chosen destination without
36 # The Partial Solution
38 Split amnesia into two parts: an outer, host part running on the
39 user's real hardware, and an inner, guest part running in a virtual
40 machine. Keep all information about the real identity of the user or
41 the user's computer in the outer machine. Keep all applications in the
42 inner machine. Mount any storage meant to be writable by the inner
43 machine as a virtual device provided by the outer machine. If you
44 encrypt the writable storage, the crypto should probably run on the
45 outer machine, so that the inner machine doesn't need to have access
48 Ship the entire inner virtual machine image as part of amnesia, so
49 that each instance is identical in every way that can be seen from
50 inside... so, for example, the inner machine might always have MAC
51 address 00:11:22:33:44:55 , and IP address 10.1.2.3.
53 Make sure that the face presented to the inner machine by the outer
54 machine is also always the same; for example, the inner machine might
55 always see the outer machine as a default router at MAC
56 00:55:44:33:22:11, with an IP address of 10.1.2.1. You don't want any
57 information about the outer machine to leak to the inner machine via,
58 say, ARP, or DHCP, or any weird management protocol.
60 The outer machine should run the hypervisor, and all code that has to
61 talk to the "real" network: link-layer supplicants, DHCP client, NTP,
62 Tor itself. The inner machine should be able to connect only to the
63 Tor port of the outer machine. The outer machine should have a
64 firewall configured such that no traffic can ever be relayed directly
65 from the inner machine to the network. The only way the inner machine
66 can talk to anything should be through Tor.
68 This includes traffic to the local LAN, BTW; local LAN commmunication
69 is a huge security hole, because it's usually easy to get a machine on
70 the local LAN to send something to the outside for you, identifying
71 the user in the process.
73 The inner machine can and almost certainly should be aware that it's
74 talking through a SOCKS proxy. Trying to be transparent using firewall
75 diversion hacks will probably break more things than it fixes.
79 This change reduces the attack surface a lot, but it's still subject
80 to attack through bugs in Tor, bugs in the hypervisor, bugs in the
81 outer machine's IP stack, and bugs in the kernel on the outer machine.
82 Oh, and bugs in the hardware. The good news is that you have to crack
83 the applications before you can attack any of those, so there's some
84 defense in depth; it takes knowledge of two unpatched bugs, instead of
85 just one, to actually nail the user.
87 The hypervisor used should be as simple as possible. I don't know
88 about Virtualbox, but VMWare is a nightmare of complexity and
89 guaranteed to be full of holes. qemu might be a better bet than
90 either, simply because it's not so loaded down with features, and does
91 fewer things to "help" you (and potentially leak information).
93 # Interacting With User Virtualization
95 It's presumably an important use case to have users run amnesia inside
96 of virtual machines that are part of the users' regular enviroments.
97 As far as I know, no X86 virtualization system will let you nest VMs,
98 so that implies that you can't do this trick when amnesia is run under
99 the user's hypervisor. Probably the "best" solution would be to
100 reconfigure the user's environment to provide the necessary services
101 to the amnesia internal virtual machine, but that's also probably an
102 unsupportable release nightmare. The alternative would be to fall back
103 to something like the way things work now, with Tor running inside the
104 virtual machine... but to warn the user that she was operating with
109 * [A Tor Virtual Machine Design and
110 Implementation](https://svn.torproject.org/svn/torvm/trunk/doc/design.html),
111 aka TorVM design document
114 # A promising, alternative solution: Qubes
116 Qubes is Fedora spin off which takes [security by isolation to the extreme](http://qubes-os.org/Architecture.html): a Xen hypervizor manages user defined "lightweight virtual machines" or "AppVMs" that isolate user processes, and even certain system-components like the network stack, from each other. Appropriate IPC, file and clip-board sharing supposedly works between programs in different AppVMs.
118 One fine thing with this approach is that it most likely would be easy to fallback to starting processes without these AppVMs in case it's detected that Tails itself runs inside a VM.
120 The two key questions that remain to answer is:
122 1. if these AppVMs can be "NAT:ed" or similarly made oblivious to the system interfaces' IP addresses.
123 2. if all this can be incorporated into Debian without too much trouble.
125 Read more at their [homepage](http://qubes-os.org/) and [wiki](http://www.qubes-os.org/trac/wiki).
127 # Comment from jbash 2010-02-22
129 I was asked to comment on the Qubes proposal above, and specifically on
130 the two questions about NAT and "adapting to Debian". This has gotten
131 too long for a comments page
135 On Qubes in general: it looks like a cool system and a useful
136 approach. I think you could easily put a "Tails VM" (more
137 properly a "Tor VM") into it in place of the "Net VM". Since
138 you're going to be hacking all over that VM anyhow, no problem to add
141 ... but there's a caveat: I'd be very careful about becoming dependent
142 on a small project with limited adoption. You could end up having to
143 take on all of the maintenance and development of Qubes itself. The
144 alternative would be having to port off of Qubes, which argues for not
145 becoming dependent on it. Also, you may have trouble finding people who
146 are willing to learn Qubes before they can start working. I suspect that
147 you might be better advised to come up with something that could run
148 with a variety of VM providers.
150 As for whether you could adapt the application VMs to run Debian,
151 I guess I'd ask "why do you want to adapt to Debian, particularly?".
152 You'd be undoing a lot of Qubes' work to put a big unconfined
153 Debian system in there.
155 Since I wrote the initial suggestion, I've actually been thinking, off
156 an on, about a two-VM alternative with a structure vaguely similar to the
157 Qubes idea, and I think one of the good things about that idea equally
158 applies to using Qubes. That good thing is that is that you don't
159 have to really care about "adapting to Debian" any more. At all.
161 ## Getting off the distro treadmill
163 The insights are that:
165 1. If the application VM doesn't have to handle the user's "real" identity, and doesn't necessarily have to handle any data that persist between sessions, then there's much less pressure to do anything special in the application VM to protect anonymity.
166 2. It's possible to set up Tor as a transparent Internet gateway, so that clients don't have to even be configured to use a SOCKS proxy. [Here's a HOWTO.](https://trac.torproject.org/projects/tor/wiki/TheOnionRouter/TransparentProxy)
168 That means you can get out of the business of patching up a whole
169 distribution to get everything to use Tor properly. You need to
170 stay current on general security updates, but that's about it,
171 especially if you don't enable the applications to write to any
172 storage. In fact, you don't even have to configure anything to
175 Instead, you provide two very minimal, targeted environments: a VM
176 to run Tor (this would replace the "NetVM" in Qubes), and a host environment
177 to run the hypervisor (this would be Qubes', and Xen's, "dom0")
179 Here's a slightly tweaked version of my block diagram, which is
180 obviously very similar to Qubes'.:
182 [[!img virtails.png alt="Block diagram"]]
186 The way I've drawn it, the host:
188 1. Runs the hypervisor (and is therefore responsible for network, device, and memory isolation).
189 2. Handles storage crypto (so that the application VM doesn't have to know any keys that might be useful beyond the current session).
190 3. Handles the user's choices about whether any writable storage is available to the application VM (if you allow the user that choice)
191 4. Keeeps the time of day accurate for everybody.
192 5. Presumably handles other houskeeping functions, like cleaning memory.
194 If the user wanted to, she could even use her own "regular" system
195 as the host, and boot the Tor and application VMs within that.
196 She'd better look to her swap encryption, and she'd better know
197 what's going on generally, but she can do it.
199 Veering back in the direction of better security, it looks like
200 the Qubes people have been careful to have the host do a good job
201 of isolating the VMs, for example not permitting the very large
202 security hole of direct 3D graphic access from the VMs. Even if you
203 didn't use Qubes, it sounds like they'd be a good project to learn
208 The Tor VM handles all communication between the application VM
209 and the outside world.
211 When the application VM boots, the Tor VM gives it an address using
212 DHCP. The application VM uses the Tor VM as its default gateway and
215 Internally, the Tor VM diverts DNS requests and all TCP connections
216 originating on the application side to Tor, which transparently
217 anonymizes them. IP filtering prevents the application VM from sending
218 anything else (and can be used to filter out "bad" traffic, as well, if
219 need be). Probably the filter should also stop any unexpected traffic
220 generated from within the Tor VM from being sent on the application
223 Kernel IP forwarding is totally disabled. Filtering on the Internet
224 side prevents any process other than Tor from sending any packets
225 whatsoever to the Internet. Much ICMP should probably also be filtered,
226 just in case. Traffic *from* the Internet is limited to return
227 traffic on TCP connections opened by Tor (maybe later it could be extended
228 to act as a relay, too).
230 You could clamp this down still further using SELinux.
232 Since it has access to Tor and all its secrets, Vidalia runs in the Tor VM.
233 That means the user has to do a console switch to see it. I don't see
234 that as a big problem; YMMV. You definitely could NOT run it in the
237 ### The application VM
239 With this sort of approach, the application VM *only* runs
240 applications. It has no idea of the real IP address, or even of
241 any machine's real MAC address. It doesn't know anything that identifies
242 the user unless the user types it in.
244 As a result, the application VM can be anything at all.
245 Windows, if you really wanted to use it. What I'd actually use would be a stock
246 Ubuntu LiveCD, for the following reasons:
248 1. It's widespread, and it, or close variants of it, are probably what people are booting behind various homebrew Tor proxies right now. So you may get a larger anonymity set.
249 2. It's very actively maintained... which means you're going to get upstream security patches.
251 I could see a very good case for staying with Debian, though, to avoid
252 Ubuntu's feature creep.
254 But I suggest that it can nonetheless be *stock* Debian,
255 absolutely unmodified from the latest upstream release.
257 1. That would conserve important resources for Tails-specific development
258 2. I suspect it would also speed up the process of propagating upstream fixes... which is probably the single best thing you can do for the security of the application VM.
259 3. It would also discipline you to being client-agnostic, which would mean that others could grab your images (especially the Tor VM image) and reuse them for other things.
261 # Update October 2012
263 New developments in other projects:
265 * [Qubes OS + Tor](http://theinvisiblethings.blogspot.com/2011/09/playing-with-qubes-networking-for-fun.html): detailed instructions on how to set up transparent Tor proxy with Qubes OS.; lacks considerations for identity correlation though circuit sharing
266 * [Whonix](http://whonix.sourceforge.net/): Anonymous General Purpose Operating System; Isolating and Transparent Tor proxy based on Virtual Box, Debian GNU/Linux and Tor; not a live system
269 > There are many users who would be able to set this up themselves, see [[todo/amd64_kernel]], the virtualisation software can be stored in the persistent storage and installed after booting a tails livecd. As long as the tails kernel supports running virtualisation software, the features in this document can be used today by a great many users
271 # Semi-simple solution
273 Let's say we [[todo/add_virtualbox_host_software]] to Tails and note
274 that a host can start several guests using the same boot media. Hence
275 we could add some kind of hook during Tails' boot process that,
276 depending on some "magic" parameter set by the host (if any), makes
277 Tails boot into specialized profiles (e.g. one that only runs Tor and
278 one that runs the GUI stuff). For instance:
280 * tor-guest: Boot Tails into a minimal mode (no Xorg etc.) that just:
281 - starts Tor with all its ports listening on the network.
282 - sets an appropriate firewall (only allow inbound traffic from the
283 'app-guest' vm (see below) to Tor's ports, and only the outbound
284 traffic made by Tor).
285 * i2p-guest: Same as 'tor-guest' but adapted for i2p.
286 * app-guest: Boot Tails exactly like it's done now except:
287 - it uses the Tor instance running on 'tor-guest' vm.
288 - sets an appropriate firewall (only allow connections to the
289 'tor-guest' and 'i2p-guest' vms)
291 If no such profile is set Tails boots normally. In Tails Greeter we add
292 an option called "Use isolation through virtualization" (or similar)
295 1. Continues from Tails Greeter to a simple X screen (no GNOME etc.
296 running; only vms are supposed to be run from the host from now on).
297 2. Starts a Tails guest with the 'tor-guest' parameter in headless
298 mode. (not sure about the 'i2p-guest' yet since it should start
300 3. Starts a Tails guest with the 'app-guest' parameter in fullscreen
301 mode. This is where the user should interact with Tails from now on.
303 Relevant settings from Tails Greeter on the host must be forwarded to
304 these guests appropriately, e.g. persistent Tor data dir to
305 'tor-guest' and all other persistent directories to 'app-guest' (using
306 VirtualBox' shared directories, I guess), and the language settings
307 should be set in 'app-guest' etc.
309 A fine question, though, is whether there exist something like this
310 "magical" parameter I talk about above in VirtualBox. The simplest
311 would be if Virtualbox could add stuff to the kernel commandline,
312 but I doubt that is possible in any sane way. More likely something
313 can be achieved through the guest additions. It seems like the host
314 can execute arbitrary commands on guests using `vboxmanage
315 guestcontrol execute`, which could be used to alter how Tails boots
318 > You could communicate with Virtual Box using hardware serials. Examples:
320 > `sudo -u $USERNAME VBoxManage setextradata "$VMNAME" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "BIOS Vendor"`
322 > `sudo -u $USERNAME VBoxManage setextradata "$VMNAME" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemUuid""9852bf98-b83c-49db-a8de-182c42c7226b"`
324 > <https://github.com/adrelanos/Whonix/blob/master/whonix_createvm>
327 > Change hardware serials to some specified value, let Tails read it and
328 > let Tails act accordingly.