Algorithm Search⌘K

Algorithmresearch

Secure multi-execution

Also called SME.

Runs a program once per security level and gives each run only the inputs it may see. This gives termination-sensitive noninterference and keeps each ending run of a TSNI program.

Time
O(k (t n + v)) worst
Space
O(k v + n) extra
Where
k = the number of distinct levels of the variables; n = the number of nodes of the syntax tree of the program; t = the largest number of steps of one copy; v = the number of variables
Properties
completedeterministicofflineiterativesound
Origin
Dominique Devriese, Frank Piessens, 2010

Secure multi-execution (SME) enforces noninterference by running the program several times, once for each security level. The copy at level kk gets the true value of each input that kk may see and a fixed default value for every other input, and only this copy may produce the outputs of level kk. So a public output is computed from public inputs only, whatever the program does. Devriese and Piessens (2010) proved that SME is termination-sensitive noninterferent (TSNI) for every program, and that it does not change the ending runs of a program that is already TSNI. The price is one run for each level.

In plain words

Suppose a program reads a secret and a public number and writes a public result. You cannot know if the program leaks the secret into the result. So you do not ask. You run the program twice. The first copy gets the public number and a fake secret, for example 0, and you take only its public result. The second copy gets the real inputs, and you take only its secret results. The public result cannot depend on the real secret, because the copy that made it never saw the secret. If the program does not leak, both copies agree on everything public, and you lose nothing. If it leaks, the public result is the one computed from the fake secret. The cost is that you run the program once for each level.

The problem

The input is a program cc in a small while language, a security lattice (L,≤,⊔,⊓)(\mathcal{L}, \le, \sqcup, \sqcap) in which ℓ1≤ℓ2\ell_1 \le \ell_2 means that information may flow from ℓ1\ell_1 to ℓ2\ell_2, a level Γ(x)\Gamma(x) for each variable, an initial store ss and a default value dd. The initial values are the inputs and the final values are the outputs; the output on xx is visible to an observer at level ℓ\ell if Γ(x)≤ℓ\Gamma(x) \le \ell. Write [ ⁣[c] ⁣](s)[\![c]\!](s) for the final store of the plain run, or ⊥\bot if it does not end.

The output is a value or "no output" for each variable, such that:

  • Soundness. For each level ℓ\ell and each two stores that agree on the inputs of level at most ℓ\ell, the observer at ℓ\ell sees the same outputs, including the same "no output".
  • Precision. If cc is TSNI and the plain run ends, the outputs are those of the plain run.

TSNI is defined on the page TINI.

The algorithm

  1. SME(c, s, Γ, d) ▷ an output or ⊥ for each variable
  2. 1K ← the levels Γ(x), each level after the levels below it
  3. 2for each k in K do
  4. 3s_k ← the store with s_k(x) = s(x) if Γ(x) ≤ k, and d otherwise
  5. 4t_k ← the plain run of c from s_k ▷ ⊥ if it does not end
  6. 5for each variable x do
  7. 6t ← t_Γ(x)
  8. 7out(x) ← ⊥ if t = ⊥, and t(x) otherwise
  9. 8return out

Line L3 is the whole defense. The copy at level kk cannot read an input above kk, because it has the default value in its place. Line L6 takes each output from the copy of its own level, and no other copy may produce it. No line of the algorithm looks at the program or its labels during the run, so explicit flows, implicit flows and flows through termination are all cut in the same way. Line L1 runs the lower copies first, so that a higher copy that does not end cannot delay a lower one. The copies are independent, and they can also run at the same time.

Example

Take the diamond lattice ⊥≤A,B≤A⊔B\bot \le A, B \le A \sqcup B, with Γ(x)=⊥\Gamma(x) = \bot, Γ(y)=A\Gamma(y) = A, Γ(z)=B\Gamma(z) = B, Γ(w)=A⊔B\Gamma(w) = A \sqcup B, the default value d=0d = 0, the initial store (x,y,z,w)=(1,2,3,4)(x, y, z, w) = (1, 2, 3, 4) and the program

y:=y+z; w:=y+z; x:=w.y := y + z;\ w := y + z;\ x := w.

The program is not secure: it copies zz into yy, although AA and BB are not comparable, and it copies ww into the public xx.

copy kk input (x,y,z,w)(x, y, z, w) final (x,y,z,w)(x, y, z, w) output taken
⊥\bot (1,0,0,0)(1, 0, 0, 0) (0,0,0,0)(0, 0, 0, 0) x=0x = 0
AA (1,2,0,0)(1, 2, 0, 0) (2,2,0,2)(2, 2, 0, 2) y=2y = 2
BB (1,0,3,0)(1, 0, 3, 0) (6,3,3,6)(6, 3, 3, 6) z=3z = 3
A⊔BA \sqcup B (1,2,3,4)(1, 2, 3, 4) (8,5,3,8)(8, 5, 3, 8) w=8w = 8

SME gives (x,y,z,w)=(0,2,3,8)(x, y, z, w) = (0, 2, 3, 8). The plain run is the last copy and gives (8,5,3,8)(8, 5, 3, 8). The public xx is now 0 for every value of yy, zz and ww, and yy no longer depends on zz. The top output ww is unchanged, because the top copy sees all inputs.

Correctness

The proof below shows two theorems for the batch form on this page, where the inputs are the initial store and the outputs are the final store.

Theorem 1 (soundness). Hypotheses: the plain semantics is deterministic. Statement: for every program cc, every level ℓ\ell and every two stores s,s′s, s' that agree on each input of level at most ℓ\ell, the outputs of SME of level at most ℓ\ell are equal, and either both are "no output" or both are the same value. The reason: an output xx with Γ(x)=k≤ℓ\Gamma(x) = k \le \ell comes from the copy at kk, whose input by line L3 is the same for ss and s′s'.

Theorem 2 (precision). Hypotheses: cc is TSNI at each level. Statement: if the plain run from ss ends in tt, SME gives tt. The reason: ss and sks_k agree on the inputs of level at most kk, so by TSNI the copy at kk ends and agrees with tt on each variable of level kk.

These are Theorems 1 and 2 of Devriese and Piessens, who prove them for programs with input and output channels during the run. The hypothesis of Theorem 2 cannot be weakened to TINI (Pitfalls).

Proof: Secure multi-execution is termination-sensitive noninterferent and precisefull

We use the language and the pseudocode of the page. Levels are in a finite lattice (L,≤,⊔,⊓)(\mathcal{L}, \le, \sqcup, \sqcap), and Γ(x)\Gamma(x) is the level of variable xx. The plain semantics is deterministic: [ ⁣[c] ⁣](s)[\![c]\!](s) is the final store of the run of cc from ss, or ⊥\bot if the run does not end. For a store ss and a level kk, let sks_k be the store of line L3: sk(y)=s(y)s_k(y) = s(y) if Γ(y)≤k\Gamma(y) \le k, and sk(y)=ds_k(y) = d otherwise, with dd the fixed default value. Let SME(s)\mathrm{SME}(s) be the result of the page, with SME(s)(x)=⊥\mathrm{SME}(s)(x) = \bot when the copy for xx does not end.

What the observer sees. An observer at level ℓ\ell sees the output SME(s)(x)\mathrm{SME}(s)(x) for each xx with Γ(x)≤ℓ\Gamma(x) \le \ell; the value ⊥\bot is the observation "no output". Two stores are ℓ\ell-equivalent, s=ℓs′s =_\ell s', if they agree on each yy with Γ(y)≤ℓ\Gamma(y) \le \ell. For final results, ⊥=ℓ⊥\bot =_\ell \bot, and ⊥\bot is not ℓ\ell-equivalent to a store.

The code computes this result. Line L1 lists each level that occurs as Γ(x)\Gamma(x). The loop of lines L2 to L4 runs cc once from sks_k for each such level, and stores tk=[ ⁣[c] ⁣](sk)t_k = [\![c]\!](s_k). The loop of lines L5 to L7 sets out(x)\mathrm{out}(x) to tΓ(x)(x)t_{\Gamma(x)}(x), or to ⊥\bot when tΓ(x)=⊥t_{\Gamma(x)} = \bot. The level Γ(x)\Gamma(x) is in the list of line L1, so tΓ(x)t_{\Gamma(x)} is defined. So SME(s)(x)=[ ⁣[c] ⁣](sΓ(x))(x)\mathrm{SME}(s)(x) = [\![c]\!](s_{\Gamma(x)})(x), read as ⊥\bot when the run does not end.

Lemma 1. If k≤ℓk \le \ell and s=ℓs′s =_\ell s', then sk=sk′s_k = s'_k.

Proof. Take a variable yy. If Γ(y)≤k\Gamma(y) \le k, then Γ(y)≤ℓ\Gamma(y) \le \ell, so sk(y)=s(y)=s′(y)=sk′(y)s_k(y) = s(y) = s'(y) = s'_k(y). Otherwise both values are dd.

Theorem 1 (soundness). For every program cc, every level ℓ\ell and every two stores s=ℓs′s =_\ell s': for each xx with Γ(x)≤ℓ\Gamma(x) \le \ell, SME(s)(x)=SME(s′)(x)\mathrm{SME}(s)(x) = \mathrm{SME}(s')(x). So the observer at ℓ\ell sees the same outputs, and in particular sees "no output" in one run exactly when it does in the other. SME is termination-sensitive noninterferent.

Proof. Let k=Γ(x)≤ℓk = \Gamma(x) \le \ell. By Lemma 1, sk=sk′s_k = s'_k. The plain semantics is deterministic, so [ ⁣[c] ⁣](sk)=[ ⁣[c] ⁣](sk′)[\![c]\!](s_k) = [\![c]\!](s'_k): both are ⊥\bot, or both are the same store. In both cases SME(s)(x)=SME(s′)(x)\mathrm{SME}(s)(x) = \mathrm{SME}(s')(x).

Theorem 2 (precision). Let cc be termination-sensitive noninterferent for each level: for each kk and each two stores s=ks′s =_k s', [ ⁣[c] ⁣](s)=k[ ⁣[c] ⁣](s′)[\![c]\!](s) =_k [\![c]\!](s'). Then for every store ss with [ ⁣[c] ⁣](s)=t≠⊥[\![c]\!](s) = t \ne \bot, SME(s)=t\mathrm{SME}(s) = t.

Proof. Take a variable xx and let k=Γ(x)k = \Gamma(x). The stores ss and sks_k agree on each yy with Γ(y)≤k\Gamma(y) \le k, so s=ksks =_k s_k. By the hypothesis, [ ⁣[c] ⁣](sk)=kt[\![c]\!](s_k) =_k t. Since t≠⊥t \ne \bot, also [ ⁣[c] ⁣](sk)≠⊥[\![c]\!](s_k) \ne \bot, and the two final stores agree on xx, because Γ(x)=k≤k\Gamma(x) = k \le k. So SME(s)(x)=[ ⁣[c] ⁣](sk)(x)=t(x)\mathrm{SME}(s)(x) = [\![c]\!](s_k)(x) = t(x).

If [ ⁣[c] ⁣](s)=⊥[\![c]\!](s) = \bot and cc is as in Theorem 2, the same argument shows that each copy does not end, so SME(s)(x)=⊥\mathrm{SME}(s)(x) = \bot for every xx, as for the plain run.

The bound on steps. The code replaces "does not end" by "does not end within the fuel bound". Theorem 1 holds for this semantics with the same proof, because a run with a step bound is still deterministic. Theorem 2 holds for it when cc is termination-sensitive noninterferent for the semantics with the step bound.

The hypothesis of Theorem 2 is needed. The program "while h=0h = 0 do skip; l:=1l := 1" is termination-insensitive noninterferent but not termination-sensitive. From h=1h = 1 the plain run ends with l=1l = 1, but the public copy sees h=d=0h = d = 0 and does not end, so SME(s)(l)=⊥\mathrm{SME}(s)(l) = \bot. ■\blacksquare

Complexity

The model is the word-RAM. Let kk be the number of distinct levels in Γ\Gamma, tt the largest number of steps of one copy, nn the number of nodes of the syntax tree and vv the number of variables. Line L3 takes O(v)O(v) time for each level, and a copy of tt steps takes O(tn)O(t n) time, since each step evaluates at most one expression of size at most nn. Line L1 sorts k≤vk \le v levels. The time is O(k(tn+v))O(k (t n + v)): about kk times the plain run. Only the levels that occur in Γ\Gamma need a copy, not every level of the lattice. The stores of the copies take O(kv)O(k v) space and the stack of one run O(n)O(n), so the extra space is O(kv+n)O(k v + n). A version that keeps only the outputs of each copy needs less.

Properties

  • Sound for TSNI. Every program, secure or not, gives TSNI outputs (Theorem 1). This is stronger than the TINI guarantee of no-sensitive-upgrade and of the security type system.
  • Precise for TSNI programs. A TSNI program gives the same outputs as its plain run, also when that run does not end (Theorem 2 and the proof). There are no false alarms on such programs, and the property "complete" above means this.
  • Not transparent for TINI programs. A TINI program that is not TSNI can lose its public outputs (Pitfalls).
  • A black box. SME does not read the program. It needs only a way to run it and to control its inputs and outputs, so it works for any language and for code known only at run time.
  • Cost. One run for each level, in time or in parallel hardware.

Variants and improvements

  • Interactive programs. In the original form, the inputs and outputs are channels with levels, read and written during the run. The copy at level kk reads the inputs of levels at most kk and gets the default value for the others, and only the copy at level kk writes to the outputs of level kk. An input of a low level is read once and given to each higher copy that needs it. Devriese and Piessens also discuss the timing channel and the choice of a scheduler for the copies; this page does not model time.
  • Shadow executions. Capizzi et al. (2008) run a public and a private copy of a process, which is the two-level case.
  • Browsers. FlowFox (De Groef et al. 2012) runs the JavaScript of a web page with SME, to enforce information flow policies on the scripts of the page.
  • Faceted execution. Faceted execution simulates the copies in one run: it keeps a value for each level only where the copies differ. Bielova and Rezk (2016) compare the two and show that they do not give the same guarantees in general.
  • Declassification. Later work lets a release of selected data from a high copy to a low copy, so that SME can work with a declassification policy.

When to use it

Use SME when you cannot change or analyze the program, false alarms are not acceptable, and you can pay for one run per level, for example for scripts of a few origins in a browser. Use the security type system when the program is known in advance and TINI is enough. Use no-sensitive-upgrade when one run is all you can pay for and a stop is acceptable. Use faceted execution when most of the program does not depend on secrets, so that most of the work is shared. SME does not help when a public output is meant to depend on a secret, such as the result of a password check; the low copy computes it from the default value.

Pitfalls

  • The true inputs at line L3. A copy that gets ss itself, and not sks_k, computes the public outputs from the secrets, and "l:=hl := h" leaks. The right line L3 replaces each input above kk by the default value.
  • The wrong copy at line L6. Taking all outputs from the top copy gives the plain run, with all its leaks. Taking an output from a copy above its level leaks too. The right line L6 takes the output on xx from the copy at Γ(x)\Gamma(x).
  • A high copy first at line L1. If the copies run one after the other and the high copy runs first and does not end, the low copy never runs. Then the public output exists or not depending on the secret. The right line L1 runs the lower copies first, or the copies run side by side.
  • Expecting the plain result from a TINI program. For "while h=0h = 0 do skip; l:=1l := 1" and h=1h = 1, the plain run gives l=1l = 1, but the public copy sees h=d=0h = d = 0 and does not end, so SME gives no public output. This is correct for TSNI and is not a bug.
  • A default value that depends on the secret. The default value dd at line L3 must be fixed in advance. A default value computed from the real input is the real input under another name.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

secure_multi_execution.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/secure-multi-execution/. The authors are listed in prov/5EGZEC.jsonl.

"""Secure multi-execution (SME) of a small while language.

Programs are nested tuples:

    expression: an int (a constant), a str (a variable), or (op, e1, e2)
                with op one of "+", "-", "*", "<", "=="
    command:    ("skip",)
                ("assign", x, e)
                ("seq", c1, c2)
                ("if", e, c1, c2)
                ("while", e, c)

Values are integers modulo MOD. A nonzero value is true. A level is a
frozenset of category names, ordered by inclusion. The inputs of a run
are the initial values of the variables, and the outputs are the final
values; the output on a variable x is visible at level gamma[x].
"""

from typing import Optional, Union

Level = frozenset
Expr = Union[int, str, tuple]
Cmd = tuple
Store = dict[str, int]

MOD = 256


def evaluate(e: Expr, s: Store) -> int:
    """Return the value of e in the store s.

    Precondition: every variable of e is a key of s.
    Cost: O(size of e). Uses an explicit stack, no recursion.
    """
    values: list[int] = []
    work: list[tuple[bool, Expr]] = [(False, e)]
    while work:
        done, f = work.pop()
        if done:
            b = values.pop()
            a = values.pop()
            op = f[0]
            if op == "+":
                values.append((a + b) % MOD)
            elif op == "-":
                values.append((a - b) % MOD)
            elif op == "*":
                values.append((a * b) % MOD)
            elif op == "<":
                values.append(int(a < b))
            elif op == "==":
                values.append(int(a == b))
            else:
                raise ValueError(f"unknown operator {op!r}")
        elif isinstance(f, int):
            values.append(f % MOD)
        elif isinstance(f, str):
            values.append(s[f])
        else:
            work.append((True, f))
            work.append((False, f[2]))
            work.append((False, f[1]))
    return values[0]


def run(c: Cmd, s: Store, fuel: int = 10_000) -> Optional[Store]:
    """Run c on a copy of s. Return the final store, or None after fuel steps.

    Precondition: every variable of c is a key of s.
    Cost: at most fuel steps, each O(1) plus the cost of its expression.
    """
    s = dict(s)
    work: list[Cmd] = [c]
    while work:
        fuel -= 1
        if fuel < 0:
            return None
        d = work.pop()
        tag = d[0]
        if tag == "skip":
            continue
        if tag == "assign":
            s[d[1]] = evaluate(d[2], s)
        elif tag == "seq":
            work.append(d[2])
            work.append(d[1])
        elif tag == "if":
            work.append(d[2] if evaluate(d[1], s) != 0 else d[3])
        elif tag == "while":
            if evaluate(d[1], s) != 0:
                work.append(d)
                work.append(d[2])
        else:
            raise ValueError(f"unknown command {tag!r}")
    return s


def sme(c: Cmd, s: Store, gamma: dict[str, Level], default: int = 0, fuel: int = 10_000) -> dict[str, Optional[int]]:
    """Run c once per level and give each output from the copy of its level.

    The copy at level k sees the true input of x when gamma[x] <= k, and
    the default value otherwise. The output on x comes from the copy at
    level gamma[x]; it is None when that copy does not end within fuel
    steps. The copies run one after the other, lowest level first.
    Precondition: the keys of gamma are the keys of s and hold every
    variable of c.
    Cost: one run of c per distinct level, so at most k times the cost of
    one run for k levels.
    """
    levels = sorted(set(gamma.values()), key=len)  # @line L1
    finals: dict[Level, Optional[Store]] = {}
    for k in levels:  # @line L2
        sk = {x: (s[x] if gamma[x] <= k else default) for x in s}  # @line L3
        finals[k] = run(c, sk, fuel)  # @line L4
    out: dict[str, Optional[int]] = {}
    for x in s:  # @line L5
        t = finals[gamma[x]]  # @line L6
        out[x] = None if t is None else t[x]  # @line L7
    return out  # @line L8
test_secure_multi_execution.py 230 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/secure-multi-execution/. The authors are listed in prov/5EGZEC.jsonl.

import itertools
import random

from secure_multi_execution import MOD, evaluate, run, sme

L = frozenset()
H = frozenset({"h"})
GAMMA = {"h": H, "l": L, "m": L}
VARS = ["h", "l", "m"]
DOMAIN = [0, 1, 2]
FUEL = 200


# Independent oracle: a recursive interpreter with the same step count.

class OutOfFuel(Exception):
    pass


def o_eval(e, s):
    if isinstance(e, int):
        return e % MOD
    if isinstance(e, str):
        return s[e]
    a, b = o_eval(e[1], s), o_eval(e[2], s)
    return {"+": (a + b) % MOD, "-": (a - b) % MOD, "*": (a * b) % MOD,
            "<": int(a < b), "==": int(a == b)}[e[0]]


def o_exec(c, s, fuel):
    fuel[0] -= 1
    if fuel[0] < 0:
        raise OutOfFuel
    tag = c[0]
    if tag == "assign":
        s[c[1]] = o_eval(c[2], s)
    elif tag == "seq":
        o_exec(c[1], s, fuel)
        o_exec(c[2], s, fuel)
    elif tag == "if":
        o_exec(c[2] if o_eval(c[1], s) else c[3], s, fuel)
    elif tag == "while":
        if o_eval(c[1], s):
            o_exec(c[2], s, fuel)
            o_exec(c, s, fuel)


def o_run(c, s, fuel=FUEL):
    s = dict(s)
    try:
        o_exec(c, s, [fuel])
    except OutOfFuel:
        return None
    return s


def o_sme_two_point(c, s):
    low_run = o_run(c, {"h": 0, "l": s["l"], "m": s["m"]})
    high_run = o_run(c, s)
    return {"h": None if high_run is None else high_run["h"],
            "l": None if low_run is None else low_run["l"],
            "m": None if low_run is None else low_run["m"]}


def stores():
    for vals in itertools.product(DOMAIN, repeat=len(VARS)):
        yield dict(zip(VARS, vals))


def low_in(s):
    return (s["l"], s["m"])


def low_out(r):
    # None stands for "no output": a run that does not end.
    return None if r is None else (r["l"], r["m"])


def is_tsni_plain(c):
    seen = {}
    for s in stores():
        out = low_out(o_run(c, s))
        if seen.setdefault(low_in(s), out) != out:
            return False
    return True


def is_tini_plain(c):
    seen = {}
    for s in stores():
        out = low_out(o_run(c, s))
        if out is None:
            continue
        if seen.setdefault(low_in(s), out) != out:
            return False
    return True


def sme_is_tsni(c):
    seen = {}
    for s in stores():
        r = sme(c, s, GAMMA, fuel=FUEL)
        out = (r["l"], r["m"])
        if seen.setdefault(low_in(s), out) != out:
            return False
    return True


def rand_expr(rng, depth=0):
    r = rng.random()
    if depth >= 2 or r < 0.35:
        return rng.choice(VARS)
    if r < 0.5:
        return rng.randrange(3)
    return (rng.choice(["+", "-", "*", "<", "=="]),
            rand_expr(rng, depth + 1), rand_expr(rng, depth + 1))


def rand_cmd(rng, budget):
    if budget <= 1:
        return ("assign", rng.choice(VARS), rand_expr(rng)), 1
    r = rng.random()
    if r < 0.35:
        return ("assign", rng.choice(VARS), rand_expr(rng)), 1
    if r < 0.4:
        return ("skip",), 1
    if r < 0.65:
        c1, n1 = rand_cmd(rng, budget // 2)
        c2, n2 = rand_cmd(rng, budget - n1)
        return ("seq", c1, c2), n1 + n2
    if r < 0.88:
        c1, n1 = rand_cmd(rng, (budget - 1) // 2)
        c2, n2 = rand_cmd(rng, max(1, budget - 1 - n1))
        return ("if", rand_expr(rng), c1, c2), 1 + n1 + n2
    c1, n1 = rand_cmd(rng, budget - 1)
    return ("while", rand_expr(rng), c1), 1 + n1


def seq(*cs):
    out = cs[-1]
    for c in reversed(cs[:-1]):
        out = ("seq", c, out)
    return out


def test_worked_example():
    # l := h; m := l + 1; h := h + m   with h = 2, l = 5, m = 7.
    prog = seq(("assign", "l", "h"), ("assign", "m", ("+", "l", 1)),
               ("assign", "h", ("+", "h", "m")))
    s = {"h": 2, "l": 5, "m": 7}
    assert run(prog, {"h": 0, "l": 5, "m": 7}) == {"h": 1, "l": 0, "m": 1}
    assert run(prog, s) == {"h": 5, "l": 2, "m": 3}
    assert sme(prog, s, GAMMA) == {"h": 5, "l": 0, "m": 1}


def test_implicit_flow_is_cut():
    prog = ("if", "h", ("assign", "l", 1), ("assign", "l", 0))
    for hv in DOMAIN:
        assert sme(prog, {"h": hv, "l": 9, "m": 0}, GAMMA)["l"] == 0
    assert sme_is_tsni(prog)


def test_termination_channel_is_closed():
    # The plain program leaks h = 0 through termination; SME does not.
    prog = seq(("while", ("==", "h", 0), ("skip",)), ("assign", "l", 1))
    assert not is_tsni_plain(prog)
    assert is_tini_plain(prog)
    assert sme_is_tsni(prog)
    # The low copy sees the default h = 0 and does not end, so SME gives no
    # public output even when the true run ends: SME is not transparent
    # for this TINI program.
    r = sme(prog, {"h": 1, "l": 0, "m": 0}, GAMMA, fuel=FUEL)
    assert run(prog, {"h": 1, "l": 0, "m": 0}, FUEL)["l"] == 1
    assert r["l"] is None and r["h"] == 1


def test_secure_program_is_unchanged():
    prog = seq(("assign", "h", ("+", "h", "l")), ("assign", "m", ("*", "l", 2)))
    for s in stores():
        assert sme(prog, s, GAMMA) == run(prog, s)


def test_only_public_variables():
    gamma = {"a": L, "b": L}
    prog = ("assign", "a", ("+", "a", "b"))
    assert sme(prog, {"a": 1, "b": 2}, gamma) == {"a": 3, "b": 2}


def test_diamond_lattice():
    a, b = frozenset({"a"}), frozenset({"b"})
    gamma = {"x": L, "y": a, "z": b, "w": a | b}
    prog = seq(("assign", "y", ("+", "y", "z")), ("assign", "w", ("+", "y", "z")),
               ("assign", "x", "w"))
    s = {"x": 1, "y": 2, "z": 3, "w": 4}
    r = sme(prog, s, gamma, default=0)
    # Copy a sees x, y; copy b sees x, z; copy a|b sees all.
    assert r == {"x": 0, "y": 2, "z": 3, "w": 8}


def test_evaluate():
    assert evaluate(("-", 1, 2), {}) == MOD - 1
    assert evaluate(("<", "x", 3), {"x": 2}) == 1


def test_deep_program_no_recursion():
    prog = ("assign", "l", 0)
    for _ in range(3000):
        prog = ("seq", ("assign", "l", ("+", "l", 1)), prog)
    assert sme(prog, {"h": 1, "l": 0, "m": 0}, GAMMA)["l"] == 0


def test_random_against_oracle_soundness_precision():
    rng = random.Random(2010)
    tsni_programs = 0
    for _ in range(500):
        prog, _n = rand_cmd(rng, rng.randint(1, 10))
        for s in stores():
            assert run(prog, s, FUEL) == o_run(prog, s)
            assert sme(prog, s, GAMMA, fuel=FUEL) == o_sme_two_point(prog, s)
        assert sme_is_tsni(prog), prog
        if is_tsni_plain(prog):
            tsni_programs += 1
            for s in stores():
                t = o_run(prog, s)
                if t is not None:
                    assert sme(prog, s, GAMMA, fuel=FUEL) == t, (prog, s)
    assert tsni_programs >= 100

History

Capizzi, Longo, Venkatakrishnan and Sistla (2008) used a public and a private copy of a process to prevent leaks. Devriese and Piessens (2010) gave the general construction for a lattice of levels, with inputs and outputs during the run, named it secure multi-execution, and proved soundness for TSNI and precision for TSNI programs. De Groef et al. (2012) built FlowFox, a web browser that runs scripts with SME. Austin and Flanagan (2012) gave faceted execution, which shares the work of the copies, and Bielova and Rezk (2016) compared the two methods.

References

  1. Dominique Devriese and Frank Piessens, Noninterference through secure multi-execution, Proceedings of the 2010 IEEE Symposium on Security and Privacy, pp. 109 to 124, the construction, the soundness theorem (Theorem 1) and the precision theorem for termination-sensitive noninterferent programs (Theorem 2)
  2. Roberto Capizzi, Antonio Longo, V. N. Venkatakrishnan and A. Prasad Sistla, Preventing information leaks through shadow executions, Proceedings of the 2008 Annual Computer Security Applications Conference (ACSAC), pp. 322 to 331, a public and a private copy of a process
  3. Willem De Groef, Dominique Devriese, Nick Nikiforakis and Frank Piessens, FlowFox, a web browser with flexible and precise information flow control, Proceedings of the 2012 ACM Conference on Computer and Communications Security, pp. 748 to 759, secure multi-execution of JavaScript in a browser
  4. Nataliia Bielova and Tamara Rezk, Spot the difference, secure multi-execution and multiple facets, ESORICS 2016, LNCS 9878, pp. 501 to 519, the comparison of secure multi-execution with faceted execution
  5. Aslan Askarov, Sebastian Hunt, Andrei Sabelfeld and David Sands, Termination-insensitive noninterference leaks more than just a bit, ESORICS 2008, LNCS 5283, pp. 333 to 348, the leak through termination that termination-insensitive methods allow and secure multi-execution closes

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example