Capabilities and other protection mechanisms

Note: These lecture notes were slightly modified from the ones posted on the 6.858 course website from 2014.

Confused deputy problem

What's the problem the authors of "confused deputy" encountered?

Can we solve this confused deputy problem in Unix?

Several possible ways of thinking of this problem:

  1. Ambient authority: privileges that are automatically used by process are the problem here. No privileges should ever be used automatically. Name of an object should be also the privileges for accessing it.
  2. Complex permission checks: hard for privileged app to replicate. With simpler checks, privileged apps might be able to correctly check if another user should have access to some object.

What are examples of ambient authority?

How does naming an object through a capability help?

Could we use file descriptors to solve our problem with a setuid gcc?

What is the problem that the Capsicum authors are trying to solve with capabilities?

What sorts of applications might use sandboxing?

What sandboxing plans (mechanisms) are out there (advantages, limitations)?

Plan 0: Virtualize everything (e.g., VMs).

Plan 1: Discretionary Access Control (DAC).

"Ambient privilege": privileges used implicitly for each access.

   Name              Process privileges
     |                       |
     V                       V
   Object -> Permissions -> Allow?

Plan 2: Mandatory Access Control (MAC).

Example: Ensure top-secret programs can't reveal classified information.

   Name    Operation + caller process
     |               |
     V               V
   Object --------> Allow?
                     ^
                     |
   Policy -----------+

Plan 3: Capabilities (Capsicum).

Race condition example:

    T1: mkdir(C1, "a/b/c")
    T1: C2 = openat(C1, "a")
    T1: C3 = openat(C2, "b/c/../..")   # should return a cap for /foo/a
        Let openat() run until it's about to look up the first ".."

    T2: renameat(C1, "a/b/c", C1, "d")

    T1: Look up the first "..", which goes to "/foo"
        Look up the second "..", which goes to "/"

Alternative capability designs: pure capability-based OS (KeyKOS, etc).

Linux capabilities: solving a different problem.

Using Capsicum in applications

Does Capsicum achieve its goals?

What applications wouldn't be a good fit for Capsicum?

References