I have to transfer some files such as movies, TV series and other large stuff (so I can not to use a cloud) from a virtual machine to the host. I read that an infected virtual machine can spread malware to the host using the shared folder, so I didn't create any shared folder between host and guest because I'm using the VM for "unclean stuff" and I don't want to risk to infect the host.

But how can I transfer those files without the shared folder and without running the risk of infecting the host?

The program I'm using is Virtual Box, the host is Ubuntu 22.04 and the virtual machine is running Debian 12 (I know both Ubuntu and Debian are pretty safe, but I'm trying to take as many precautions as possible).

  • 1
    If you fear that the virtual machine might be infected, then how can you be sure that the files you want to transfer are not malicious themselves? As for transferring files in general between hosts in a restricted way: run a server on the VM which allows to download the files from a client at the host, i.e. web server, SSH server, simple socket server (netcat), .... . But none of this will ensure that the data you transfer are innocent. Commented Dec 29, 2023 at 14:30
  • Yes even if it is rare because they are .mkv, .avi and media files, they still might be infected. I will scan them with an AV just to take one more precautions. But what I'm afraid is that the VM contains some running malware that could infect the host if it can to spread. SSH seems good idea, I start a SSH Server on the VM and I connect with the host, then I send the file? That's all?
    – woyim46107
    Commented Dec 29, 2023 at 15:15
  • 1
    Yes, it can be as simple as starting an SSH server. But - you can neither trust anything running on the VM nor anything which is stored on the VM. So better use something which is that simple that exploitation through the application protocol is unlikely. SSH is way more complex in this regard than a simple netcat. Commented Dec 29, 2023 at 15:59
  • Welcome to the community. Don't forget to adjust your network settings for the VM accordingly so you can reach the server at all. Commented Dec 30, 2023 at 12:25

1 Answer 1

  • Transfer them via a shared folder.
  • Invoke file on all files and check they are what they are, e.g. video/audio/whatever you need.
  • Delete any files which are not what you need.

Your guest cannot write outside the shared folder anyways. There's no danger in using a shared folder.

Alternatively to be super extra safe, upload files from your guest to the cloud (a throw away Google Drive account), download them, inspect them and delete anything you don't like.

Files by themselves, unless you open or run them, don't pose any risk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .