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?)

  • You will need to sandbox the execution environment. There are numerous tools for this - google "C++ sandbox" for example 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

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.

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.