# Information flow (information theory)

Information flow in an information theoretical context is the transfer of information from a variable $x$ to a variable $y$ in a given process. Not all flows may be desirable; for example, a system should not leak any confidential information (partially or not) to public observers—as it is a violation of privacy on an individual level, or might cause major loss on a corporate level.

## Introduction

Securing the data manipulated by computing systems has been a challenge in the past years. Several methods to limit the information disclosure exist today, such as access control lists, firewalls, and cryptography. However, although these methods do impose limits on the information that is released by a system, they provide no guarantees about information propagation. For example, access control lists of file systems prevent unauthorized file access, but they do not control how the data is used afterwards. Similarly, cryptography provides a means to exchange information privately across a non-secure channel, but no guarantees about the confidentiality of the data are given once it is decrypted.
In low level information flow analysis, each variable is usually assigned a security level. The basic model comprises two distinct levels: low and high, meaning, respectively, publicly observable information, and secret information. To ensure confidentiality, flowing information from high to low variables should not be allowed. On the other hand, to ensure integrity, flows to high variables should be restricted.
More generally, the security levels can be viewed as a lattice with information flowing only upwards in the lattice.
For example, considering two security levels $L$ and $H$ (low and high), if $L\leq H$, flows from $L$ to $L$, from $H$ to $H$, and $L$ to $H$ would be allowed, while flows from $H$ to $L$ would not.
Throughout this article, the following notation is used:
* variable $l\in L$ (low) shall denote a publicly observable variable
* variable $h\in H$ (high) shall denote a secret variable
Where $L$ and $H$ are the only two security levels in the lattice being considered.

## Explicit flows and side channels

Information flows can be divided in two major categories. The simplest one is explicit flow, where some secret is explicitly leaked to a publicly observable variable. In the following example, the secret in the variable h flows into the publicly observable variable l.
The other flows fall into the side channel category. For example, in the timing attack or in the power analysis attack, the system leaks information through, respectively, the time or power it takes to perform an action depending on a secret value.
In the following example, the attacker can deduce if the value of h is one or not by the time the program takes to finish:
Another side channel flow is the implicit information flow, which consists in leakage of information through the program control flow. The following program (implicitly) discloses the value of the secret variable h to the variable l. In this case, since the h variable is boolean, all the bits of the variable of h is disclosed (at the end of the program, l will be 3 if h is true, and 42 otherwise).

## Non-interference

Non-interference is a policy that enforces that an attacker should not be able to distinguish two computations from their outputs if they only vary in their secret inputs. However, this policy is too strict to be usable in realistic programs. The classic example is a password checker program that, in order to be useful, needs to disclose some secret information: whether the input password is correct or not (note that the information that an attacker learns in case the program rejects the password is that the attempted password is not the valid one).

## Information flow control

A mechanism for information flow control is one that enforces information flow policies. Several methods to enforce information flow policies have been proposed. Run-time mechanisms that tag data with information flow labels have been employed at the operating system level and at the programming language level. Static program analyses have also been developed that ensure information flows within programs are in accordance with policies.
Both static and dynamic analysis for current programming languages have been developed. However, dynamic analysis techniques cannot observe all execution paths, and therefore cannot be both sound and precise. In order to guarantee noninterference, they either terminate executions that might release sensitive information or they ignore updates that might leak information.
A prominent way to enforce information flow policies in a program is through a security type system: that is, a type system that enforces security properties. In such a sound type system, if a program type-checks, it meets the flow policy and therefore contains no improper information flows.

### Security type system

In a programming language augmented with a security type system every expression carries both a type (such as boolean, or integer) and a security label.
Following is a simple security type system from that enforces non-interference. The notation $\;\vdash exp\;:\;\tau$ means that the expression $exp$ has type $\;\tau$. Similarly, $[sc]\vdash C$ means that the command $C$ is typable in the security context $sc$.
$[E1-2]\quad \vdash exp:high\qquad {\frac {h\notin Vars(exp)}{\vdash exp\;:\;low}}$
$[C1-3]\quad [sc]\vdash {\textbf {skip}}\qquad [sc]\vdash h\;:=\;exp\qquad {\frac {\vdash exp\;:\;low}{[low]\vdash l\;:=\;exp}}$
$[C4-5]\quad {\frac {[sc]\vdash C_{1}\quad [sc]\vdash C_{2}}{[sc]\vdash C_{1}\;;\;C_{2}}}\qquad {\frac {\vdash exp\;:\;sc\quad [sc]\vdash C}{[sc]\vdash {\textbf {while}}\ exp\ {\textbf {do}}\ C}}$
$[C6-7]\quad {\frac {\vdash exp\;:\;sc\quad [sc]\vdash C_{1}\quad [sc]\vdash C_{2}}{[sc]\vdash {\textbf {if}}\ exp\ {\textbf {then}}\ C_{1}\ {\textbf {else}}\ C_{2}}}\qquad {\frac {[high]\vdash C}{[low]\vdash C}}$
Well-typed commands include, for example,
    $[low]\vdash \ {\textbf {if}}\ l=42\ {\textbf {then}}\ h\;:=\;3\ {\textbf {else}}\ l\;:=\;0$.
Conversely, the program
    $l\;:=\;0\ ;\ {\textbf {while}}\ l<h\ {\textbf {do}}\ l\;:=\;l+1$
is ill-typed, as it will disclose the value of variable $h$ into $l$.
Note that the rule $[C7]$ is a subsumption rule, which means that any command that is of security type $high$ can also be $low$. For example, $h:=1$ can be both $high$ and $low$. This is called polymorphism in type theory. Similarly, the type of an expression $exp$ that satisfies $h\notin Vars(exp)$ can be both $high$ and $low$ according to $[E1]$ and $[E2]$ respectively.

## Declassification

As shown previously, non-interference policy is too strict for use in most real-world applications. Therefore, several approaches to allow controlled releases of information have been devised. Such approaches are called information declassification.
Robust declassification requires that an active attacker may not manipulate the system in order to learn more secrets than what passive attackers already know.
Information declassification constructs can be classified in four orthogonal dimensions: what information is released, who is authorized to access the information, where the information is released, and when the information is released.

### What

A what declassification policy controls which information (partial or not) may be released to a publicly observable variable.
The following code example shows a declassify construct from. In this code, the value of the variable h is explicitly allowed by the programmer to flow into the publicly observable variable l.

### Who

A who declassification policy controls which principals (i.e., who) can access a given piece of information. This kind of policy has been implemented in the Jif compiler.
The following example allows Bob to share its secret contained in the variable b with Alice through the commonly accessible variable ab.

### Where

A where declassification policy regulates where the information can be released, for example, by controlling in which lines of the source code information can be released.
The following example makes use of the flow construct proposed in. This construct takes a flow policy (in this case, variables in H are allowed to flow to variables in L) and a command, which is run under the given flow policy.

### When

A when declassification policy regulates when the information can be released. Policies of this kind can be used to verify programs that implement, for example, controlled release of secret information after payment, or encrypted secrets which should not be released in a certain time given polynomial computational power.

### Declassification approaches for implicit flows

An implicit flow occurs when code whose conditional execution is based on private information updates a public variable. This is especially problematic when multiple executions are considered since an attacker could leverage the public variable to infer private information by observing how its value changes over time or with the input.

#### The naïve approach

The naïve approach consists on enforcing the confidentiality property on all variables whose value is affected by other variables. This method leads to partially leaked information due to on some instances of the application a variable is Low and in others High.

#### No sensitive upgrade

"No sensitive upgrade" halts the program whenever a High variable affects the value of a Low variable. Since it simply looks for expressions where an information leakage might happen, without looking at the context, it may halt a program that, despite having potential information leakage, never actually leaks information.
In the following example x is High and y is Low.
In this case the program would be halted since—syntactically speaking—it uses the value of a High variable to change a Low variable, despite the program never leaking information.

#### Permissive upgrade

Permissive-upgrade introduces an extra security class P which will identify information leaking variables. When a High variable affects the value of a Low variable, the latter is labeled P. If a P labeled variable affects a Low variable the program would be halted. To prevent the halting the Low and P variables should be converted to High using a privatization function to ensure no information leakage can occur. On subsequent instances the program will run without interruption.

#### Privatization inference

Privatization inference extends permissive upgrade to automatically apply the privatization function to any variable that might leak information. This method should be used during testing where it will convert most variables. Once the program moves into production the permissive-upgrade should be used to halt the program in case of an information leakage and the privatization functions can be updated to prevent subsequent leaks.

## Application in computer systems

Beyond applications to programming language, information flow control theories have been applied to operating systems, distributed systems, and cloud computing.