Section 21.12

Flask: separating security policy from enforcement mechanisms

Full name: Flux Advanced Security Kernel.

What it is

Flask is a security architecture for operating systems: a plan for where security decisions are made and where they are enforced. Ray Spencer, Stephen Smalley, Peter Loscocco, Mike Hibler, David Andersen and Jay Lepreau published it in 1999. One component, the security server, makes every access decision from a replaceable security policy. The components that provide services, such as files or message channels, enforce those decisions and keep a cache of them. Flask aims to support many different policies, including policies that change and must withdraw access already granted.

Basis of this account

This account rests on the paper “The Flask Security Architecture: System Support for Diverse Security Policies”, in the proceedings of the 8th USENIX Security Symposium, Washington, D.C., 23 to 26 August 1999. USENIX is the name of the Advanced Computing Systems Association, which hosts the paper (https://www.usenix.org/legacy/events/sec99/full_papers/spencer/spencer.pdf). Ray Spencer was at Secure Computing Corporation, Stephen Smalley and Peter Loscocco at the National Security Agency (NSA) of the United States, and the other three authors at the University of Utah. The name stands for Flux Advanced Security Kernel, after the Flux research group at Utah; the paper does not spell it out, and the expansion is the title of the project’s page at Utah.

The abstract, Sections 1 and 2, Sections 5.4 and 5.5 and Section 6.2 were read in full. Sections 3 to 5.3 and Section 6.1 were read in part, and the appendix on the individual servers was not read. The paper places the detailed message protocol for policy changes in a report of Secure Computing Corporation, which was not read either. Nothing was run or measured for this account.

What the paper claims

The authors make these claims.

How it works

The architecture has these parts.

For a controlled operation, the microkernel gives the object manager the client’s SID together with the request, so the SID comes from the kernel, not from the client’s own claim. The object manager determines the object’s SID and the permission needed, and asks its AVC about the triple (client SID, object SID, permission). On a miss, the AVC asks the security server and stores the access vector it returns. The object manager then performs the operation or refuses it.

Later standards give these roles names. RFC 2753, a framework for policy-based admission control §19.4.5 in networks [449], and the XACML (eXtensible Access Control Markup Language) standard [450] call the component that decides a policy decision point (PDP), and the component that intercepts a request and applies the decision a policy enforcement point (PEP). XACML adds a policy administration point (PAP), where policies are written and managed. In Flask the security server is the PDP, every object manager is a PEP, and the AVC is a cache of PDP answers kept at the PEP. The paper expects most security servers also to load and change the policy, and requires a security server that offers such an interface to control which subjects may use it, so the administration role sits in the security server as well. This mapping is this account’s; the paper does not use these names.

A policy change is the hard part, because every AVC holds explicit copies of earlier decisions and every object manager may hold implicit copies, the migrated permissions. The paper places two requirements on object managers. Once a change is complete, no operation that needs a revoked permission may run until a later change grants it again. And each object manager completes a change promptly, without being blocked indefinitely by its clients. The change follows a three-step protocol.

  1. The security server notifies every object manager that may have received any part of the changed policy.

  2. Each object manager updates its state. Its AVC updates the cached entries first, then calls the revocation routines that the object manager registered, which revoke migrated permissions.

  3. Each object manager tells the security server that the change is complete. The security server treats the change as done only when every affected object manager has reported.

Sequence numbers order the messages that deliver decisions relative to the messages that announce changes. The last step lets a policy demand an order, for example that certain permissions be revoked before new ones are granted.

In the prototype, complete revocation routines exist only in the microkernel, which updates its AVC and then examines thread and memory state. Two properties of Fluke, the Utah research microkernel from which the prototype was derived, made this simpler: Fluke exports the complete state of a thread promptly, and every kernel operation is atomic or divided into atomic stages, so a permission check and the service it guards happen inside one atomic operation §9.8. The file server revokes permissions recorded in open-file descriptions but cannot interrupt operations in progress.

Worked example

The first part uses the paper’s own measurements, from its Table 3, taken on a 200 megahertz Pentium Pro processor. The operation is a null message round trip between a client and a server, which transfers a minimal 8-byte message and therefore shows the largest relative cost of a check.

Asking the security server on every check would make this operation about 82.5/13.5≈6.182.5 / 13.5 \approx 6.1 times as slow as without security. That is why the architecture caches decisions, and why it then needs a revocation protocol.

The second part is invented to show the revocation steps. A file server’s AVC says that process P, with SID 7, may read and write file F, with SID 12. P opened F for writing earlier, and the file server recorded write access in P’s open-file description. P is now in the middle of writing 4 MiB to F when an administrator changes the policy so that SID 7 may no longer write to SID 12; the security server numbers this change 42.

  1. The file server’s AVC removes write from the entry (7, 12). A new attempt by P to open F for writing now fails.

  2. P’s writes through its open-file description are not checked against the AVC. The file server’s revocation routine must find that description and remove its write right, or P keeps writing.

  3. The 4 MiB write has already passed its check. The file server aborts it with an error, or restarts it so that the check runs again and fails. Waiting for it to finish is safe only if the write cannot stall.

  4. Only now does the file server report change 42 complete.

One race remains. Just before the change, another object manager asked the security server about (7, 12), and the reply, computed under the old policy, arrives after that manager has processed change 42. If its AVC stored the reply, it would grant write again. A simple rule closes the gap: tag each reply with the number of the latest change it reflects, here 41, and refuse to cache a reply whose number is lower than the latest change already processed, here 42. The paper says that sequence numbers handle this kind of interleaving and leaves the details to its companion report; the rule here is an illustration.

What this account does not establish

The evidence is one research prototype, measured in 1999. The paper reports the cost of revocation only for the most expensive microkernel case, revoking message connections: 1.55 milliseconds with one connection and 1.65 milliseconds with 16, mostly spent stopping all threads in the system. The authors state that the speed of policy changes was not a major consideration.

Revocation is complete only in the microkernel. The paper states that the file server cannot interrupt operations in progress. The architecture states what each object manager must do; the paper does not show that every object manager does it.

Flask does not establish complete mediation §1.16, the requirement that every access to a protected object is checked. The authors note that flexibility depends on the completeness of the set of controlled operations and on how much of the system state the policy can see. Choosing the controlled operations is left to the designer of each object manager.

Effective atomicity rests on timeliness: object managers cannot be blocked indefinitely by their clients, the microkernel delivers messages between the security server and object managers promptly, and the scheduler gives object managers processor time. A component that breaks one of these delays the point at which a change takes effect.

Flask controls how decisions are cached and withdrawn. It does not judge the policy: a wrong policy is enforced faithfully.

SELinux (Security-Enhanced Linux), released later by the NSA, implements the Flask architecture in Linux; the Linux Security Modules §21.14 paper of 2002 calls it a Linux implementation of Flask [217]. This account says nothing about how SELinux handles revocation.

Questions answered

Why is revocation harder with cached decisions?

Revocation is harder with cached decisions because each cached decision is a copy of the policy’s answer that keeps saying allow after the policy has changed, and the component that changed the policy cannot erase that copy on its own. The component that decides, the decision point, changes its rules; every component that enforces, an enforcement point, keeps acting on what it stored. The Flask paper of Spencer and colleagues (1999) names three forms of copy:

Withdrawing access therefore needs a protocol, not only an update of the stored policy.

  1. The decision point notifies every enforcement point that may hold part of the changed policy.

  2. Each enforcement point performs its cache invalidation §14.21, revokes the migrated permissions, and aborts or restarts the affected operations in progress; waiting for them is safe only if they cannot stall.

  3. Each enforcement point confirms, and the change counts as effective only when all have confirmed.

  4. Answers computed under the old policy that arrive late are recognized, for example by sequence numbers, and are not cached.

Without a cache, every check would consult the current policy, but Flask’s measurements show the price: a minimal message round trip took 82.5 microseconds when the security server computed each decision, against 13.8 to 14.4 microseconds when the decision was already in the cache.

Related entries: Key revocation (§5.32), Policy versus mechanism (§1.19), Reference monitor (§1.17), Complete mediation (§1.16), Cache invalidation (§14.21), Capability security (§1.40), Hydra: policy flexibility above protected mechanisms (§21.13), Linux Security Modules: an enforcement-hook framework (§21.14). Further reading: [215, 217, 449, 450].