Skip to content

Instantly share code, notes, and snippets.

@devnexen
Last active May 18, 2017 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devnexen/ce2c33d5e921a4b5ba28c61759b612ab to your computer and use it in GitHub Desktop.
Save devnexen/ce2c33d5e921a4b5ba28c61759b612ab to your computer and use it in GitHub Desktop.
Capsicum – a lightweigth OS capability and sandbox framework

A problem to solve ...

  • Like many computer software topics, it is all about solving problems.
  • Security within software is one of the most important parts.
  • The purpose here is to secure applications to reduce the surface of attack vectors.
  • Today we will be focusing in one particular solution.

Capsicum – a lightweigth OS capability and sandbox framework

What is Capsicum ?

  • Is a security framework to set fine grained control to file descriptors, from network based applications to daemons. Even a web browser ... Anything which uses a file descriptor.

  • Comes with a set of additional functions and a library (casper) to filter, for example, DNS requests.

  • Is available primarly on FreeBSD and in an unofficial Linux kernel version.

https://github.com/google/capsicum-linux

  • There was an existing DragonflysBSD version at some point but was abandoned.

https://github.com/jorisgio/DragonFlyBSD/tree/capsicum

Capsicum in FreeBSD

  • Developed during FreeBSD 8.0x era.
  • Is included in FreeBSD since 9.0 release (experimental).
  • The kernel needs to be compiled with capsicum support in order to allow both kernel capabilities and related userland functions to be available.

Which applications are using it ?

  • An handful of userland applications were converted along the time to use capsicum, some network related one (dhcpclient, tcpdump, traceroute), bhyve.
  • The best userland example, often mentioned, is the popular Chromium web browser which uses sandboxing technique to secure Javascript usage, safe memory usage and the likes.

Limitations

  • Works only on file descriptors ...
  • Thus as a consequence we cannot protect against certain potential harmful system calls (fork, chown, mkdir, ...).
  • The indirect consequence of it is there is not much userland applications converted to capsicum.

Other solutions within other operating systems

  • Linux Seccomp
  • OpenBSD's pledge

https://gist.github.com/devnexen/232f4de03beddf09b4e93619d44ed8bc

Conclusion

  • Despite the limitations described earlier, capsicum provides a great deal of safer softwares.
  • If available applications are already benefitial from this approach, that will make the end user life better.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment