I would like to know whether there is any way I can run an absolutely unknown executable file without being hacked even if the file contains a lot of malicious code. Is there any program in which I can run it without putting myself in any risk?

  • Run it in a virtual machine that you throw away afterwards
    – paj28
    Commented Sep 8, 2016 at 14:19
  • does this guarantee 100 percent protection ? what if the vm contains vulnerabilities using which you can smash the parent os
    – Tomas
    Commented Sep 8, 2016 at 14:21
  • 1
    or malwr.com / herdprotect.com
    – HashHazard
    Commented Sep 8, 2016 at 14:24
  • 2
    @Tomas - not much guarantees 100% protection. You could run it on an air gapped physical machine. That is safer - but more effort. For most people a disposable VM is a good balance.
    – paj28
    Commented Sep 8, 2016 at 14:24
  • 2
    I'll just add here that some malware can detect if it's running in a VM rather than a real machine and will not do anything malicious if in a virtual environment for this exact reason. Running in a VM is only good if your VM is built specifically for emulating a real machine to a tee. Commented Sep 8, 2016 at 16:39

5 Answers 5


If you really want the closest thing to a 100% safe way of running malware:

Create an account with Amazon Web Services, fire up a server but don't connect it to anything (read: put it in its own VPC) and do your analysis there. Burn after analyzing.

Side note: there are some pre-created AMIs in the " Ec2 Market Place" that have malware analysis tools loaded on them already if you feel like getting frisky.

  • It's not 100% safe either, you're just shifting responsibility onto Amazon. Commented Sep 9, 2016 at 22:39

does this guarantee 100 percent protection?

No. Never. Never ever ever ever ever. Period.

100% guarantees simply do not exist in the real world. If you wanted an example of what might get close to 100%:

  • Buy a brand new machine. Put it on isolated power. Put the executable on it
  • Disconnect it from the network.
  • Run the program
  • Don't look at the results (you might be tempted to act on them, breaking the 100% guarantee. For all you know the results may hypnotize you into murdering your dog)
  • Power the computer down.
  • Put the computer in a wood chipper
  • Gather then remains, and pour them into a steel foundry a. la. Terminator 2

Now there are things you can do to mitigate the risk. Things like running it in a VM (such as the Amazon Web Service Hollowproc recommend) are powerful tools for strongly mitigating the risk. Wiping the harddrive after use is helpful too. However, there is no 100% guarantee.

For an example of this, consider Stuxnet. Stuxnet is infamous for attacking a nuclear enrichment facility across an airgap! It wasn't easy, but it did happen.

A better solution would be to not open a file if you can't say anything about how safe it is.


Another thing to consider, is whether this program will attempt to replicate, leak data, or do other damage over the network. To prevent that from occurring, I would recommend using a Virtual Machine. Take care to remove host access (or sometimes called host / guest file sharing) and remove any virtual networking interfaces before running the program in the VM. Good VM hypervisors should give reasonable protection to the data and hardware on the VM host, but if you're really worried about that, consider running it in a VM on dedicated, non-networked VM host.

Also check out sandboxie, it's basically intended for running untrusted programs in isolation. This does not prevent the program from making network connections though.


Barring NSA-level attacks that alter hard drive firmware and the like, there is a relatively simple and cheap solution.

  • Buy an extra hard drive that include some sort of free "clone" or "migration" software, or a linux "repair" bootable thumb drive.
  • Clone your system's hard drive to the new drive then unplug the new drive.
  • Unplug the internet source (router, modem, etc) to stop exfiltration
  • Install/run your un-trusted EXE as much as needed.
  • Reboot and wipe the main hard drive from a bootable thumb drive.
  • Clone the copy back to the main box and reboot.

This lets you run code in your normal setup, locally (w/o net), and be rest assured that no harm will come to your machine or data. You could still get hit with a targeted attack that uses something like fan-based exfiltration, but if you're just worried about ransomware, spyware, or a virus, the copy and restore method is very effective.

Use this routine on an extra $100 computer (refurb on newegg or ebay) if the EXE needs internet.

  • 2
    What about MB firmware? Can't malware reflash the BIOS? Commented Sep 8, 2016 at 21:52
  • @DavidAndersson: consider that "and the like": see the "serenity prayer".
    – dandavis
    Commented Sep 9, 2016 at 12:24
  • Okey. I thought unplugging the original drive was for preventing this type of attack. Can one clone the bios? Commented Sep 9, 2016 at 20:38

You cannot.

If you use OS-level virtualization solution (sandboxes, containers, selinux), the malware can use local privilege escalation exploit. If you use hardware virtualization the malware can exploit vulnerabilities in the hypervisor (and other underlying software including OS, bios and firmwares (a lot of devices have firmwares flashable, this allow creation of extremely persistent rootkits)) and fault injection like RowHammer. If you use an emulator, the malware can try to exploit a vulnerability in the emulator.

So you need a separate physical machine and if you need to analyse binaries automatically you need the software on the analysing machine to be not vulnerable.

Now forget everything written above because it is not a real life scenario (unless you are high-value target for intellegence agencies). A hardware virtualization solution (for example QubesOS) should be enough, if you cut it from devices (no OpenGL passthrough, no PCI passthrough, no USB passthrough, no access to storage, etc ...)

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