Section 1.41

Information-flow control

Definition

Information-flow control (IFC) is a security mechanism that controls where information may go inside a program and out of it. It gives every input, variable and output a security label, such as secret or public, and lets a value reach a destination only if the policy permits flow from the value’s label to the destination’s label. Access control §1.7 decides who may read data; IFC also governs what a program does with data after reading it, including flows through the program’s decisions.

The idea

A phone app may read the contacts list and may use the network. Access control approves both, and nothing in access control stops the app from sending the contacts list over the network. The question that matters is whether the data can influence what leaves the device. Information can also leave without being copied: a program that prints “yes” when a secret bit is 1 and “no” when it is 0 never copies the bit, yet its output reveals the bit exactly.

IFC treats secret data like dye in water. A value computed from a secret carries the secret’s label, as water mixed with dyed water is dyed, and a public output may receive only clear water. The picture covers explicit flows, in which a secret is copied or computed into a result. It stops at implicit flows: information also travels through which way a decision went, although no dyed water moves. An IFC system must track both.

How it works

  1. Labels. The policy gives each input and output a label and orders the labels by how restricted they are. With two labels, public below secret, information may flow from public to secret but not from secret to public. With more labels the order is a lattice §19.2.6: an ordering in which any two labels have a least upper bound, the lowest label that both may flow to, and likewise a greatest lower bound. Dorothy Denning proposed this lattice model in 1976 [422]. For example, Alice’s data and Bob’s data may each flow to a destination labeled with both names, but not into each other’s.

  2. Explicit flows. A result computed from several values gets the least upper bound, also called the join, of their labels. After y := x + z, the label of y must be at least the join of the labels of x and z.

  3. Implicit flows. The enforcement keeps a context label, written pc\mathrm{pc} after the program counter. Inside a branch or loop whose condition depends on a secret, the context label is secret, and every assignment made there also counts as a flow from the context.

  4. The rule. An assignment y := e made in context pc\mathrm{pc} is allowed only if the join of the label of e and pc\mathrm{pc} may flow to the label of y. An output counts as an assignment to a destination with a fixed label.

Enforcement is static or dynamic. A static checker, often written as a type system, examines the program before it runs and rejects it if any run could break the rule. A dynamic monitor attaches labels to values while the program runs and stops a forbidden flow when it happens. A monitor sees only the branch that runs, which leaves a gap. In y := 0; if (s) y := 1; with public y and secret s, the run with s=0s = 0 assigns nothing inside the branch, yet the final y=0y = 0 reveals s=0s = 0. Monitors close the gap with a rule called no sensitive upgrade: stop the program when a public variable is assigned inside a secret context. The stop itself is visible to an observer who sees whether the program finished, so this rule protects only the outputs of runs that finish. Taint analysis §3.19, a lighter relative of IFC, usually follows explicit flows only and so misses implicit flows.

Every IFC system states which observations it covers, and the usual choice is the values of public outputs. A secret can also show in how long a computation takes, whether it finishes, which error it raises, the size and number of messages it sends, and the state it leaves in shared hardware such as caches; information carried in such a way is a side channel §1.29. A guarantee that covers output values says nothing about these channels.

Worked example

Let SS be a secret bit, 0 or 1, and YY a public output. Each program below runs once with S=0S = 0 and once with S=1S = 1; it leaks when the two runs look different to a public observer.

  1. Y := S. The outputs are 0 and 1: an explicit flow. The rule rejects the program, because SS is secret and secret may not flow to public.

  2. if S = 0 then Y := 0 else Y := 1. Both assignments copy constants, yet the outputs are again 0 and 1: an implicit flow. The rule rejects the program: inside the branch pc\mathrm{pc} is secret, the join of public (the constant) and secret is secret, and secret may not flow to YY. A checker that tracks only explicit flows accepts the program.

  3. Y := 0, followed, when S=1S = 1, by a loop that does 4 extra time units of work. Both runs output 0, after 5 and 9 time units. The value is clean, and the timing reveals SS. The rule accepts the program, because the loop assigns no public variable; only a guarantee that covers timing rejects it.

A verdict can leak through both channels. A checker compares a 16-byte guess with a 16-byte secret byte by byte and answers “reject” at the first byte that differs. The verdict reveals one fact, match or no match, which the checker exists to reveal. The time reveals more: a guess whose first byte is right takes longer to reject than one whose first byte is wrong. An attacker who can measure the time tries the 256 values of the first byte until the time grows, then the second byte, and so on. That takes at most 16×256=409616 \times 256 = 4096 guesses, each repeated often enough to average out timing noise, against up to 21282^{128}, about 3.4×10383.4 \times 10^{38}, guesses without the timing. A constant-time comparison §4.33, which always examines all 16 bytes, closes this channel.

Stated precisely

Let the labels form a lattice with order ⊑\sqsubseteq, read “may flow to”, and join ⊔\sqcup, the least upper bound. Write ℓ(x)\ell(x) for the label of variable xx, and ℓ(e)\ell(e) for the join of the labels of the variables in expression ee. The rule for an assignment x:=ex := e in context pc\mathrm{pc} is ℓ(e)⊔pc⊑ℓ(x),\ell(e) \sqcup \mathrm{pc} \sqsubseteq \ell(x), and entering a branch or loop whose condition is bb raises the context to pc⊔ℓ(b)\mathrm{pc} \sqcup \ell(b).

The guarantee an IFC system aims at is noninterference §1.42: two runs whose inputs agree on everything an observer is allowed to see produce observations that this observer cannot tell apart. Volpano, Irvine and Smith (1996) [423] proved that type rules of this kind give that guarantee in a small imperative language, for the final values of public variables, over pairs of runs that both finish. Such a guarantee depends on four named assumptions.

Limits and common mistakes

Memory isolation is not IFC. A bounds check stops a program from reading outside its own memory; it does not stop the program from sending out a secret it may legitimately read.

Implicit-flow rules are conservative. Values computed inside secret branches become secret, the label spreads, and useful public outputs are rejected. Designers then declassify, and each declassification must be justified by the policy.

Concurrency §9.1 adds channels. With several threads, a secret-dependent delay in one thread can change the order in which another thread writes a public variable, so a timing difference becomes a value difference. Guarantees proved for sequential programs do not carry over.

Exceptions and faults are control flow. An error raised only for some secret values is an implicit flow, covered only if the model includes errors.

The same machinery protects integrity §1.9 when trust labels replace secrecy labels: an untrusted value must not influence a trusted decision. The flow to forbid then runs from untrusted to trusted, and a secrecy guarantee says nothing about it.

Questions answered

Can secret input influence a public timing or verdict channel?

Yes: secret input can influence both a public verdict and public timing, and memory isolation prevents neither. A verdict, any public result such as accept or reject, depends on the secret explicitly when it is computed from the secret, and implicitly when the secret decides which branch produces it. Timing depends on the secret whenever the amount of work does, as when a comparison stops at the first byte that differs.

Information-flow control (IFC) handles the verdict by labeling the secret and the public outputs and rejecting every explicit and implicit flow from secret to public that the policy does not permit. Two points decide whether a given system prevents the influence. First, a verdict is usually meant to reveal something, as a password check reveals match or no match; that release must be declared as a declassification and limited to exactly that fact. Second, most IFC systems cover output values only. Timing is covered only if the guarantee names it, and otherwise needs separate measures such as constant-time code, which does the same work whatever the secret.

Related entries: Noninterference (§1.42), Declassification (§1.43), Side channel (§1.29), Taint analysis (§3.19), Constant-time comparison (§4.33), Partial order, lattice, join, and meet (§19.2.6). Further reading: [422, 423].