Can I use QEMU untrusted?

1 point by logicallee 2 days ago

I am considering allowing users to run a small qemu appliance based on a minimal Alpine linux installation, with virtio-gpu passthrough on Venus/Vulkan, to rent out their gpu/cpu/RAM/storage in exchange for an hourly fee to do so. The viability of this idea would depend on whether users can run a qemu appliance like that without trusting anything except qemu. Can qemu be used to run untrusted code like that, as a kind of sandbox? users would just download and start my appliance, and ideally they could see from any other network interface that it doesn't make any connections except to our server. (We would build and update the appliance ourselves from time to time.) We'd like to get as close to zero-trust as possible on this solution.

yorwba 2 days ago

QEMU is supposed to allow sandboxing untrusted code, though as with any other sandbox, vulnerabilities enabling guest-to-host escape are occasionally discovered. And of course some configurations increase the attack surface a lot, for example by passing through access to buggy GPU drivers.

Personally, I wouldn't risk it.

  • logicallee 2 days ago

    Thanks. We can try to have defense in depth by adding some other checks to try to keep things correct, including checks against the untrusted code the appliance would host or run. It's very difficult to trust any code these days, but code that would attempt to break out using buggy GPU drivers would have to be particularly malicious. Do you think we could catch code like that through any kind of static analysis?

    • yorwba 2 days ago

      You could maybe catch code exploiting particular known bugs, but preventing it from triggering bugs you don't even know about is a tall order. Especially when everything else on the host system is just whatever some rando happens to have installed on their machine.