2

Context: AI competition. Users upload a dll with a class implementing a provided interface, then the competition runner instantiates that class and invokes various methods on the interface.


Obviously, this means that I'm intentionally allowing users to run whatever code they like as long as they wrap it up in an entry point that looks like my interface.

At the moment this is an internal company thing so we 100% trust all employees (no discussion of this, please), but it would be lovely to be able to make it more public.

Is it possible to make a system like this safe? How sandboxed can I make the dll's be? It's currently running in Azure. I assume that the box is backed up by some automated Azure stuff? (I didn't set up the Azure box)

A) Can I prevent them from interacting with anything else on the box? B) Can I prevent them from accessing anything outside the Azure box? C) Can I prevent them from accessing the Azure backups (i.e. If I say that I don't care if they trash the box, 'cos I could restore from backup, then is that safe?)

Brondahl
  • 159
  • 5
  • You will need to sandbox the execution environment. There are numerous tools for this - google "C++ sandbox" for example https://github.com/daveho/EasySandbox. You also want to assume the worst with all over system aspects. Execute as a user only with essential permissions. Don't give the box any domain trust and firewall it away from your other machines / only allow essential outgoing connections. – Hector Nov 10 '17 at 17:00
  • Maybe have a look at how some CTF competition platforms are sandboxed? - They will have the same challenge as you by the sounds of it. – Arlix Nov 10 '17 at 17:08
  • can you spin up a new VM, run the code, and then tear down the VM? seems safe to me. – dandavis Nov 10 '17 at 18:53

1 Answers1

1

Since you are already running in a virtual environment, the simplest way would be to give each user a separate, small, environment to work with. If your operations team are any good, they will be using standard templates and/or scripting to create and tear down virtual environments in any case so this should be simple.

If you were using a Linux server, the easiest approach would be virtualisation via Docker.

Julian Knight
  • 7,092
  • 17
  • 23
  • Before you consider docker for insulating potentially malicious code, please read [What makes Docker more secure than VMs or bare metal?](https://security.stackexchange.com/questions/169642/what-makes-docker-more-secure-than-vms-or-bare-metal/) (tl;dr: The premise is wrong. Docker offers more attack vectors than proper virtualization) – Philipp Nov 12 '17 at 13:50