32

I was messing around with a virtual machine and somehow found myself on a malicious website (in the virtual machine → Ubuntu, Firefox). What I absolutely didn't expect was Avast Antivirus on my host machine sending the usual "Threat Blocked" notifications.

The source of the threat according to Avast was the website I was visiting on my VM. How is this possible? I thought VMs were supposed to be totally sandboxed from the host machine. In fact, I had wanted to test potentially malicious software on a VM before running it on my host machine. What's going on here?

4
  • 2
  • 1
    Summary of Mark's link: although the explanation in this case is almost certainly the benign one below, it is indeed possible to escape the sandbox. In my opinion, this shouldn't be too surprising; VirtualBox is a big piece of software, so it would be a little surprising to find out it had no bugs. – Daniel Wagner Jun 21 at 16:19
  • I'm glad this got answered, but for my own clarification - doesn't the concept of a sandbox only go one way - i.e., it only limits the thing inside the sandbox. There's no promise that stuff outside the sandbox can't see inside it, or alter things (which, of course, might create a vulnerability to escape the sandbox, but doesn't always). Contrast with the idea of a blackbox, where stuff outside it can't look in. – jwrush Jun 21 at 18:06
  • Is a submarine completely waterproof? One would hope so, but we can't really say for sure that it is (especially not if you're descending particularly deep). Of course the biggest risk of getting wet probably comes from getting into or out of the submarine. – NotThatGuy Jun 22 at 9:17
56

The VM cannot be totally isolated, since it has no hardware of its own. It's using the hardware resources of the host, such as the disk, CPU, GPU and the network adapter.

All of this hardware is used by the VM via VirtualBox and its virtual drivers.

Avast Antivirus is monitoring the host's network adapter, so it can monitor all the requests and responses, when coming from the host or the VM. As it runs on the host, not in the VM, you will see its notifications and actions on the host.

8
  • 19
    The host should only be able to see the network communication that is unencrypted. Visiting any https site from within the VM should go unnoticed and unintercepted by the host, unless the host has "infected" the guest VM with its own root certificate. – Roland Illig Jun 19 at 20:55
  • 9
    @RolandIllig although, there's still many malicious domains that can be blocked using DNS. Firefox now uses encrypted DNS, but it's not unlikely that Avast blocks EDNS to force FF to fall back to unencrypted DNS. – lights0123 Jun 19 at 23:56
  • 3
    On the "no hardware of its own" point, see row hammer for various sorts of sandbox escapes. – Alex Reinking Jun 20 at 18:17
  • 4
    Even if all DNS traffic is encrypted, avast could still detect which server you connect to simply by its IP address, and block that traffic on a packet level. – ManfP Jun 21 at 8:46
  • 2
    @James_pic Hosting a malicious website on a CDN which requires your personal details to register is not the brightest idea. And small practically anonymous webhostings are often blocked by the antivirus even if it means carpet bombing innocent websites. – Dmitry Grigoryev Jun 22 at 14:52
19

As @harrymc said, this is due to the network configuration.

You probably have the network adapter in VirtualBox configured as NAT. Depending on how Avast works (disclaimer: I don't run it), you could try:

  • configure the adapter as "bridged" adapter.
  • Use an USB network adapter and import the USB device into the virtual machine.

I used the latter in network tests and the host machine was not able to interfere with the network traffic.

7
  • 1
    It will be easier to disable Avast. – Carsten S Jun 20 at 0:49
  • 1
    @CarstenS Switching the adapter type used in the VM is generally rather easy, and would allow them to not have to disable Avast every time they wanted to run sketchy stuff in the VM. – trlkly Jun 20 at 23:27
  • 2
    @Carsten S, it may well be cheaper not to. – Jasen Jun 21 at 0:46
  • Changing the type to bridged is both a good and bad idea. The "bad idea" part is that if you install something with E.g.: wannacry, your entire network could be compromised, instead of just the VM. – Ismael Miguel Jun 21 at 15:09
  • 1
    Hey all, I apologise for any ambiguity in the question. I definitely don't want Avast to stop interfering :) From what I understand by looking at the above comments, a bridged connection could potentially be very dangerous. So, I'll scratch that one off. Is an external network adapter totally safe (consider worst case scenario, wannacry or something on that scale)? @LjmDullaart you've outlined a few solutions which are totally beyond my understanding. Can you please provide a few links I can read up on? – n00dles Jun 21 at 16:01
2

I have actually seen this myself. Part of the issue is that the VM is running on the host's hardware, yes, but as mentioned the antivirus shouldn't be able to see HTTPS traffic (if the infected site wasn't just an HTTP one).

That's where the interesting part happens. Avast Antivirus in particular but also a number of other such tools actually install a man-in-the-middle proxy to read even your encrypted web traffic in case of viruses. (Avast also uses this information to run surveys on how people use the Internet.) This works across the entire network connection as well, not just to your browser (which makes sense if you want to check over other protocols or services).

A large caveat (aside from the privacy concern) is that in many such implementations, if the certificate for the original site doesn't exist or is expired, the antivirus program's own certificate causes the site to still appear "secure" even though your connection through the wider Internet won't be.

With regards to the sandbox being escaped, though, I have had various actions inside Virtualbox crash my entire OS before on several occasions. This isn't a sandbox escape (yet), but that sort of BSoD can be a sign that some questionably-designed code is running that could be exploited to make a sandbox escape.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.