Let's say that I'm building a web application that I will host on my server.

Should I sandbox it in order to protect my server?


I just learned that there might be more to sandboxing your web application than restricting the permissions of the user running it when I read those 2 posts :

  • Alternatively, run your web app on its own server with nothing else on – paj28 Nov 26 '16 at 8:34
  • What else is running on your server that you would like to protect from the webserver? – trognanders Nov 26 '16 at 10:51
  • @BaileyS Does the database count? – Gudradain Nov 26 '16 at 13:47
  • Maybe, although your web app probably has more than sufficient access to your db to cause trouble without any sandbox escape. – trognanders Nov 27 '16 at 3:42

It is an established method for improving security to give application only the privileges they are expected to need. This way the impact of a potential security issue is limited. Sandboxing using pledge, seccomp or similar technologies is one way to limit the privileges an application might abuse but it is not the only way. Typical other technologies are different users for different tasks, SELinux, containers, virtual machines etc.

These technologies differ in the overhead, the protection they offer, how hard they are to use etc. If any of these technologies are used and which one(s) therefore depends on the actual requirements, i.e. typically a balance between the required security, the needed performance and the amount of money available to implement and run it.

For the usual web application sandboxing all the application using seccomp or pledge is in my opinion not that easy. A better and easier separation is probably offered in this case with containers or virtual machines. Also, running known to be problematic steps like image processing in a restricted setup (process with different user, sandbox, container, VM...) separated from the rest of the application will increase the security.

Thus in summary: yes you should probably restrict your web application on the server side to limit the impact of a potential security problem. But if you use process based sandboxing using pledge or seccomp or if you use different technologies or if you combine multiple technologies depends on the actual requirements (security, performance) and limits (money and time available for development and maintenance).

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.