What criteria does a sandbox use to determine whether executing code (registry read/write) can be trusted or not ?


A well-designed sandbox is simple: all code inside it is untrusted, and has to ask the sandbox if it wants access to anything outside.

|improve this answer|||||
  • thank you @Mark. Does that mean all untrusted code knows what resources are available or not ? – Joe T Jan 5 '18 at 6:12

A sandbox is an environment which restricts what the code can do. Such restrictions might for example limit file access to specific directories, network access to specific IP or ports or use of system calls to only white listed ones. What kind of restrictions are setup for the sandbox depends on the specific use case.

And because the sandbox restricts what code can do it can be used to execute untrusted code, i.e. code which might be harmful when run within an unrestricted environment. In other words: the sandbox does not distinguish between untrusted and trusted code. Instead every code inside the sandbox is considered untrusted and that's the reason it will be run inside a sandbox in the first place.

There are many different use cases for sandboxes and also many different implementations. For example a program might put itself or its children in a restricted environment (see chroot, pledge or seccomp for examples) in order to limit the damage which can be done in case of bugs in the program. Or an antivirus product might put some suspicious software in a sandbox in order to monitor and restrict its behavior. Or you have a sanboxed execution of Javascript inside the browser which limits what kind of resources the script can access and with which sites it can communicate.

|improve this answer|||||
  • Thank you @Steffen. Do you have any helpful links which shows how a basic sandbox can be designed ? – Joe T Jan 5 '18 at 6:16
  • @JoeT: How a sandbox is designed is a different question and new questions should not be asked in a comment. Also, how this is done depends on the kind of sandbox, i.e. sandboxing a binary is different from running Javascript in a browser sandbox etc. At the C level have a look at things like seccomp, pledge, chroot etc. – Steffen Ullrich Jan 5 '18 at 6:23
  • Thank you @Steffen. Yes you're right I will give it some thought and start a new question. As Mark has said that the sandbox will need to decide to permit access of resources outside the sandbox then how does the sandbox decide this ? – Joe T Jan 5 '18 at 6:55

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.