betaFeedback

WorksComputer Science

Verifying Type Soundness for Nontransitive Information Flow Security

Abstract

We present a machine-checked soundness proof of a type system for the nontransitive noninterference (NTNI) information flow security property in an imperative programming language using Dafny. The original formulation of NTNI was developed for a functional programming language augmented with memory access operators, where security policies are expressed as coarse-grained information flow constraints over component-based software systems. Although subsequent research has extended NTNI type systems in various directions, to the best of our knowledge, no prior work has established a machine-checked soundness proof for type-enforced NTNI. As a result, the correctness of existing NTNI enforcement mechanisms has not been formally verified with a high degree of assurance.

Introduction

Language-based security leverages program semantics and static program analysis to enforce security properties. One of the most extensively studied classes of such properties is information flow security, which aims to ensure the confidentiality and integrity of programs [21]. Since the 1990s, numerous formal approaches based on secure type systems and Hoare logic-style proof systems have been proposed for imperative [27], functional [9], and object-oriented [17] programming languages, supporting both strict noninterference and controlled information downgrading policies [22].

Most language-based information flow control (IFC) systems build upon Denning’s lattice model [3, 4], which assumes transitive information flow policies. In these systems, security levels form a partially ordered lattice that is used to classify program entities such as inputs, outputs, and intermediate variables, thereby enabling the tracking of information dependencies throughout program execution. However, in some settings, the transitivity assumption is overly restrictive or undesirable. Modern software systems are increasingly composed of

Library { // protected code: only accessible via Service
    process(source_data) { ... }
    retrieve(key){
        ...
        return some_data;
    }
}
Service { // privileged code
    logFile;
    addLog(x) {
        append(logFile, x);
    }
    print(data) {
        Library.process(data);
    }
    query_data(key){
        return Library.retrieve(key);
    }
}
Downloaded_Code { // untrusted code
    v, d = ...;        // untrusted data
    main() {
        Service.addLog(d);
        Service.print(d.data);
        v = Service.query_data(d.key);
    }
}

reusable components obtained from diverse and potentially untrusted sources. Such components, including third-party code downloaded from the Internet, may execute alongside sensitive system components within the same process. In these environments, security policies cannot rely solely on the intentions of the original software developers. Instead, application developers, system integrators, or deployers must be able to specify their own security requirements to protect trusted system components from untrusted code. Since users often lack knowledge of the internal implementation details of third-party components, they can typically specify only coarse-grained security policies based on the intended functionality of each component. Consequently, security labels are associated with software components rather than with individual program variables. To address these requirements, nontransitive noninterference (NTNI) [14] was proposed as a more flexible foundation for secure software composition.

In the example shown in Figure 1, we assume a local system in which the Library is protected and accessible via only the privileged code Service. Code downloaded from Internet is not trusted, which may be permitted to access Service but not Library. For instance, Downloaded_Code is allowed to invoke addLog() that appends some (untrusted) data into a non-executable log file to be inspected manually by the system administrator. Since the appended data is not further propagated to other parts of the system, this action is regarded as secure. The untrusted Downloaded_Code also invokes print() from Service that reads and prints out data using protected Library resources via process(). This call is insecure. Although the function print() has the privilege to call process() from Library, and Downloaded_code has the privilege to use the Service interface, Downloaded_Code should not influence the execution of Library functions. Consequently, this exhibits a confused deputy problem—while Downloaded_code cannot directly access the printout in Library, it can still influence the printout via the (confused) deputy Service.1

Confused deputy attack

Figure 1. Confused deputy attack.

Transitive noninterference with fine-grained security policies can solve the above problem by assigning security levels to individual program variables in Service, for example, specifying addLog.x to be accessible to all code while print.data to be accessible to only trusted local code. However, since Service may contain a large number of variables and functions to be shared among a variety of third party applications, specification of individual program variables may be difficult and error-prone. NTNI with coarse-grained security policies provides a simpler and more intuitive solution, by assigning security levels LL, SS and DD to code bases Library, Service and Downloaded_Code respectively, and specifying D⊵SD \trianglerighteq S, S⊵LS \trianglerighteq L, L⊵SL \trianglerighteq S and S⊵DS \trianglerighteq D (disallowing D⊵LD \trianglerighteq L and L⊵DL \trianglerighteq D). With such a policy, Service.query_data() will be a violation of the policy as it retrieves information from Library via Service, and will be rejected given L⊵DL \trianglerighteq D disallowed.

Type systems have been widely adopted for the enforcement of information flow security properties in programming languages, such as in [21, 22]. However, most existing approaches do not provide machine-checkable proofs of soundness, with a few notable exceptions using Coq [10] and Isabelle/HOL [16]. In particular, Murray et al. [16] conducted a machine-checked proof that the seL4 microkernel enforces information flow security, proving a variant of intransitive noninterference for the actual C implementation of seL4. In another project, Kammüller [10] formalizes a simple bytecode language and proves noninterference by leveraging Coq’s module system. The type system for NTNI has only a pen-and-paper proof for the soundness available in [14].

This work presents a machine-checked soundness proof of a type system for nontransitive noninterference (NTNI) implemented in Dafny [11]. In contrast to the substantial proof engineering effort typically required in interactive theorem provers such as Coq and Isabelle/HOL, Dafny provides a lightweight framework for the formalization and verification of programming language semantics and type systems. Specifications, predicates, and rewriting rules encoded in Dafny are automatically translated into verification conditions discharged by backend SMT solvers, significantly reducing the manual effort required for mechanized proofs. As a result, Dafny enables type systems to be formalized and verified in a relatively concise, structured, and accessible manner.

Furthermore, unlike the original NTNI formulation in [14], which was presented in a functional programming setting, we express NTNI over a while-language similar to that used in the Volpano–Smith–Irvine (VSI) type system [27], the first sound type system for transitive noninterference. By adopting this simpler imperative setting, we aim to make the intuition behind the correctness of the NTNI type system clearer and more accessible than in the original presentation.

Our Dafny formalization is publicly available2. The language semantics, type system and soundness proof are implemented in compact Dafny modules, which consist of 635 lines of Dafny code, including comments, sanity tests and assertions. (The total is 195 for the language model, 180 for the type system and 260 for the soundness proof.) This is a manageable size for a simple language with mostly quantifier-light arithmetic and set-theoretic reasoning, which makes it ideal for the SMT backend to verify the proof without imposing too much additional trust. For comparison the Coq model for (transitive) non-interference in a simple bytecode language requires approximately 2, 300 lines of code [10].

Our contributions are summarized as follows.

  1. We present a machine-checked soundness proof for a type system enforcing nontransitive noninterference (NTNI) based on the while-language of [27, 23]. As a byproduct, we also provide a Dafny mechanization of the soundness proof for the Volpano–Smith–Irvine (VSI) type system, whose original presentation relied solely on pen-and-paper proofs. Note we are not the first to provide a machine-checked proof for the VSI type system, as there exist known works such as [24] with a proof in Isabelle.

  1. Our proof of the NTNI type system clarifies that, for each security level ℓ\ell, the corresponding security reasoning can be reduced to a two-level information flow security problem over an extended set of program variables. This reduction is established directly from the typing derivation of a program and therefore applies only to well-typed programs. Compared with the approach of Ahmadpanah et al. [1], which reduces NTNI to transitive noninterference through program transformation and potentially increases the size and complexity of the program, our reduction is conceptually simpler and more direct.

A System Model

We encode the security condition in the imperative programming language specified in Figure 2, where metavariable xx ranges over variables and vv over integer values. We use 0 for false and nonzero values for true. A command is also known as a program. Given a program, VV is the set of variables that appear in the program.

Language syntax
e::=e ::=Expressions
vvvalue
xxvariable
e+ee + ebinary operation
c::=c ::=Commands
skiptermination
x:=ex := eassignment
`if\ e\ then\ c_1\ else\ c_2$ | conditional
while e do cwhile\ e\ do\ cloop
c1;c2c_1;c_2sequential composition

Figure 2. Language syntax.

A program cc is executed under a memory state M:V→NM : V \to\mathbb{N} which assigns a value to each variable, with a small step semantics defined in Figure 3, following the standard structural operational semantics as in [8], where (M,c)→(M′,c′)(M,c)\to(M',c') indicates that program cc under memory state MM performs a single step execution and then becomes c′c' with the memory state updated to M′M'.

Structural operational semantics
M e1⇓v1M e2⇓v2M e1+e2⇓v1+v2\frac{M\ e_1 \Downarrow v_1 \qquad M\ e_2 \Downarrow v_2}{M\ e_1+e_2 \Downarrow v_1+v_2}
M v⇓v\frac{}{M\ v \Downarrow v}
M(x)=vM x⇓v\frac{M(x)=v}{M\ x \Downarrow v}
M e⇓v(M,x:=e)→(M[x↦v],skip)\frac{M\ e \Downarrow v}{(M,x:=e)\to(M[x\mapsto v],\mathrm{skip})}
(M,c1)→(M′,c1′)(M,c1;c2)→(M′,c1′;c2)\frac{(M,c_1)\to(M',c_1')}{(M,c_1;c_2)\to(M',c_1';c_2)}
(M,c2)→(M′,c2′)(M,skip;c2)→(M′,c2′)\frac{(M,c_2)\to(M',c_2')}{(M,\mathrm{skip};c_2)\to(M',c_2')}
M e⇓vv≠0(M,while e do c)→(M,c;while e do c)\frac{M\ e\Downarrow v \qquad v\ne0}{(M,\mathrm{while}\ e\ \mathrm{do}\ c)\to(M,c;\mathrm{while}\ e\ \mathrm{do}\ c)}
M e⇓0(M,while e do c)→(M,skip)\frac{M\ e\Downarrow0}{(M,\mathrm{while}\ e\ \mathrm{do}\ c)\to(M,\mathrm{skip})}
M e⇓vv≠0(M,if e then c1 else c2)→(M,c1)\frac{M\ e\Downarrow v \qquad v\ne0}{(M,\mathrm{if}\ e\ \mathrm{then}\ c_1\ \mathrm{else}\ c_2)\to(M,c_1)}
M e⇓0(M,if e then c1 else c2)→(M,c2)\frac{M\ e\Downarrow0}{(M,\mathrm{if}\ e\ \mathrm{then}\ c_1\ \mathrm{else}\ c_2)\to(M,c_2)}

Figure 3. Structural operational semantics.

The VSI type system [27] enforces the two level security policy L⪰HL \succeq H assuming there exists a partition over program variables into LL and HH, and the information stored in variables labeled with security level LL is permitted to flow to variables with security HH, but not the other way around. A more precise way of defining this security property is by adopting the notion of noninterference which is initially proposed by Goguen and Meseguer [7]. In the programming language setting, we need a notion of equivalence over memory states to express this property. Define M1=LM2M_1 =_L M_2 if two memory states M1M_1 and M2M_2 agree on the values for all variables labeled by LL (so called low-equivalence states), and “→∗\to^*” is the transitive closure of the small-step transition relation “→\to” defined in Figure 3 provided that an execution terminates.

Definition 1 (Termination-Insensitive Noninterference, TI-NI). *Program cc satisfies TI-NI wrt to the policy L⪰HL \succeq H, if for all memory states M1M_1 and M2,M_2,

Σ⊢e1:τΣ⊢e2:τΣ⊢e1+e2:τ [TEXP]Σ⊢v:LΣ⊢v:L [TVAL]Σ(x)=τ varΣ⊢x:τ [TVAR]Σ⊢x:τΣ⊢e:τΣ⊢x:=e:τ [TASN]Σ⊢c1:τ cmdΣ⊢c2:τ cmdΣ⊢c1;c2:τ cmd [TSEQ]Σ⊢e:τΣ⊢c:τ cmdΣ⊢while e do c:τ cmd [TWH]Σ⊢e:τΣ⊢c1:τ cmdΣ⊢c2:τ cmdΣ⊢if x then c1 else c2:τ cmd [TIF]L⊵H [BASE]τ1⊵τ2τ2 cmd⊵τ1 cmd [CMD]ρ⊵ρ [REFL]ρ1⊵ρ2ρ2⊵ρ3ρ1⊵ρ3 [TRANS]Σ⊢c:ρ1ρ1⊵ρ2Σ⊢c:ρ2 [SUB]\begin{aligned} &\frac{\Sigma\vdash e_1:\tau\qquad\Sigma\vdash e_2:\tau}{\Sigma\vdash e_1+e_2:\tau}\ [\mathrm{TEXP}] \qquad \frac{\Sigma\vdash v:L}{\Sigma\vdash v:L}\ [\mathrm{TVAL}]\\ &\frac{\Sigma(x)=\tau\ \mathrm{var}}{\Sigma\vdash x:\tau}\ [\mathrm{TVAR}] \qquad \frac{\Sigma\vdash x:\tau\qquad\Sigma\vdash e:\tau}{\Sigma\vdash x:=e:\tau}\ [\mathrm{TASN}]\\ &\frac{\Sigma\vdash c_1:\tau\ \mathrm{cmd}\qquad\Sigma\vdash c_2:\tau\ \mathrm{cmd}}{\Sigma\vdash c_1;c_2:\tau\ \mathrm{cmd}}\ [\mathrm{TSEQ}] \qquad \frac{\Sigma\vdash e:\tau\qquad\Sigma\vdash c:\tau\ \mathrm{cmd}}{\Sigma\vdash\mathrm{while}\ e\ \mathrm{do}\ c:\tau\ \mathrm{cmd}}\ [\mathrm{TWH}]\\ &\frac{\Sigma\vdash e:\tau\qquad\Sigma\vdash c_1:\tau\ \mathrm{cmd}\qquad\Sigma\vdash c_2:\tau\ \mathrm{cmd}}{\Sigma\vdash\mathrm{if}\ x\ \mathrm{then}\ c_1\ \mathrm{else}\ c_2:\tau\ \mathrm{cmd}}\ [\mathrm{TIF}]\\ &\frac{L\mathrel{\unrhd}H}{ }\ [\mathrm{BASE}] \qquad \frac{\tau_1\mathrel{\unrhd}\tau_2}{\tau_2\ \mathrm{cmd}\mathrel{\unrhd}\tau_1\ \mathrm{cmd}}\ [\mathrm{CMD}] \qquad \frac{\rho\mathrel{\unrhd}\rho}{ }\ [\mathrm{REFL}]\\ &\frac{\rho_1\mathrel{\unrhd}\rho_2\qquad\rho_2\mathrel{\unrhd}\rho_3}{\rho_1\mathrel{\unrhd}\rho_3}\ [\mathrm{TRANS}] \qquad \frac{\Sigma\vdash c:\rho_1\qquad\rho_1\mathrel{\unrhd}\rho_2}{\Sigma\vdash c:\rho_2}\ [\mathrm{SUB}] \end{aligned}

fig:4. The Volpano-Smith-Irvine type system.

we have

M1=LM2(M1,c)→∗(M1′,skip)(M2,c)→∗(M2′,skip)⟹M1′=LM2′\begin{gathered} M_1 =_L M_2\\ (M_1,c)\mathrel{\to^{*}}(M'_1,\mathrm{skip})\\ (M_2,c)\mathrel{\to^{*}}(M'_2,\mathrm{skip}) \end{gathered} \qquad\Longrightarrow\qquad M'_1 =_L M'_2

We note that Definition 1 is termination insensitive, as similar to [27], this paper does not consider information leakage caused by program termination. Consequently, we often omit “TI” from definitions if it is clear from the context.

Explicit flow. Explicit information flow occurs when a variable with a high security level appears directly in an expression assigned to a variable with a lower security level, such as in the assignment l:=h+2l := h + 2, where ll is labeled LL and hh is labeled HH. Explicit flow patterns also arise in input/output operations and in value-returning function or method calls.

Implicit flow. Implicit information flow occurs when a high-security variable influences the control flow of a program, thereby affecting the value of a low-security variable indirectly. A typical example is the statement if h then l:=1 else l:=0\mathrm{if}\ h\ \mathrm{then}\ l := 1\ \mathrm{else}\ l := 0, where h∈{0,1}h \in\{0,1\}. In this case, the value of hh is effectively copied to ll through the branching structure.

We briefly review the VSI type system defined in Fig. 4. The VSI system defines two base security types, LL and HH, under the security policy L⊵HL \mathrel{\unrhd} H. The variable type τ var\tau\ \mathrm{var} associated with a variable xx indicates that τ\tau is the security type assigned to xx, as specified by the programmer or user. The type τ cmd\tau\ \mathrm{cmd} is used exclusively for typing commands (or programs). The key insight of the VSI type system is that an expression is always assigned the highest security level among the information it depends on, whereas a command cc is assigned type τ cmd\tau\ \mathrm{cmd}, where τ\tau is the lowest security level among the variables that may be updated during the execution of cc.

Theorem 1 (VSI soundness [27]). If cc is well typed in VSI, then cc satisfies noninterference with respect to the policy L⊵HL \mathrel{\unrhd} H.

It is sometimes argued that given a multi-level security policy (S,⊵)(S, \trianglerighteq), where SS is a set of security levels and ⊵\trianglerighteq a partial order over SS, security reasoning can be reduced to a collection of two-level security problems, one for each security level ℓ∈S\ell\in S. In particular, for a fixed level ℓ\ell, let Lℓ={ℓ′∣ℓ′⊵ℓ}L_\ell= \{\ell' \mid\ell' \trianglerighteq\ell\} and Hℓ=S∖LℓH_\ell= S \setminus L_\ell. Security is then verified by checking that information from HℓH_\ell does not interfere with information observable at levels in LℓL_\ell for every security level ℓ∈S\ell\in S.

Nontransitive Noninterference

In a system governed by a transitive information flow policy, information associated with a particular security level may flow to any other security level reachable through the transitive closure of the policy relation. This characteristic can make transitive policies unsuitable for expressing coarse-grained security requirements in component-based systems.

For example, suppose a component owned by Alice is willing to share information only with another component, Bob. Under a transitive policy, if Bob is permitted to share information with additional components, then Alice’s information may also flow indirectly to those components through the transitive closure of the policy relation. Such indirect flows may violate Alice’s intended security requirements and are therefore undesirable.

The above requirement leads us to a scheme that defines a flow policy in a less permissive way by removing the transitivity requirement from the policy ⊵\trianglerighteq which is a binary relation over the set of security levels. Taking the policy required for the example in Figure 1, which contains code bases Library (LL) (protected code), Service (SS) (privileged code), and Download_Code (DD), where the security levels are in S={L,S,D}S = \{L, S, D\} with the permitted flow relation D⊵SD \trianglerighteq S, S⊵LS \trianglerighteq L, L⊵SL \trianglerighteq S and S⊵DS \trianglerighteq D (i.e., D⊵LD \trianglerighteq L and L⊵DL \trianglerighteq D are disallowed). Take Download_Code DD, the security policy requires that the final values of variables typed DD should only be influenced by input values to variables typed either DD or SS (Since S⊵DS \trianglerighteq D), but not LL. This leads us to the following definition.

For each ℓ∈S\ell\in S define ⊵(ℓ)={ℓ′∣ℓ′⊵ℓ}\trianglerighteq(\ell) = \{\ell' \mid\ell' \trianglerighteq\ell\}, which is the set of security levels that are allowed to influence ℓ\ell. Moreover, we assume ⊵\trianglerighteq is reflexive, thus ℓ∈⊵(ℓ)\ell\in\trianglerighteq(\ell) for any ℓ∈S\ell\in S. Write M1∼TM2M_1 \mathrel{\mathop{\sim}\limits^{T}} M_2 if for all variables xx that are assigned security level ℓ∈T\ell\in T, we have M1(x)=M2(x)M_1(x) = M_2(x).

Definition 2 (Termination-Insensitive Nontransitive Noninterference, TI-NTNI). [14] Program cc satisfies TI-NTNI with respect to a nontransitive policy ⊵\trianglerighteq, if, for all memory states M1M_1 and M2M_2 and security level ℓ∈S\ell\in S, we have

M1∼⊵(ℓ)M2(M1,c)→∗(M1′,skip)(M2,c)→∗(M2′,skip)⟹M1′∼{ℓ}M2′\begin{aligned} M_1 &\mathrel{\mathop{\sim}\limits^{\trianglerighteq(\ell)}} M_2 \\ (M_1,c) &\to^* (M'_1,\mathop{\mathrm{skip}}) \\ (M_2,c) &\to^* (M'_2,\mathop{\mathrm{skip}}) \end{aligned} \quad\Longrightarrow\quad M'_1 \mathrel{\mathop{\sim}\limits^{\{\ell\}}} M'_2

The type system described in Figure 5 enforces a nontransitive noninterference policy ⊵\trianglerighteq over a set of security levels SS. Type context Σ\Sigma assigns a security level

Nontransitive noninterference type system

Figure 5. The nontransitive noninterference type system.

Σ,Γ⊢pce1:τΣ,Γ⊢pce2:τΣ,Γ⊢pce1+e2:τ [NEXP]Σ,Γ⊢pcv:∅  [NVAL]Σ(x)=ℓΣ,Γ⊢pcx:{ℓ} [NVAR]Σ,Γ⊢pce:ττ∪pc⊆Γ(x)⊆⊵(Σ(x))Σ,Γ⊢pcx:=e:{x} [NASN]Σ,Γ⊢pcc1:ρΣ,Γ⊢pcc2:ρΣ,Γ⊢pcc1;c2:ρ [NSEQ]Σ,Γ⊢pce:τΣ,Γ⊢pc∪τc:ρΣ,Γ⊢pcwhile e do c:ρ [NWH]Σ,Γ⊢pce:τΣ,Γ⊢pc∪τc1:ρΣ,Γ⊢pc∪τc2:ρΣ,Γ⊢pcif x then c1 else c2:ρ [NIF]Σ,Γ⊢pce:τ1τ1⊆τ2Σ,Γ⊢pce:τ2 [E−SUB]Σ,Γ⊢pcc:ρ1ρ1⊆ρ2Σ,Γ⊢pcc:ρ2 [C−SUB]\begin{aligned} &\frac{\Sigma,\Gamma\vdash_{pc} e_1:\tau\qquad\Sigma,\Gamma\vdash_{pc} e_2:\tau}{\Sigma,\Gamma\vdash_{pc} e_1+e_2:\tau}\ [\mathrm{NEXP}] \qquad \frac{\Sigma,\Gamma\vdash_{pc} v:\varnothing}{\ } \ [\mathrm{NVAL}]\\ &\frac{\Sigma(x)=\ell}{\Sigma,\Gamma\vdash_{pc}x:\{\ell\}}\ [\mathrm{NVAR}] \qquad \frac{\Sigma,\Gamma\vdash_{pc}e:\tau\qquad\tau\cup pc\subseteq\Gamma(x)\subseteq\trianglerighteq(\Sigma(x))}{\Sigma,\Gamma\vdash_{pc}x:=e:\{x\}}\ [\mathrm{NASN}]\\ &\frac{\Sigma,\Gamma\vdash_{pc}c_1:\rho\qquad\Sigma,\Gamma\vdash_{pc}c_2:\rho}{\Sigma,\Gamma\vdash_{pc}c_1;c_2:\rho}\ [\mathrm{NSEQ}] \qquad \frac{\Sigma,\Gamma\vdash_{pc}e:\tau\qquad\Sigma,\Gamma\vdash_{pc\cup\tau}c:\rho}{\Sigma,\Gamma\vdash_{pc}\mathbf{while}\ e\ \mathbf{do}\ c:\rho}\ [\mathrm{NWH}]\\ &\frac{\Sigma,\Gamma\vdash_{pc}e:\tau\qquad\Sigma,\Gamma\vdash_{pc\cup\tau}c_1:\rho\qquad\Sigma,\Gamma\vdash_{pc\cup\tau}c_2:\rho}{\Sigma,\Gamma\vdash_{pc}\mathbf{if}\ x\ \mathbf{then}\ c_1\ \mathbf{else}\ c_2:\rho}\ [\mathrm{NIF}]\\ &\frac{\Sigma,\Gamma\vdash_{pc}e:\tau_1\qquad\tau_1\subseteq\tau_2}{\Sigma,\Gamma\vdash_{pc}e:\tau_2}\ [\mathrm{E-SUB}] \qquad \frac{\Sigma,\Gamma\vdash_{pc}c:\rho_1\qquad\rho_1\subseteq\rho_2}{\Sigma,\Gamma\vdash_{pc}c:\rho_2}\ [\mathrm{C-SUB}] \end{aligned}

Σ(x)∈S\Sigma(x)\in S to each variable xx in the program, and type context Γ\Gamma assigns each variable xx a collection of security levels that may (transitively) flow to xx. In particular, for each expression ee, the type system assigns it a type τ\tau that contains all information that may influence the value of ee, and for each command cc, a command type ρ\rho is the collection of variables that may get updated in the execution of cc. In particular, [C-SUB] says if ρ1\rho_1 is the set of variables that may get updated (Σ,Γ⊢pcc:ρ1\Sigma,\Gamma\vdash_{pc}c:\rho_1), then it is safe to say that cc can be typed with a larger set (i.e., Σ,Γ⊢pcc:ρ2\Sigma,\Gamma\vdash_{pc}c:\rho_2 with ρ1⊆ρ2\rho_1\subseteq\rho_2). Likewise, for [E-SUB], if an expression ee can be typed with a set of labels τ1\tau_1, then it can also be typed τ2\tau_2 given τ1⊆τ2\tau_1\subseteq\tau_2. Now the subtyping relation is just the subset relation, so the reflexivity and transitivity typing rules that appears in the VSI type system are no longer required in the type system for NTNI.3 In those rules, control dependencies are carried by pcpc, which is propagated via rules such as [NIF] and [NWH], and enforced by [NASN] when an assignment is located inside a branching structure or a loop structure. In the Dafny model, the command type ρ\rho is used to indicate whether the provided pair of type contexts Σ\Sigma and Γ\Gamma are valid for a program, so that invalid type contexts should set ρ\rho to invalid.

Perhaps the most important constraint is defined in the rule [NASN] which assigns a type to statement x:=ex:=e. In this case, we need to ensure that all information contained in the right-hand-side (i.e., e:τe:\tau) as well as information for control dependencies (i.e., pcpc) be allowed to influence xx (i.e., pc⊆⊵(Σ(x))pc\subseteq\trianglerighteq(\Sigma(x)). The same rule also enforces Γ(x)⊆⊵(Σ(x))\Gamma(x)\subseteq\trianglerighteq(\Sigma(x)) at the global level. The information encoded in pcpc about control dependencies is propagated via the rules [NIF] and [NWH] from upper level syntactic structures.

The type system introduced in Figure 5 enforces NTNI. This theorem is proved in the Dafny model that is to be introduced in the following section.4

Theorem 2 (NTNI soundness). If cc is well typed in the NTNI type system with respect to a security policy ⊵\trianglerighteq, then cc satisfies nontransitive noninterference with respect to ⊵\trianglerighteq.

Dafny Encoding of NTNI

Dafny is a proof assistant that supports both functional programming styled specifications and imperative programming styled specifications [11]. A lemma or theorem in Dafny is essentially a method that enforces whenever its preconditions are satisfied, all its post-conditions be satisfied. This basic while-programming language is modeled with a user-defined (variant) type as follows.

// The type for all expressions
datatype Expr = | Num(n: int) | Var(x: Variable)
              | Plus(e1: Expr, e2: Expr)
// The type for all commands (statements)
datatype Cmd = | Skip | Assn(x: Variable, e: Expr)
             | If(cond: Expr, thn: Cmd, els: Cmd)
             | While(cond: Expr, c: Cmd)
             | Seq(c1: Cmd, c2: Cmd)

Listing 1.1. Program syntax

function SmallStep(s: MState, c: Cmd): (MState, Cmd)
// ...
{
    match c {
        case Skip => (s, c)
        case Assn(x, e) => (s[x := Evaluate(s, e)], Skip)
        case If(e, c1, c2) => // if-then-else
            var res := Evaluate(s, e);
            if (res != 0) then (s, c1) else (s, c2)
        case While(e, c1) => // while-loop
            var res := Evaluate(s, e);
            if (res != 0) then (s, Seq(c1, c))
            else (s, Skip)
        case Seq(c1, c2) => // sequential composition
            match c1 {
                case Skip => (s, c2) // removing 1st skip
                case c1 =>
                    var (s’, c’) := SmallStep(s, c1);
                    (s’, Seq(c’, c2)) }
    }
}

Listing 1.2. Structure Operational Semantics

that satisfies NTNI but cannot be typed in the system defined in Figure 5. Computing type contexts from a program and a policy is also out of the scope of this paper.

The structural operational semantics (SOS) define how such a program is executed, which is essentially modeled as a function that reads memory state ss and command cc as inputs, then performs a single step execution that may update memory state ss into a new state with a (likely) shorter command. Inside the execution model, Evaluate(s, e) evaluates expression ee according to memory state ss; If cc is a sequential composition, then the function may recursively invoke itself as per the SOS rule [SEQ1] in Figure 3.

The type checking procedure is modeled with two functions. The first function, HasExprType(vctx, e), gathers information (the set of security labels) that flows into expression ee. In particular, the amount of information represented by variable xx is the xx itself together with the information flowed into xx (vctx[x]). The information that flows into e1 + e2 is recursively defined as the join of the information that flows into e1 and the information that flows into e2, where the Join operator is essentially set union.

function HasExprType(vctx:VContext, e:Expr): PhraseType
{
    match e {
        case Num(n) => ExprType ({})
        case Var(x) => ExprType (vctx[x]+{x})
        case Plus(e1, e2) =>
            var t1 := HasExprType(vctx, e1);
            var t2 := HasExprType(vctx, e2);
            ExprType(Join(t1, t2))
    }
}

Listing 1.3. Expression Type Checking (simplified for readability)

The HasCmdType(vctx, vpc, c) function checks if cc is typable under the context vctx with the control dependencies represented by vpc. If type checking succeeds, the set of potentially updated variables within cc will be returned; otherwise, it returns Invalid. Any command with an Invalid component is also not typable. We focus only on the assignment and the if-condition cases, as these two structures should be sufficient for explaining how HasCmdType() works. For Assn(x, e), the security level for xx is stored at t1 and the information from ee stored at t2 with labels in e_labels. The model then enforces that the security labels stored at t2 (i.e., e_labels) should be a subset of CanFlow(t1) which is an upper bound for information allowed to enter xx as per the security policy. Variables for control dependencies (pc_labels) are also checked against CanFlow(t1). In the case of If(e, c1, c2), both branches c1 and c2 are required to be checked with a (possibly larger) new control dependencies set (vpc+te) by including the new information from ee via te.

function HasCmdType(vctx:VContext,vpc:set<Variable>,c:Cmd):
    PhraseType
// ...
{
match c {
  case Skip => CmdType({})
  case Assn(x, e) =>
    // t1 is the policy label of x
    // t2 represents information from the RHS of =
    var t1, t2 := label[x], HasExprType(vctx, e);
    // get the set of labels allowed to influence x
    var flowsFrom := CanFlow(t1);
    var pc_labels := (set x | x in vpc :: label[x]);
    var e_labels := (set x | x in t2 :: label[x]);
    if (t2+vpc+{x}) <= vctx[x]
      && (e_labels+pc_labels) <= flowsFrom
    then CmdType({x})
    else Invalid
  case If(e, c1, c2) =>
    var te := HasExprType(vctx, e);
    var t1 := HasCmdType(vctx, vpc+te, c1);
    var t2 := HasCmdType(vctx, vpc+te, c2);
    if t1 == Invalid || t2 == Invalid then Invalid
    else (CmdType(Join(t1, t2)))
  case While(e, c1) => //...
  case Seq(c1, c2) => //...
}

Listing 1.4. Command Type Checking (simplified for readability)

lemma Noninterference(vctx: VContext, ... s1, s2, s1’, s2’:
  State) // other preconditions...
requires HasCmdType(vctx, {}, c) != Invalid
// type checking passed
requires Equiv(vctx, (set x | x in variables &&
  coarse_label[x] in CanFlow(l) :: x), s1, s2)
requires Terminates(c, s1, s1’) && Terminates(c, s2, s2’)
ensures Equiv(vctx, (set x | x in variables && coarse_label
  [x] == l :: x), s1’, s2’)

Listing 1.5. NTNI security by the type system (Theorem 2), simplified for readability

Listing 1.5 is a simplified Dafny representation for Theorem 2. Here, (set x | x in variables && coarse_label[x] in CanFlow(l) :: x) represents the set of variables with labels in ⪰(ℓ)\mathord{\succeq}(\ell) and the notation (set x | x in variables && coarse_label[x] == l::x) is the set of variables xx with Σ(x)=ℓ\Sigma(x) = \ell (i.e., coarse_label[x] retrieves the assigned security label for xx). In the following, we discuss how to establish a proof for Theorem 2.

Towards a soundness proof for NTNI The soundness of VSI type system for the two-level security policy L⪰HL \mathrel{\succeq} H (Theorem 1) is established by showing that the equivalence relation =L=_L can be maintained on a pair of initial states s1s_1 and s2s_2 when they both go along with all the execution steps in a well-typed program cc. This then requires us to check all possible constructions of program cc via structural induction.

This proof technique, however, cannot be directly applied to the case of nontransitive noninterference (Theorem 2). The assumption of Definition 2 requires two memory state agree on all values stored in security levels ⊵(ℓ)\unrhd(\ell), which is often a larger set of variables than those have security level ℓ\ell which appears in the conclusion of Definition 2. Given ∼⊵(ℓ)⊆∼{ℓ}\overset{\unrhd(\ell)}{\sim}\subseteq\overset{\{\ell\}}{\sim}, a possible solution is to find a new equivalence relation on states which sits in between ∼⊵(ℓ)\overset{\unrhd(\ell)}{\sim} and ∼{ℓ}\overset{\{\ell\}}{\sim} and works in the same way as the low equivalence relation (=L)(=_L) in the proof of Theorem 1. Provided that type checking succeeds, such a relation can be constructed from the following set of variables: {y∈V∣∃x.Σ(x)=ℓ∧y∈Γ^(x)}\{y \in V \mid\exists x.\Sigma(x)=\ell\land y \in\hat{\Gamma}(x)\}, where Γ^(x)\hat{\Gamma}(x) is a (specific) function that contains all variables that may (transitively) influence each variable xx during the type checking, represented by the typing context vctx in Listing 1.4.5

For each ℓ∈S\ell\in S, define Max(ℓ)={x∈V∣Σ(x)=ℓ}∪{y∈V∣∃x.Σ(x)=ℓ∧y∈Γ^(x)}Max(\ell)=\{x\in V\mid\Sigma(x)=\ell\}\cup\{y\in V\mid\exists x.\Sigma(x)=\ell\land y\in\hat{\Gamma}(x)\}. Given memory states M1M_1, M2M_2 and V′⊆VV'\subseteq V, write M1∼V′M2M_1\mathrel{\overset{V'}{\sim}}M_2 if M1(x)=M2(x)M_1(x)=M_2(x) for all variables x∈V′x\in V'. We establish the following properties that are essential to our proof.

  1. For all xx, yy, zz, x∈Γ^(y)x\in\hat{\Gamma}(y) and y∈Γ^(z)y\in\hat{\Gamma}(z) implies x∈Γ^(z)x\in\hat{\Gamma}(z);

  2. {x∈V∣Σ(x)=ℓ}⊆Max(ℓ)⊆{x∈V∣Σ(x)⊵ℓ}\{x\in V\mid\Sigma(x)=\ell\}\subseteq Max(\ell)\subseteq\{x\in V\mid\Sigma(x)\unrhd\ell\}.

The first property holds by the fact that type checking collects a binary flow relation on variables that is always transitive, established via the construction of ExprType (line 8 of Listing 1.3) for both t2t_2 (line 9 of Listing 1.4) and tet_e (line 19 of Listing 1.4) and enforced at line 14 of Listing 1.4. Therefore, intuitively, all other variables not included in Max(ℓ)Max(\ell) cannot influence variables in Max(ℓ)Max(\ell), as presented in the following lemma. A simplified Dafny representation is presented in Listing 1.6 with the above properties for Max(ℓ)Max(\ell) encoded as preconditions.

Lemma 1 (transitive noninterference made from type checking). If cc is well typed in the NTNI type system with respect to a security policy ⊵\unrhd, then for all ℓ∈S\ell\in S,

M1∼Max(ℓ)M2(M1,c)→∗(M1′,skip)(M2,c)→∗(M2′,skip)⟹M1′∼Max(ℓ)M2′\begin{aligned} M_1 \mathrel{\overset{Max(\ell)}{\sim}} M_2 \\ (M_1,c)\to^*(M'_1,\mathrm{skip}) \\ (M_2,c)\to^*(M'_2,\mathrm{skip}) \end{aligned} \quad\Longrightarrow\quad M'_1\mathrel{\overset{Max(\ell)}{\sim}}M'_2

Lemma 1 and the second property above for Max(ℓ)Max(\ell) enable a straightforward derivation of Theorem 2.

Remark. The program transformation proposed by Ahmadpanah et al. [1] reduces an NTNI security policy to a transitive noninterference policy on a canonical form of the original program by introducing multiple copies of program variables. The construction above suggests that this duplication may not be necessary: for a well-typed program, the type system already induces a partition for each security level ℓ∈S\ell\in S that simulates the two-level security policy (V∖Max⁡(ℓ))≱Max⁡(ℓ)\left(V \setminus\operatorname{Max}(\ell)\right) \not\geq\operatorname{Max}(\ell).

lemma {:induction false} MaxSetConsistency(vctx: VContext,
    vset: set<Variable>, ..., s1,s2,s1’,s2’:State)
// other preconditions
requires HasCmdType(vctx, vpc, c) != Invalid
requires forall x, y :: x in vset && y in vctx[x] ==>
    vctx[y] <= vctx[x] <= vset
requires forall x, y :: x in vset && y in vctx[x] ==>
    coarse_label[y] in CanFlow(coarse_label[x])
requires Equiv(vctx, vset, s1, s2)
ensures Equiv(vctx, vset, s1’, s2’)

Listing 1.6. Lemma 1 simplified for readability

Related Work

The most related works are Lu and Zhang [14], which introduces the concept of NTNI, and Ahmadpanah et al. [1], which extends NTNI by incorporating flow sensitivity and input-output constructions. The key concepts discussed in these papers have already been covered in previous sections.

The notion of intransitive noninterference (INI) does not mean that the underlying flow policy is non-transitive; rather, it captures controlled mediation of information flow. Given a policy A≥B≥CA \geq B \geq C, information from AA may flow to CC provided that BB acts as a trusted mediator, such as a downgrader or sanitizer. Rushby formalized intransitive noninterference in a state-based setting [20], introducing unwinding conditions as a proof technique for verification. This notion has been further developed in a range of settings, including trace-based system models [15] and the process algebra CSP [19]. A related variant of INI was proposed by van der Meyden [26, 5], which requires that the downgrader (e.g., BB) possess at least as much knowledge as the receiver (e.g., CC) about the information being transferred from the sender (e.g., AA). These models typically represent policies as graphs over security domains; flows are allowed along certain paths but not others. The formulation of NTNI used in this paper is informed by previous work on coarse-grained nontransitive IFC and its type-theoretic enforcement [14, 1]. It may be possible to simulate a policy in INI within the NTNI framework in a way that the designer specifies which edges exist and which paths are legal via a sophisticated policy structure.

Proof assistants like Coq and Isabelle/HOL have been used to formalise proofs of the soundness of type systems and information flow security properties.

For example, Murray et al. [16] present a machine-checked proof demonstrating that the seL4 microkernel enforces information flow security. This proof establishes a variant of intransitive noninterference for the actual C implementation of seL4, which comprises approximately 8, 830 lines of code. Another line of research involves Kammüller [10], who formalises a simple bytecode language and proves noninterference using Coq’s module system.

Work on downgrading and information declassification forms an orthogonal line of research. Language-based IFC systems such as Jif [17] and Fabric [12] enforce transitive security policies while accommodating real-world requirements through explicit downgrading primitives, including declassification for confidentiality and endorsement for integrity. DC labels [25, 29] extend this approach with decentralized policies and support for robust declassification and endorsement [18, 2]. In these systems, downgrading is treated as an explicit operational mechanism that must be carefully introduced and justified by the programmer.

Conclusion

Nontransitive noninterference (NTNI) is a class of security properties useful in settings where information-flow policies are specified in a coarse-grained manner. This work presents a machine-checkable proof of NTNI for a simple imperative programming language, formalized using the Dafny proof assistant. By framing the simplicity of the language as an advantage for pedagogical and mechanization clarity, we show how complex security proofs can be made concise and accessible. The resulting proof development is publicly available. Extending the language and the proof to support full object-oriented programming features, such as classes and method calls, is currently ongoing work. We hope this provides a more solid foundation for existing theoretical developments and for potential future applications of NTNI.

Acknowledgment. The author thanks anonymous reviewers from the program committee of SOFSEM 2027 that helped identify a number of factual and presentation issues in an earlier draft.

References

  1. [1]Mohammad M. Ahmadpanah, Aslan Askarov, and Andrei Sabelfeld. Nontransitive policies transpiled. In 2021 IEEE European Symposium on Security and Privacy (EuroS&P), pages 543–561. IEEE, 2021.DOI
  2. [2]Ethan Cecchetti, Andrew C. Myers, and Owen Arden. Nonmalleable information flow control. In the ACM Conference on Computer and Communications Security, pages 1875–1891. ACM, 2017.DOI
  3. [3]Dorothy E. Denning. A lattice model of secure information flow. Commun. ACM, 19(5):236–243, 1976.DOI
  4. [4]Dorothy E. Denning and Peter J. Denning. Certification of programs for secure information flow. Commun. ACM, 20(7):504–513, 1977.DOI
  5. [5]Kai Engelhardt, Ron van der Meyden, and Chenyi Zhang. Intransitive noninterference in nondeterministic systems. In the ACM Conference on Computer and Communications Security, pages 869–880, 2012.DOI
  6. [6]Cédric Fournet and Andrew D. Gordon. Stack inspection: Theory and variants. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’02, pages 307–318, 2002.
  7. [7]Joseph A. Goguen and Jose Meseguer. Security Policies and Security Models. In 1982 IEEE Symposium on Security and Privacy, pages 11–11, April 1982.DOI
  8. [8]Carl A. Gunter. Semantics of Programming Languages: Structures and Techniques. MIT Press, Cambridge, MA, 1992.
  9. [9]Nevin Heintze and Jon G. Riecke. The slam calculus: Programming with secrecy and integrity. In Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 365–377. ACM, 1998.
  10. [10]Florian Kammüller. Formalizing non-interference for a simple bytecode language in coq. Formal Aspects of Computing, 20(3):275–275, 2008.DOI
  11. [11]K. Rustan M. Leino. Dafny: An automatic program verifier for functional correctness. In Proceedings of the 16th International Conference on Logic for Programming, Artificial Intelligence, and Reasoning (LPAR 2010), volume 6355 of Lecture Notes in Computer Science, pages 348–370. Springer, 2010.
  12. [12]Jed Liu, Owen Arden, Michael D. George, and Andrew C. Myers. Fabric: Building open distributed systems securely by construction. Journal of Computer Security, 25(4-5):367–426, 2017.DOI
  13. [13]Yi Lu, Raghavendra Kagalavadi Ramesh, Chenyi Zhang, and Padmanabhan Krishnan. Unifying access control & information flow: A security model for programs consisting of trusted and untrusted code. Technical report, Oracle Labs, May 2016.
  14. [14]Yi Lu and Chenyi Zhang. Nontransitive security types for coarse-grained information flow control. In Proceedings of the 33rd IEEE Computer Security Foundations Symposium (CSF 2020), pages 199–213. IEEE, 2020.DOI
  15. [15]Heiko Mantel and David Sands. Controlled Declassification Based on Intransitive Noninterference. In Programming Languages and Systems, Lecture Notes in Computer Science, pages 129–145, 2004.DOI
  16. [16]Toby C. Murray, Daniel Matichuk, Matthew Brassil, Peter Gammie, Timothy Bourke, Sean Seefried, Corey Lewis, Xin Gao, and Gerwin Klein. sel4: From general purpose to a proof of information flow enforcement. In Proceedings of the 2013 IEEE Symposium on Security and Privacy (SP), pages 415–429. IEEE, 2013.DOI
  17. [17]Andrew C. Myers. Jflow: Practical mostly-static information flow control. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 228–241. ACM, 1999.
  18. [18]Andrew C. Myers, Andrei Sabelfeld, and Steve Zdancewic. Enforcing robust declassification and qualified robustness. Journal of Computer Security, 14(2):157–196, 2006.DOI
  19. [19]Andrew W. Roscoe and Michael H. Goldsmith. What is intransitive noninterference? In Proceedings of the 12th IEEE Computer Security Foundations Workshop, pages 228–238, 1999.
  20. [20]John Rushby. Noninterference, transitivity, and channel-control security policies. Technical Report Computer Science Laboratory Report CSL-92-02, SRI International, 1992.
  21. [21]Andrei Sabelfeld and Andrew C. Myers. Language-based information-flow security. IEEE Journal on Selected Areas in Communications, 21(1):5–19, 2003.DOI
  22. [22]Andrei Sabelfeld and David Sands. Declassification: Dimensions and principles. Journal of Computer Security, 17(5):517–548, 2009.DOI
  23. [23]Geoffrey Smith. Principles of secure information flow analysis. In Mihai Christodorescu, Somesh Jha, Douglas Maughan, Dawn Song, and Cliff Wang, editors, Malware Detection, volume 27 of Advances in Information Security, pages 291–307. Springer, 2007.DOI
  24. [24]Gregor Snelting and Daniel Wasserab. A correctness proof for the volpano/smith security typing system. Archive of Formal Proofs, September 2008. https://isa-afp.org/entries/VolpanoSmith.html, Formal proof development.
  25. [25]Deian Stefan, Alejandro Russo, David Mazières, and John C. Mitchell. Disjunction category labels. In Nordic Conference on Secure IT Systems (NordSec), pages 223–239, 2011.DOI
  26. [26]Ron van der Meyden. What, indeed, is intransitive noninterference? In European Symposium On Research In Computer Security, pages 235–250, 2007.
  27. [27]Dennis Volpano, Geoffrey Smith, and Cynthia Irvine. A sound type system for secure flow analysis. Journal of Computer Security, 4(2):167–187, 1996.
  28. [28]Dan S. Wallach and Edward W. Felten. Understanding Java stack inspection. In Proceedings of the 1998 IEEE Symposium on Security and Privacy, pages 52–63. IEEE Computer Society, 1998.
  29. [29]Lucas Waye, Pablo Buiras, Dan King, Stephen Chong, and Alejandro Russo. It’s my privilege: Controlling downgrading in DC-labels. In Security and Trust Management (STM), volume 9331 of LNCS, pages 203–219. Springer, 2015.DOI

Paper details

vlnc:W_zec3uufz
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC0-1.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents