Sandbox Virtual Machine for an Application (concept)

旧街凉风 提交于 2019-12-06 09:43:50

Simulating a complete machine seems like a very slow way to execute native code. Lots of operations with load, lookup, execute, store, etc just for a single native instruction.

I would try to execute at least some blocks of code natively. Think of the following code.

int sum = 0;
for (int i = 0; i < 10; i++)
{
    sum += i;
}

This code is completely safe to execute native in your virtual machine. Just make sure that you inject a return call to your virtual machine code.

But I would try to go a step further and execute all code natively except for library/os calls. Before loading the sandboxed application, scan through the file and replace all "dangerous" calls with calls to handlers in your virtual machine.
The code

printf("Hello World\n");

would be replaced with calls to your library

myVM_printf("Hello World\n");

Then you can execute the whole program at native speed and still be able to handle all the dangerous code in your virtual machine.

Just by adjusting process's rights, you can achieve A LOT. At least under WinNT, which has rather fine-grained process rights. I also believe that google's sandboxing, used in Chrome, has been opensourced.

This sounds like this can be accomplished with existing sand-boxing such as SELinux or App-V by Microsoft.

Also access to peripherals can be problematic. What if the peripheral is a camera in the room or a microphone? What if the hacker wants to waste your money by printing out a never ending story in rainbow text?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!