WorksComputer Science
Type-Confusion Security
Abstract
Type systems are a lightweight way to obtain formal assurance that code upholds security properties. However, decentralized systems, such as smart contracts and Model Context Protocol ecosystems, have limited ability to constrain the behavior of untrusted code. In such systems, attackers may attempt to confuse trusted code by supplying values that do not behave according to their advertised types, an attack that we call type confusion. Well-known attacks such as confused deputy attacks, reentrancy attacks, and control-flow hijacking can be understood as instances of type confusion. We define type confusion security as the property that unrestricted attackers who need not follow the type system have no more power than limited attackers who fully obey it. We formally define type confusion security as a real–ideal emulation, and in the context of an information-flow-typed core calculus that statically enforces security against well-typed attackers, prove that its run-time checks also enforce security against ill-typed attackers. In this system, programmers can write code while reasoning about security only against well-typed attackers; the security guarantees enforced by the type system still hold. We mechanize a proof of type confusion security in Lean.
Introduction
Static type systems are a powerful way to enforce security. They allow programmers to reason about code in a high-level language and rule out attacks before the code runs, often with little or no run-time overhead. In type systems for information flow control (IFC), labeled types serve as expressive security specifications for code: they describe confidentiality and integrity requirements, identify contexts in which code may execute securely, and also enable enforcement of properties like noninterference [20, 38], reentrancy security[12] and nonmalleable information flow [11].
However, purely static reasoning is fragile in systems where adversaries may not follow the rules. For example, smart contracts, cross-chain protocols, federated systems like Bluesky or OAuth 2.0, and Model Context Protocol (MCP) ecosystems routinely interact across trust boundaries. In such settings, trusted code may receive ill-typed values from an adversarial principal or invoke remote procedures whose implementations are controlled by an adversary. Our name for an adversary-induced mismatch between the expected and actual types is type confusion.
Depending on the type system, type confusion has different security implications. Its most obvious form involves unchecked casts between ordinary types, which can violate memory safety. Further, an integer can be used at run time as a function pointer, leading to vulnerabilities such as control-flow hijacking [1, 31]: calling the function jumps to an invalid or unauthorized address.
Type confusion can be more insidious in security type systems, where labels on types express security requirements for authorization and information flow. As we illustrate, confused-deputy attacks (CDAs) [21] and reentrancy attacks [12] are examples of such phenomena. Such attacks are not merely hypothetical: recent high-profile security breaches in blockchain smart contracts have been attributed to CDAs and reentrancy attacks [14, 15, 16, 17] that exploit mismatched expectations about the behavior of callback code. In both cases, attackers exploit type-confused function pointers to induce insecure control flows. Solutions for such type confusion are unsatisfactory. Existing techniques like gradual typing [9, 13] don’t address adversarial settings: every term is either dynamically or statically typed, the runtime is trusted, and users don’t actively misrepresent types. State-of-the-art language-based IFC systems like SCIF [44] and Fabric [25] partially address these attacks but lack formal guarantees. Prior formal works [12, 34] show that IFC, extended with run-time checks, can enforce security against CDAs and reentrancy attacks independently, but not in a unified framework.
Our core contribution is a unified, extensional, and rigorous description of security for the above attacks, as type confusion security. Further, we construct effective dynamic mechanisms against type confusion, and highlight their semantic principles. Our contributions are summarized below:
Type-confusion security. We define type-confusion security in the style of simulation-based security [10]: attackers gain no advantage by confusing types because such attackers can be simulated by ones who do not. Type-confusion security ensures robust hyperproperty preservation (RHP) [3, 33], a compiler correctness property which requires that whatever properties the type system enforces—for example, memory safety or noninterference—hold even in the presence of real-world attackers. Thus, programmers may reason about security in the simpler, well-typed ideal world, even though deployed code interacts with real-world adversaries that do not respect the type system.
Provable security enforcement of type confusion. We design dynamic mechanisms that provably enforce type-confusion security for an information-flow-typed language. It might seem that it suffices to simply perform a dynamic check that mirrors its static counterpart. However, we show that run-time enforcement must be carefully designed to ensure that the dynamic checks are strong enough, performed only by honest parties, and depend only on trusted run-time information.
Provable enforcement of real-world security. This paper defines novel, simple run-time checks that protect against CDAs. It also extends the authority-lock mechanism of SeRIF [12] to enforce reentrancy security more flexibly.
Language model and formalization. To explore type-confusion security and its enforcement mechanisms, we define a core calculus of a decentralized system with remote procedure calls (RPC). In the setting of this core calculus, we mechanize all of our security results in Lean [28].
The rest of the paper is structured as follows. § 2 introduces motivating examples and the key intuition behind the run-time checks. § 3 provides a formal overview of type-confusion security. § 4 defines the ideal and real calculi. § 5 proves the main simulation theorem. § 6 applies the theorem to prove security against CDA and reentrancy attacks. § 7 discusses related work and concludes.
Background and Motivation
Confused Deputy Attacks
A confused-deputy attack (CDA) [21] happens when an attacker tricks a trusted party (the deputy) into misusing its authority to effectively escalate the attacker’s privileges. Figure 1 shows a simplified version of a CDA against a token exchange service. It captures the spirit of several notorious recent attacks causing millions of dollars in losses [14, 15, 16].

Figure 1. Confused deputy attack on an exchange smart contract. The solid green arrows represent a well-typed usage of the service. Dashed red arrows show the control caused by an ill-typed attacker. Run-time checks on line 1 of exchange cannot be trusted because they involve an untrusted caller. On a CDA run, the dynamic check on line 3 happens fully within the trusted parties because both the deputy and the victim are trusted.
Here, the exchange service is the trusted confused deputy. In an honest execution, the user calls the exchange contract with an exchange request, along with the user’s payment function alice.pay() for the exchange service to extract funds. When called, the exchange contract queries a price oracle for the exchange rate, then calls the user’s payment function, and finally pays the user. However, an attacker might pass the exchange’s own payment handle exchange.pay() instead, causing the exchange service to pay the user (line 3) when it should receive payment from the user.
The classic solution to CDA is capabilities [21], but a less error-prone solution can be obtained by viewing CDA through the lens of secure information flow, where it becomes clear that CDA is a form of type confusion.
Assume a simple two-point lattice of information-flow labels in which information is either labeled T for “trusted” or U for “untrusted”. Function types are annotated by labels; in particular, each function type includes an external pc (program counter) label [12] which controls the contexts from which it may be called, as seen in Figure 1. A function labeled T may only be called from trusted contexts. A function labeled U may be called from anywhere and passed untrusted arguments, so a U-function type is a subtype of a T-function type. Although the exchange service is trusted to call any function in a trusted context, we can design our IFC type system so that a call through the untrusted variable receiver (line 3) is necessarily performed in an untrusted context U.
If the static typing rules are enforced, the attack is prevented because line 2 of the attacker code fails to type-check: the attacker passes exchange.pay, a T-function pointer, to a U-labeled function parameter (receiver). Because function subtyping is contravariant on inputs, this argument is rejected. However, in the real world where attackers do not follow static typing rules, run-time checks are needed to prevent CDAs.
Naively we might think to check the type of receiver as soon as exchange.swap is called, but in an open system we do not know this type and cannot trust the attacker to provide it. Therefore, we perform run-time security checks lazily at function calls. On line 3 of exchange.swap, the exchange notifies the callee exchange.pay that it is being called from a U-labeled context. As the trusted callee exchange.pay expects calls only from T-labeled contexts, it rejects the call at run time.
The obvious question is whether this simple dynamic check suffices to prevent CDA. We can show that it does by demonstrating that with this check, the system is secure against type confusion.
Reentrancy Attacks
CDAs are not the only attacks that could happen to the exchange service of Figure 1. Figure 2 shows a reentrancy attack [17], in which the attacker causes the deputy to be called again before it finishes its first call. In this attack, the attacker writes a U-labeled contract that invokes exchange.swap when called. This callback causes the exchange service to be recursively called many times before any call returns, adjusting the exchange rate returned by the price oracle in favor of the attacker.

Figure 2. Reentrancy attack against the exchange service. The exchange service “locks” the trusted control flow level on call #1. Call #2 sends control flow back to untrusted code, but the lock prevents call #3 from reentering trusted control flow.
As observed by Cecchetti et al. [12], a reentrancy attack exploits contracts where invariants over trusted state are expected to hold before and after external function calls. In the example from Figure 2, the (trusted) exchange rate is expected to remain stable from line 2 to line 4. The attacker indirectly influences that trusted state by diverting the control flow to call oracle.quote() multiple times before exchange.pay() is called.
Statically modeling reentrancy attacks requires reasoning about the effects of functions on trusted state. To account for that, we introduce a bounding label on function types, to upper-bound the level of effects during function execution. The function exchange.pay() is a -function that can only be called in a trusted context and updates the trusted state of the exchange. Bounding labels are contravariant because a function with an untrusted bounding label also satisfies trusted effect bounds. The function exchange.swap() is an auto-endorsing [12] function,1 which can be called in an untrusted context but updates the trusted state of the exchange. The function adv.reenter() is also an auto-endorsing function because it calls the auto-endorsing function exchange.swap().
Auto-endorsement, like any form of endorsement, carries some danger because it allows an untrusted control-flow context to influence trusted control flow and state. However, such functions are indispensable for building software, including smart contracts. As another example, untrusted code (applications) must be able to influence trusted (kernel) state via operating system calls.
As observed by Cecchetti et al. [12], reentrancy attacks are caused by unconstrained use of auto-endorsing functions. Bounding label annotations on function pointers enable static analysis to identify auto-endorsing functions, which prevents these attacks.
Similar to CDA, reentrancy attacks can be prevented by static checks in the ideal world where attackers are well-typed: on line 2 of Figure 2, the attacker uses adv.reenter, a -function, as an argument of type . But an ill-typed, real world attacker may lie about its function signature by publishing as the signature of adv.reenter. The dynamic check that allows the ideal world and the real world to agree is a dynamic lock mechanism, adapted from Cecchetti et al. [12]: when a function is called, it locks its own level of control flow until it returns. In the example from Figure 2, the exchange service locks its control-flow level from lines 2 to 4. Any function call that enters from is rejected, so execution aborts the first time adv.reenter() tries to invoke exchange.swap().
Control-Flow Hijacking
Figure 3 extends the same exchange code with a validation step. If the validation fails, it executes the error continuation onReject that never returns, preventing the exchange from happening.

Figure 3. Ordinary-type confusion bypasses order validation through a returning error continuation. A well-typed argument for onReject is a function that either diverges or aborts, but does not return.
For well-typed attackers, the type of onReject ensures that the exchange is only executed when the order validates. Ill-typed attackers can bypass validation by simply providing a function adv.ignore with a unit return type, so the order keeps executing.
Here, type confusion is used on the ordinary unlabeled part of the type. Reasoning about such attacks requires specifying how values are interpreted at incompatible types—for example, what happens when an integer is used as a function pointer. We keep the cast semantics abstract and assume that honest code can inspect the declared ordinary signatures of function pointers and reject incompatible pointers eagerly at run time. We leave a systematic study of the broader trade-offs among cast semantics, runtime assumptions, and dynamic enforcement to future work.
Type-Confusion Security
The examples from §2 show that an attacker who lies about types can cause program behavior that is not possible for an attacker who obeys the type system. Our proposed dynamic checks abort at run time to ensure that the real attacker cannot introduce new behavior. Type-confusion security requires that all real attackers can be simulated by ideal attackers.
In the ideal world, both the honest party and the attacker are well-typed programs and no run-time checks are inserted. Whatever properties the static type system enforces must hold in the presence of the attacker. In the real world, the attacker is an unrestricted state machine that can produce arbitrary ill-typed values. To protect against this strong attacker, the program must in general be translated, to instrument it with dynamic enforcement mechanisms.
Type-confusion security is defined by quantifying over all valid real attackers, and for each valid real attacker, there must be a valid ideal attacker. We write to mean that is a valid real attacker, and to mean that is a valid ideal attacker (for example, it needs to type-check).
Definition 3.1 (Type-Confusion Security). Consider the real world , and the honest programs’ dynamic checks . The ideal world is , with ideal-program dynamic checks . Let denote the behavior of the program linked with the attacker under . We define type-confusion security as follows:
We write when the worlds simulate each other: that is, and .
Proving Type Confusion by Composing Simulations
Our proof follows the strategy of context-based backtranslation [18, 30]: for every real attacker, we construct a simulator, which is an ideal attacker that simulates the observable behavior of the real attacker. As simulation-based security is transitive, multiple simulators can be composed to construct a bigger simulator. Figure 4 visualizes our end-to-end type confusion proof, which is built from 3 smaller type confusion proofs connecting 4 worlds: Worlds 0–3.
Figure 4. The four worlds and their attackers.
World 3 is the most “ideal” world. Both programs and attackers are implemented as well-typed code from our core calculus, and no dynamic security enforcement is needed. To avoid restricting the computational power of attackers to dynamically make decisions based on run-time values, such as inspecting security types, we assume ideal attackers can access a set of well-typed pure functions that may arbitrarily transform their input values. In World 0, the most “real” world, an attacker is an arbitrary state machine that does not respect types, and multiple dynamic enforcement mechanisms are needed. Worlds 1 and 2 give the attacker powers intermediate between Worlds 0 and 3. In World 1, the attacker is a state machine that behaves however it wants internally but behaves at its interface in a way that respects ordinary types (but not security labels). In World 2, the attacker is a state machine that behaves however it likes internally but fully respects security types at its interface.
Ultimately, we prove type confusion holds between World 0 and World 3, with Worlds 1 and 2 as stepping stones. The most challenging part of the proof is to show that World 1 simulates World 2; this step turns dynamic IFC enforcement of complex security properties like reentrancy security and CDA security into purely static checks. Simulation between World 2 and World 3 shows that the attacker who is limited to well-typed code (plus additional well-typed pure functions) is just as powerful as a state-machine attacker.
By transitivity, the well-typed code attacker is as powerful as the arbitrary untyped state machine attacker, assuming that the World 0 dynamic enforcement mechanisms of safe casts and authority checks are in place at run time.
While our major result is the simulation from World 0 to World 3, the dynamic checks actually ensure that the backward simulation holds too: World 3 simulates World 0. It might seem trivial that backward simulation holds because the real attacker is strictly stronger. However, the backward simulation result is meaningful because an overly restrictive run-time check that rejects all function calls might make the main bottom-to-top simulation hold vacuously. The top-to-bottom, ideal-to-real simulation shows that the main result is not vacuous.
Threat Model
We consider a decentralized system with principals, some of which are controlled by the attacker. Each principal publishes its claimed public interface, which is a set of function pointers with their signatures. Implementations of functions on well-typed attackers and honest principals comply with the published signatures, but functions implemented by attackers do not follow the signatures.
A subtle but important difference between our threat model and those of prior work in gradual typing [9, 13] and dynamic IFC [12, 25, 34] is the degree of trust in the runtime system. Prior work designs dynamic mechanisms for a trusted runtime that also governs the attacker’s behavior. In contrast, we model a system with a minimalist runtime that cannot control the attacker, and instead ensure that security checks happen exclusively in honest code. Specifically, we assume that the following. First, the callee in a remote call learns who the caller is, what the arguments are, and nothing else. Second, all function pointers are publicly callable, so there is no mechanism for restricting the visibility of function pointers. Finally, all static analysis is modularly enforced per function and may refer to the potentially incorrect function signature table.
Information Flow Labels
Intuition for why CDA and reentrancy attacks are the only kinds of IFC type confusion can be obtained by taking a closer look at IFC labels and the subtyping lattice of IFC types.
IFC Label Model
In an IFC type system, each type includes a label that governs the use of values of that type [37]. In this paper, we adopt the label model of Arden et al. [6], Ren et al. [35], where each principal is also a security policy label . A value annotated by is trusted by the principal . Labels form a bounded distributive lattice, where join and meet take the greatest common integrity and least combined integrity respectively. The attacker controls a prime filter [35] of the lattice.2 Given a type , we write to denote the label of the type. We do not consider confidentiality.
The flows-to order between labels represents the direction of secure information flow. Ordering holds when is at least as trusted as . The bottom element represents the most trusted label never controlled by the attacker, and the top element represents the least trusted label always controlled by the attacker.
IFC Function Signatures
Function signatures have the form , where is the input type and is the output type. As introduced in § 2, the external pc upper-bounds the contexts in which the function may be called; the bounding pc upper-bounds the effect of the function starting from its invocation to its return. Like other types, function types include an extra label , the label of the function pointer itself.
In a decentralized system, an IFC-labeled function type is a security specification. As certain security specifications can be self-contradictory, such function types are considered ill-formed. Let be the principal on which this function is defined. A well-formed function type is one where . First, because each function runs at its own control-flow integrity, the upper bound on effects needs to be at least as trusted as itself. Second, a principal should be allowed to call its own function, so needs to be no less trusted than . Finally, should hold; if not, this function would take trusted input from an untrusted context that taints any value it holds, causing a contradiction. Figure 5 shows the subtyping lattice of IFC function types. As the lattice shows, the output label is covariant; the input type , external pc , and bounding pc are all contravariant.

Figure 5. The subtyping lattice of well-formed function types. Type confusion occurs when a down-cast happens to a fully untrusted pointer.
Type Confusion of IFC Function Types
In trusted code, the only way to statically type a useful function pointer received from an attacker is the type . To see why, first observe that all pointers from the attackers are -labeled. This label taints all labels except in a function pointer [12, 46]. Therefore, the type system gives all attacker-controlled pointers the type or .
In a trusted context, pointers of the second type can be passed or returned, but cannot be directly invoked because invoking them leads to a potential reentrancy attack. Thus only the first kind can be used in a trusted context.
Therefore, IFC-type confusion only happens when an attacker performs a down-cast to a -typed pointer, and then passes the pointer to the honest principal (deputy). As shown in Figure 5, there are three possible down-casts, one for each contravariant label. CDAs and reentrancy attacks are the cases where down-casts happen on and . Type confusion on primitive (non-function) input types can be statically enforced because the deputy treats inputs of such pointers as untrusted. In the case where the input type is itself another function type, well-formedness of IFC types statically ensures that no such type confusion is possible.
A Core Calculus for Type Confusion
We define a core calculus to formally model a decentralized system that supports first-class function pointers and remote function calls. We represent honest principals by their program code and the attacker by an interactive state machine, which is linked to the program at run time.
Syntax for the Honest Party
Figure 6 defines the syntax of the core calculus. This language models a decentralized system with multiple principals . Each principal can also be interpreted as a label , which can be used to describe the integrity of values. Principals own functions and memory cells. We write for the identifier, or pointer, of the function owned by principal .

Figure 6. Syntax of the core calculus. Principals and labels range over the same lattice .
A program consists of an interface, a body table and an entry function belonging to principal . The interface pairs a signature table , which maps each declared function to a signature, with a cell table , which maps each cell to the type of its contents. The body table maps each implemented function to a closed lambda term (i.e., ), where denotes a finite partial map. We use and to range over elements of and respectively. respectively. Every execution starts at , which belongs to the least trusted principal with signature . Thus, all executions are initiated by the attacker.
Programs must satisfy two well-formedness conditions. First, all three tables have finite domains, because a program is a finite artifact. Second, , so every implemented function has a published signature. Note that the converse need not hold, an honest party does not know the implementation of an attacker in general (§ 4.3).
Types are equipped with information-flow labels in the standard way [37, 47]. Booleans, natural numbers, and function pointers each carry a label denoting the integrity policy of the label. The unit type and the empty type have at most one inhabitant, and thus do not require labeling.
Values and expressions are mostly standard and written in A-normal form [19]. The language aims to be practical, and thus supports endorsement [24] of non-function-pointer values as strict noninterference is too restrictive. Endorsement of function pointers is disallowed because it does not add meaningful expressiveness, and it adds a new surface for type-confusion attacks.
A principal can only read directly from and write directly to a cell that it owns; remote read and write must be provided by “getter” and “setter” functions. A function application is annotated with the pc used for this function call. In well-typed code, can be inferred and is equal to the external pc of pointer ’s function type. We add it to the syntax explicitly because it is used by run-time checks.
As a program executes, it produces a trace of events . We write :: for list concatenation, treating individual elements as singleton lists. A write event records that writes to its cell , and a call event records a call to together with its calling pc , the caller’s label joined with the call’s annotation. A return event records that a function owned by returns. Finally, records that the run aborts, and records that it exits gracefully once the entry returns.
Static Semantics
IFC typing. Figure 7 defines the judgments and . The former checks an expression , run by principal at pc with bounding pc , against type .3 The latter gives IFC subtyping rules which are standard.
Figure 7. Full IFC subtyping and selected expression typing rules.
Figure 7 shows selected rules, and §B gives the full type system. Most rules are standard [45, 46]. Well-typed code can access only addresses declared by cell. TI-READ and TI-WRITE access only the declared cells of , and ensures that the cell’s label covers the control flow that reaches the access. TI-DOWNGRADE applies to values that are not function-typed and sets its label to . In particular, function pointers cannot be endorsed, so their types retain all taints to them.
Function pointers require more care. Since the owner controls how behaves, a pointer to it is trusted only as much as is, so TI-FUN requires . Combined with the well-formedness conditions of signatures from § 3.3.2, well-formedness of types, written , is given by:
TI-APP enforces the static discipline of function calls through three constraints. First, allows a call only when the external pc covers both the caller’s pc and the influence over which function the pointer selects. Second, ensures that a call enters at an untrusted level only to the extent that the callee stays that untrusted throughout or the caller already was, which forbids the control-flow endorsement behind reentrancy [12]. Third, the caller’s bounding pc constrains every function it calls, so the constraint accepts only calls within such a bound. The result type joins the label of with (see §B.1 for formal definitions), since the resulting value reveals which function the pointer selected.
Ordinary typing. Ordinary typing follows the standard type system of the simply-typed lambda calculus, and is isomorphic to IFC typing over the one-point label model . For brevity, we write , and for ordinary typing rules. We write for the unlabeled type that results when every label and pc annotation is erased from . With the one-point label, every label premise in trivially holds, so only the ordinary-type premises remain. We show TR-Fun, TR-App and TR-Down, and the rest of the type system can be found in Figure 16.
Figure 16. Ordinary expression typing.
Note that an IFC-typed expression is also ordinarily typed .
Program typing. An interface is well formed when every cell type and every signature is well formed (§ 3.3.2).
A program is IFC-typed when its interface is well-formed, and every function body is typed against the corresponding signature.
The body runs at pc with result , which models auto-endorsement on entry and is exactly the trust that in TI-App guards. Interfaces in World 1 are trivially well-formed, so holds when every body satisfies the ordinary typing judgment . From above, every IFC-typed program is also ordinarily typed ().
Attackers
State Machine Attacker. Figure 8 presents the definition of a state machine attacker , which controls a set of principals that forms a prime filter, as explained in § 3.3.1. The attacker’s behavior is given by an interactive state machine with private state State [32]. Whenever control passes to the attacker, the receive function updates the state with the incoming message, which either invokes an attacker-owned function on an argument or returns a result from an earlier call. The transition function then either takes an internal step or emits an action, calling a function at label , returning a value , or aborting. Because is total, an attacker can spin by only taking internal steps. The state machine can model attacker code written in a different language.

Figure 8. An attacker controls the principals , declares the signatures , and behaves as the state machine , which receives messages via and emits actions via .
Linking an attacker with a program is denoted by . The attacker contributes a finite signature table , which declares functions owned by principals in . The linked interface extends but never overrides the program’s own,
Thus besides declaring new functions, the attacker can also replace an existing function, without changing its signature, if that function belongs to an attacker-controlled principal. Signatures of attacker functions are merely claims, because is free to break them.
Attacker Boundary. The attacker and the program interact only across the boundary between them, where control enters as a message and leaves it as an action. Each world admits a different class of attackers, and the classes differ only in the typing that must respect at this boundary. The rest of this subsection defines the IFC-typed boundary for World 2 and the ordinarily typed boundary for World 1. Attackers in World 0 are unconstrained and attackers in World 3 are programs but not state machines. They are described in sections 5.2 and 5.3, respectively.

Figure 9. Reachable configurations of an attacker under typed messages.
A message or action is typed in a world W against the signature of the function it concerns in the linked interface , written .
| W = W₂ | W = W₁ | |
An action emitted by is well typed when
| W = W₂ | W = W₁ | |
| always | always |
A call is thus one that the attacker function could have made from some program point of a well-typed body, and a return delivers what a well-typed body of would produce. The World 1 judgments use ordinary typing against and .
In Figure 9, a configuration pairs the state of with the running attacker function , or when control is outside, and with a stack of pending calls. A pair in records that called and awaits its result. R-Invoke and R-Result are the only rules that receive messages, and both require those messages to be well-typed with respect to W. R-Result delivers a result only to the innermost pending call, which makes the run well-bracketed in the sense of game semantics [4]. No rule continues after an abort.
Definition 4.1 (Boundary typing). An attacker is boundary-typed in W, written , when and imply .
A boundary-typed attacker is never the first to break typing [2]. The condition constrains only after messages that a well-typed program can send.
Dynamic Semantics
Figure 10 gives the semantics of honest code in the standard style of evaluation contexts [43]. This semantics leaves every interaction with other principals to the linked semantics, which ensures that honest code runs the same way in every world (except for dynamic checks).
Since expressions are in A-normal form, an evaluation context is either a hole or a let whose bound expression is in focus, so serves naturally as a call frame. The store is the run-time state. The judgment steps under principal to an outcome with a trace of at most one event. The outcome either continues as an expression or yields an action for
Fig. 10. Operational semantics of honest code.
linked semantics together with an evaluation context. The judgment lifts through evaluation contexts, where S-Internal covers internal steps and the remaining rules cover interactions.
Most rules for the honest program’s operational semantics are standard. R-Op, R-If and R-Let reduce operators, branches and lets as usual, and R-Down leaves its value unchanged since a downgrade affects only the static type. R-Read and R-Write access only the running principal’s cell , and as is standard we treat each write as an effect and record its update as an event. The event shows , with and otherwise, since a pointer is observable only by calling it.
Calls, returns and aborts are the only ways to interact with other principals. R-Call turns a call into a call action, and S-Emit passes this action to the linked semantics along with its call frame , so the caller resumes as once the call returns . A body that reduces to a value hands it back to its caller through S-Ret, and an abort anywhere in the body ends the whole run through S-Abort.
Linked Semantics. Honest code and the attacker machine are each an open system whose interactions with the other side remain unresolved. The linked semantics accounts for the interaction of two heterogeneous parties [23], and closes the system by running both over one shared call stack
The call stack’s head is the running frame, and its tail holds the awaited callers. An honest frame holds the expression that evaluates, and an attacker frame holds an abstract frame whose form depends on the attacker; for the state machine , which keeps its continuation in its state, is trivially the unit value and we write for convenience. We write for the function that a frame runs.
A configuration holds the attacker state , the store and the stack . A run halts on an empty stack. Each world defines a step relation that emits a trace of at most one event, and its reflexive, transitive closure concatenates the emitted events. Linking requires an implementation for every honest function declared in . A run starts from an initial store , with running the attacker-owned entry on the unit value.
Figure 11 defines the linked semantics in two layers. The frame step advances the top frame in isolation and produces either an updated frame or an action . An honest frame running steps its expression under the honest semantics at principal . Specifically, an internal step updates the frame (F-Honest), and an action leaves the frame in place to await a return (F-Honest-Act), both of which may modify the store . Similarly, an attacker frame steps by to a new state (F-Attacker) or an action (F-Attacker-Act).

Figure 11. Frame and linked steps.
The linked step advances the whole configuration according to the outcome of . L-Step replaces the top frame with the result of one internal step. L-Call requires the called value to be a pointer declared in the linked signature table . The rule then calls at ,
where and
where and
which implies that no call is more trusted than its caller. L-Ret pops the returning frame and passes the result to together with the caller’s frame , as is treated differently for honest and adversarial callers, as indicated below.
The helper functions and share the same structure. The former pushes a frame for the callee and records , and the latter resumes the caller and records . The events record only what the trusted party sees [7], namely the activations of honest code, with each call event marking an honest frame’s entry and each return its exit. Calls into the attacker and returns from it are therefore silent, and replaces an attacker label with .
The attacker accepts every value without checks. On a message, either or , the attacker steps into a new state via . In contrast, a value can be passed into the honest party only after it has been vetted by the run-time check in that world. A call must pass , and converts the argument at the callee’s input type and the result at its output type . If any check fails, the run aborts.
Dynamic Checks. Figure 12 shows the semantics of call and return. The dynamic checks are defined in . The partial function converts a value entering honest code at type and is undefined on values the world intends to reject. The total function converts the values that the next step of uses, before F-Honest and F-Honest-Act take that step. For instance, World 2 permits every call and passes every value unchanged:

Figure 12. Call and return semantics. The function defines the run-time checks.
World 1 also passes every value unchanged, but checks each call at run time:
where is the set of principals with an honest frame on . The condition enforces the callee’s external , and enforces the reentrancy lock that each honest principal on the stack holds until it returns. Intuitively, an attacker lies in and, by primality, never flows to for honest and , so the attacker cannot call honest code at all once an honest frame is on the stack.
Type-Confusion Security via Simulation
We now show that the type-confusion security definition from §3 holds for worlds and .
The behavior of a linked system is what an observer sees over an entire run. Since runs are deterministic, the traces reachable from the initial configuration form a chain under the prefix order, and the behavior is their least upper bound, a (possibly infinite) trace. When linking a trusted open program with an attacker succeeds—namely, when every honest function declared in sig is defined—the behavior of running the linked system in world from store is:
Note that a run that halts ends its trace with ✓ or ⊥. Equivalently, we can describe the behavior as the set of finite prefixes of traces.
We compare behaviors only from initial stores whose trusted cells hold values of their declared types under IFC typing, since the trusted program is IFC-typed. A store is well typed for a cell table cell when every cell declared in cell holds a value of its type,
and we write for , the restriction of cell to the principals outside .
It remains to refine type-confusion security.
Definition 5.1 (Simulation). Consider worlds and and a trusted program with . World simulates , written , meaning that ’s attackers are no stronger than ’s, iff
Theorem 5.2 (Type-Confusion Security). If , then . That is, Figure 4 holds.
Simulation between Worlds 1 and 2
Worlds 1 and 2 are equivalent for IFC-typed programs. World 1’s weaker type system lets attackers confuse IFC labels, and the run-time check removes exactly this power.
The direction is almost trivial. Consider an attacker that is boundary-typed in . Against an IFC-typed program, emits only actions well typed in , which pass the run-time check, so behaves the same in both worlds. The only complication arises when reasoning about ’s boundary typing in , which also covers messages that are typed in but not in , on which may emit an action ill typed in . The simulator therefore runs behind a guard. Its transition function follows , except that an action with is replaced by an internal step that leaves the state unchanged, where is the running function. Against an IFC-typed program, coincides with .
For , the simulator runs unchanged in since such an attacker respects ordinary types but not labels. Moreover, both the functions a attacker passes to honest code and the calls it makes may carry labels that IFC typing rejects.
Figure 13 sketches the simulator for . First, a call between two functions owned by emits no observable event, but the labels of the passed arguments may not be IFC-typed, which violates boundary typing. therefore emulates such a call in-house (Figure 13a) instead of explicitly emitting such a call.

Figure 13. Simulator for . Shaded boxes contain attacker functions; is honest. Dashed arrows denote internal simulation steps.
Then, may hand a pointer to one of its functions to honest code, which expects a type . Ordinary typing, however, checks only against , so a label mismatch may leave for all allowed labels. In this case, instead hands over a pointer to an adapter (Figure 13b), a fresh function whose signature is derived from . Specifically, pointer to has type , which is a subtype of at label . Since a pointer is labeled by the owner of its function, picks , which is an attacker principal by upward closure of . Here is the owner of the function of that returns the pointer, because a returned value also carries the label of its function, and when the pointer is passed as an argument instead. The adapter has no behavior of its own; when honest code calls , runs at . Honest code may also hand this pointer back, and then replaces it by the pointer to , which is what would receive in .
Finally, may call an honest function with external pc , which the run-time check of (§ 4.4) permits only when no honest frame is on the stack. IFC typing, however, rejects this call from the outermost frame of , which runs at . therefore detours through a trampoline (Figure 13c), a fresh function declared at , which any frame may call. The trampoline then completes the call of at , which is an attacker principal due to upward closure of . Because serves every call with external pc , it takes only a unit argument, so the actual argument travels through the private state of , with each function pointer replaced by its adapter at , and the result returns the same way. The program mentions only finitely many types and labels, so declares only finitely many adapters and trampolines.
must abort whenever refuses a call. This happens when a call of into honest code fails the run-time check, and when honest code calls a pointer to an honest function that handed over. That pointer carries an attacker label, so in honest code calls it at an attacker pc above its own frame, which the run-time check refuses, whereas in the call reaches an adapter. As in the proof of , a guard for makes boundary-typed by construction.
The proof relates each configuration of running to one of running , where both hold the same state of and their honest code and cells agree once adapters are renamed back. Each step in World 1 is matched by one step in World 2, or by two through a trampoline, where the extra step is silent since the trampoline belongs to the attacker. When is stuck, spins silently, and on related runs the guard never intervenes. Therefore, both runs produce the same behavior, and we can conclude that .
Simulation between Worlds 0 and 1
In reality, an attacker need not respect even ordinary types. It may hand honest code a number or a pointer where a boolean is expected, and the honest code must somehow interpret that value. This interpretation is modeled by a function , where is reinterpreted at an unlabeled type . We assume that a cast to a data type , or yields a value of that type, while a to a pointer type may not. Honest code normalizes such a value using , which returns if it has type , and otherwise. The result is therefore well typed at every data type.
Like World 1, World 0 changes only the run-time checks (§ 4.4). It keeps the lock check, , and applies to pointers and data at different points. A pointer is coerced eagerly as it crosses the boundary. If is not a data type, then is when that value has type , and the run aborts otherwise. When is a data type, passes unchanged. Intuitively, since the signature table is fixed at compile time, an ill-typed pointer cannot be repaired, so honest code must reject it before running.
Data is instead coerced lazily. The check coerces such a value at the type of that use and leaves every other expression unchanged,
where is the operand type of , is the input type of and is the output type of . A return also counts as a use, so a confused value never leaves honest code.
As in § 5.1, we prove by showing that each world simulates the other (theorem 5.1). The direction is immediate. An attacker boundary-typed in is also an attacker in . By the boundary typing of , every value that reaches honest code is well typed. As a consequence, and do not change values, and the two worlds run in lockstep.
Conversely, an attacker of may send ill-typed values, which no boundary-typed attacker in can. As a result, we construct the simulator to run and cast eagerly. The simulator replaces each value that sends to honest code at type by the value that eventually uses (i.e., ), and aborts whenever rejects an ill-typed pointer.
A call of to its own function raises a further problem, since may pass an argument of any type, which hands to unchanged. Coercing it would change what receives, so, as in the proof of (§ 5.1), instead calls a fresh trampoline of , declared at , with , and the actual argument and result travel through the private state of . Every action of is therefore boundary-typed in , and the two worlds run in lockstep, so .
Simulation between Worlds 2 and 3
An attacker in World 2 is an arbitrary state machine, whose state and transitions need not be expressible in our language. We show that this generality gives the attacker no additional power by expressing every World 2 attacker as well-typed code with stateless external functions.
World 3 Attacker. Attacker code consists of an interface at principals in , a body table , a table of stateless external functions private to the attacker, and a store . Unlike a state machine, whose frame into is trivial (§ 4.4), attacker code follows honest code and takes to be the expression that evaluates. World 3 keeps the linked semantics and changes only the rules for attacker frames, which now step by the operational semantics of the honest party on without emitting any events. That is, we replace F-Attacker and F-Attacker-Act with the following rules:
F-Code
F-Code-Act
Consequently, calls into and returns to attacker code no longer pass through , the receive function of the state machine. As with honest code, a call to with pushes the frame to when , or to when is external, and a result returned to an attacker frame is plugged into its suspended expression.
Attacker code is well typed when its interface agrees with the program’s, its bodies and cells are well typed against the linked interface, and its external functions are private and respect their signatures,
where means the two interfaces agree on every function and cell they both declare (§B.1), and is their componentwise link (, ). is defined the same way as linking in § 4.3 (§B.1).
As before, follows from two simulations. The direction holds by type safety. Given well-typed code , we construct a state machine simulator whose state is and the frames of . The simulator has the same behaviors as , since its receive function starts the body of on each invocation and continues the waiting call on each result, and its transition steps that call by F-Code and F-Code-Act. The simulator is boundary-typed in , since by progress and preservation every action that well-typed code emits is well typed.
The converse direction is harder, since may be any state machine, while attacker code has only typed cells and stateless external functions. Given an attacker , we construct code that runs step by step. The code keeps the execution history of in a single cell of type , which records every invocation and every result that receives and every step that takes. For each function of , the code of in records the invocation in and then repeatedly obtains the next step of from an external function that replays the history, recording and performing each such step.
The code has the same behavior as , since performs every step of with only silent bookkeeping steps in between. The code is also well typed, since the external functions of return a default value of the declared type on any input whose replay yields an ill-typed value, and the code of would diverge on a call to a function that may not call. Neither fallback occurs, since every history in arises from a run of and is boundary-typed.
Applications
We can now prove that well-typed programs are free of confused deputy and reentrancy attacks in all worlds, to . Each property is proved in a single world and transfers to the other worlds by theorem 5.2.
Confused Deputy Attacks
A CDA happens when an attacker calls a trusted function from a context less trusted than the function’s external pc admits.
Definition 6.1 (CDA Security). Consider a program and a world W. We say that is free from confused-deputy attacks in W if, for all attackers and stores such that and and , the following holds.
where and is the set of attacker-controlled labels.
For an attacker call, theorem 6.1 requires only . This is because the trace shows the attacker’s pc as and, by upward closure of , an attacker pc that flows to places in .
Theorem 6.2 (CDA Security). If , then is free of confused-deputy attacks in to .
Proof. We prove the theorem for , and the result for the other worlds follows from theorem 5.2. In , TI-App types every call into honest code, including the calls of the boundary-typed attacker. The premise of TI-App gives . If , the second case holds. If , then by upward closure of , which proves the first case.
Reentrancy Attacks
A reentrancy attack, as in Figure 2, calls back into trusted code while a trusted function waits on an untrusted call. We write and for the numbers of call and return events in a trace , and when is a prefix of .
Definition 6.3 (Reentrancy Security). We say that is free from reentrancy attacks in if, for all attackers and stores such that and , and , and for all traces and , functions and , and labels and , the following holds.
The second premise states that has not returned when is called. Note that the attacker calls no honest code while an honest function waits, since the trace shows the attacker’s pc as , which by primality never flows to .
Theorem 6.4 (Reentrancy Security). If , then is free of reentrancy attacks in to .
Proof. We prove the theorem for , and the result for the other worlds follows from theorem 5.2. In , when is a lock on the call stack when is called, the dynamic check ensures that the calling pc flows to . An honest calling pc appears unchanged in the trace, and an attacker pc fails the check by primality.
Related Work
At a high level, our proof follows the standard context-based backtranslation strategy [18, 30, 30], where the attackers are contexts. Instead of defining a translation of calculus terms, we use a technique standard in the tradition of state-machine refinement [26] to separate the argument about boundary typing from the language implementing the attacker.
Hennessy et al. [22], Riely and Hennessy [36] aim to provide secure execution in a decentralized system in which not all code is well-typed. They have a different system setting: instead of RPC calls, principals send code blocks to each other. Besides, their major result is subject reduction, while we define and prove a novel security objective.
Rajani et al. [34] formally characterize CDA vulnerabilities and show that capabilities cannot prevent all CDAs. Compared to their setting, our system supports first-class function pointers, and we assume a weaker runtime. They showed that CDAs are only prevented when Full Provenance is enforced. This is the same insight as using information flow control for both control flow and data flow in our work. Our major theoretical result is a simulation theorem that generalizes to other kinds of attacks, and CDA security is just an instance of our results.
Our approach to reentrancy is inspired by SeRIF [12], a core calculus that enforces secure reentrancy using a combination of both static and dynamic IFC. World 1’s dynamic check is similar to that of SeRIF, but SeRIF does not handle type confusion.
The topic of our work resembles that of gradual typing [39, 42], but we have different settings and goals. At a high level, gradual typing studies how static type checking and dynamic type checking can be combined in a complementary way; type confusion is interested in providing assurance when code is linked to untrusted code that is neither statically nor dynamically typed. As a result, the two approaches yield different theorems [40, 42]. Gradual IFC languages [8, 9, 13, 41] are not fully decentralized; they rely on a system-wide runtime that enforces IFC on both the attacker and the honest parties.
Our enforcement against ordinary-type confusion and reentrancy mirrors the idea of Control Flow Integrity (CFI) [1, 31], a security policy that requires that all executions follow paths in a predetermined control-flow graph. This current work is more general: the above attacks are only a subset of attacks that our framework handles.
Conclusion
Although IFC type systems provide a well-studied approach to end-to-end security, their adoption remains challenging. This paper develops type-confusion security for IFC type systems, supporting modular enforcement of both data-flow and control-flow security. A promising future direction is to use type confusion as the security objective to guide the development of systems that modularly adopt new type systems.
AI Use
Codex and Claude Code assisted with Lean [28] development under human guidance, including assisting in the translation of pen-and-paper definitions and proofs, auditing proofs, and mechanizing the motivating examples. We designed the structure of the mechanization, including the language design, state-machine formulation, and the right abstractions, and we audited the result.
Data-Availability Statement
The supplementary material for this paper includes two artifacts: an appendix in PDF format and a Lean 4 [28] mechanization of the paper’s results. We will submit the Lean artifact for evaluation.
The Lean 4 mechanization includes all of the results, including the examples, from the paper as well as a file called README.md, which maps each result of the paper to its definition in the Lean artifact. The Lean artifact also contains some results that were not extensively discussed in the paper, such as type safety of both the honest programs and the system. The artifact contains no sorry and every result depends only on the standard classical axioms of Lean, namely propositional extensionality (propext), quotient soundness (Quot.sound), and choice (Classical.choice), which can be checked by running make axiom (AxiomsAudit.lean). The artifact uses Lean 4 and Mathlib [27].
The appendix includes more examples on CDA attacks, and missing definitions referred to by the main text.
Additional Examples: Model Context Protocol and Webhost
As we suggested in the introduction, the threat model is not exclusive to smart contracts. Figure 14 shows two additional applications that are subject to the same attacks.

Figure 14. The MCP host (left) executes the action associated with an unused user approval and delivers the result to the conversation through a custom callback sendToChat. The website host (right) calls the client’s archiveBuild callback to save a copy of the built artifact before verification and publication; substituting publish for that callback publishes before verification.
The code on the left implements an MCP (Model Context Protocol) host. The Model Context Protocol (MCP) connects AI applications to external tools, such as file editors and deployment services. The threat model of this MCP host is very similar to that of a smart contract: the actions and callbacks are often provided by third-party libraries with no standard way for specifying permission policies, and callbacks and callers are built using heterogeneous toolchains. A CDA substitutes the privileged tool executor for sendToChat, violating the executor’s external-pc restriction and executing a tool-generated proposal without separate approval. A reentrant callback violates its bounding pc by invoking the host again before the approval is marked as used, allowing one authorization to execute the action multiple times. A CFI attack supplies data in place of sendToChat, causing that data to be interpreted as a function pointer and redirecting execution to an unintended function. These attacks follow the same patterns as the exchange-service attacks explained above.
A cloud website service builds source code into deployable sites. As the service evolves, it may adopt IFC typing incrementally while retaining callbacks from older components. The host cannot assume that these callbacks obey its new security discipline, even when they are maintained by the same organization. The host in Figure 14 calls the client’s archiveBuild callback to upload the artifact to the client’s repository before verifying and publishing the site. Archiving also retains rejected builds for diagnosis. A CDA substitutes the privileged publisher for archiveBuild, violating the publisher’s external-pc restriction and publishing a site before verification. If builds share a mutable staging slot, a reentrant callback can violate its bounding pc by starting a nested trusted build that overwrites the pending release’s artifact. A CFI attack supplies data in place of archiveBuild, causing that data to be interpreted as a function pointer and redirecting execution to an unintended function. These attacks likewise follow the patterns of the exchange-service attacks.
Complete Definitions
Helper notations
We overload and write to join with the label of , and to set the label of to .
We also define , where and , to mean the two interfaces agree on every function and cell they both declare. That is,
We also define linking the signature and cell table as follows:
IFC typing
Figure 15 gives the full IFC expression typing, which, as stated in the main text, is mostly standard [45, 46]. Besides the rules of Figure 7, the figure contains the standard rules for values, variables, operators, let bindings, conditionals and subsumption. TI-Abort gives abort every well-formed type. TI-If checks each branch at , where is the label of the guard, and joins into the result type, since the result reveals which branch ran.
Figure 15. Full IFC expression typing.
An ordinary type drops every label and both pc annotations of ,
and replaces each in by . Figure 16 gives the full ordinary expression typing. This typing is isomorphic to IFC typing over the one-point label model, so each rule TR-X is TI-X of Figure 15 with every label premise removed and every type replaced by its erasure. The mechanization defines ordinary typing as this instance of IFC typing, which highlights the correspondence between the two typings.
World 3 semantics
Besides F-Code and F-Code-Act, World W replaces the attacker cases of and in Figure 11 with the following, and keeps all other rules of World W.
Complete Definitions
where and is as in Figure 11. To emphasize the correspondence among the worlds, the mechanization adds an abstraction layer that generalizes the attacker’s behavior. This layer runs the heterogeneous system of the honest party and the attacker on one unified semantics. F-Code
and F-Code-Act instantiate the attacker abstraction with attacker code, while F-Attacker and F-Attacker-Act instantiate it with interactive state machines.
Type Safety
As a sanity check, we show that a well-typed program linked with a well-typed (either IFC-typed or ordinarily typed) attacker never gets stuck. The proof lifts the standard progress and preservation lemmas for expressions to linked configurations. Both lemmas hold for IFC typing over any label lattice, so they also hold for ordinary typing, which is IFC typing over the one-point label model.
World 2
Progress states that a closed, IFC-typed expression never gets stuck. A value steps to a return action by S-Ret, and an expression that reaches abort steps to an abort action by S-Abort.
Lemma C.1 (IFC Progress). Consider a principal , labels and , an expression and a type such that . Then for every store ,
Preservation states that an internal step keeps the expression that runs at the result type of and keeps the cells of every principal well typed. We write for the restriction of cell to the cells of principal .
Lemma C.2 (IFC Preservation). Consider an interface , a function , an expression and a store such that , and . Then for every expression , store and trace ,
where .
Type safety lifts both lemmas to linked runs. Every configuration that a run reaches has well-typed honest cells and a well-typed running honest frame, and it either has halted or takes another step.
Theorem C.3 (Type Safety in World 2). Consider a program , an attacker and a store such that , and . Then for every configuration and trace ,
where .
World 1
World 1 satisfies the same three results with ordinary typing in place of IFC typing. In this subsection, the store typing checks each cell against its ordinary type with ordinary typing. Ordinary preservation needs no well-formed interface, since every erased interface is well formed.
Lemma C.4 (Ordinary Progress). Consider a principal , an expression and an ordinary type such that . Then for every store ,
Lemma C.5 (Ordinary Preservation). Consider an interface , a function , an expression and a store such that and . Then for every expression , store and trace ,
where .
Theorem C.6 (Type Safety in World 1). Consider a program , an attacker and a store such that , and . Then for every configuration and trace ,
where .
World 3
Type safety in world is syntactic. The judgment types the attacker code itself rather than the actions that the attacker emits, so the invariant also types the running attacker frame and the attacker store. The attacker code is typed in world , so the invariant uses IFC typing.
Theorem C.7 (Type Safety in World 3). Consider a program , attacker code and a store such that , and . Then for every configuration and trace ,
where .
Type safety in world also holds in the traditional form of initialization, preservation and progress. This form uses a typing judgment on configurations that also types the suspended frames.
Definition C.8 (Configuration Typing). Consider a program and attacker code . A configuration is well typed, written , if , and either or with
The judgment states that each frame of resumes well typed on a well-typed result of the frame above it. It holds for and for with
where and .
Theorem C.9 (Configuration Safety in World 3). Consider a program , attacker code and a store such that , and . Then , and for all configurations and and traces ,
where .
Theorem C.9 implies Theorem C.7. Initialization and preservation give for every reachable configuration , and contains the store and running-frame conditions of Theorem C.7.
References
- [1]Martín Abadi, Mihai Budiu, Úlfar Erlingsson, and Jay Ligatti. 2005. Control-flow integrity. In Proceedings of the 12th ACM Conference on Computer and Communications Security (Alexandria, VA, USA), (CCS ’05). Association for Computing Machinery, New York, NY, USA, 340–353. doi:10.1145/1102120.1102165DOI
- [2]Martín Abadi and Leslie Lamport. 1995. Conjoining specifications. ACM Trans. Program. Lang. Syst. 17, 3 (May 1995), 507–535. doi:10.1145/203095.201069DOI
- [3]Carmine Abate, Roberto Blanco, Deepak Garg, Catalin Hritcu, Marco Patrignani, and Jérémy Thibault. 2019. Journey Beyond Full Abstraction: Exploring Robust Property Preservation for Secure Compilation. In 32nd IEEE Computer Security Foundations Symp. (CSF). IEEE Computer Society, 256–271. doi:10.1109/CSF.2019.00025DOI
- [4]Samson Abramsky and Guy McCusker. 1999. Game Semantics. In Computational Logic, Ulrich Berger and Helmut Schwichtenberg (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 1–55.
- [5]Coşku Acay, Rolph Recto, Joshua Gancher, Andrew Myers, and Elaine Shi. 2021. Viaduct: An Extensible, Optimizing Compiler for Secure Distributed Programs. In 42nd ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI). ACM, 740–755. doi:10.1145/3453483.3454074DOI
- [6]Owen Arden, Jed Liu, and Andrew C. Myers. 2015. Flow-Limited Authorization. In 28th IEEE Computer Security Foundations Symp. (CSF). 569–583. doi:10.1109/CSF.2015.42DOI
- [7]Aslan Askarov and Andrew C. Myers. 2011. Attacker Control and Impact for Confidentiality and Integrity. Logical Methods in Computer Science 7, 3 (Sept. 2011). http://www.cs.cornell.edu/andru/ papers/robknowledge-lmcs.pdf
- [8]Abhishek Bichhawat, McKenna McCall, and Limin Jia. 2021. Gradual Security Types and Gradual Guarantees. In 2021 IEEE 34th Computer Security Foundations Symposium (CSF). 1–16. doi:10.1109/CSF51468.2021.00015DOI
- [9]Pablo Buiras, Dimitrios Vytiniotis, and Alejandro Russo. 2015. HLIO: Mixing Static and Dynamic Typing for Information-Flow Control in Haskell. In 20th ACM SIGPLAN Int’l Conf. on Functional Programming. ACM, 289–301. doi:10.1145/2784731.2784758DOI
- [10]Ran Canetti. 2001. Universally Composable Security: A New Paradigm for Cryptographic Protocols. In 42nd Symposium on Foundations of Computer Science (FOCS). IEEE Computer Society, 136–145. doi:10.1109/SFCS.2001.959888
- [11]Ethan Cecchetti, Andrew C. Myers, and Owen Arden. 2017. Nonmalleable Information Flow Control. In 24th ACM Conf. on Computer and Communications Security (CCS) (Dallas, TX). ACM, 1875–1891. doi:10.1145/3133956.3134054
- [12]Ethan Cecchetti, Siqiu Yao, Haobin Ni, and Andrew C. Myers. 2021. Compositional Security for Reentrant Applications. In IEEE Symp. on Security and Privacy. doi:10.1109/SP40001.2021.00084DOI
- [13]Tianyu Chen and Jeremy G. Siek. 2024. Quest Complete: The Holy Grail of Gradual Security. Proc. ACM Program. Lang. 8, PLDI, Article 212 (June 2024), 24 pages. doi:10.1145/3656442DOI
- [14]CoinDesk. 2021. Cross-Chain DeFi Site Poly Network Hacked; Hundreds of Millions Potentially Lost. https://www.coindesk.com/markets/2021/08/10/cross-chain-defi-site-poly-network-hacked-hundreds-of-millions-potentially-lost. Accessed August 2023.
- [15]CoinDesk. 2024. DeFi Protocol LI.FI Struck by $11M Exploit. https://www.coindesk.com/business/2024/07/16/defi-protocol-lifi-struck-by-8m-exploit/. Accessed October 2024.
- [16]Cointelegraph. 2023. Dexible aggregator hacked for $2M via ‘selfSwap’ function. https://cointelegraph.com/news/dexibleapp-aggregator-hacked-for-2m-via-selfswap-function. Accessed August 2023.
- [17]Phil Daian. 2016. Analysis of the DAO exploit. https://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/. Accessed March 2021.
- [18]Dominique Devriese, Marco Patrignani, Frank Piessens, and Steven Keuchel. 2017. Modular, Fully-abstract Compilation by Approximate Back-translation. Logical Methods in Computer Science Volume 13, Issue 4 (Oct. 2017). doi:10.23638/ lmcs-13(4:2)2017DOI
- [19]Cormac Flanagan, Amr Sabry, Bruce F. Duba, and Matthias Felleisen. 1993. The Essence of Compiling With Continuations. In ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI) (Albuquerque, New Mexico, USA) (PLDI ’93). 237–247. doi:10.1145/155090.155113
- [20]Joseph A. Goguen and José Meseguer. 1982. Security Policies and Security Models. In IEEE Symp. on Security and Privacy. 11–20. doi:10.1109/SP.1982.10014DOI
- [21]Norm Hardy. 1988. The Confused Deputy: (or Why Capabilities Might Have Been Invented). SIGOPS Oper. Syst. Rev. 22, 4 (Oct. 1988), 36–38. http://dl.acm.org/citation.cfm?id=54289.871709
- [22]Matthew Hennessy, Julian Rathke, and Nobuko Yoshida. 2005. SAFEᴰPI: A Language for Controlling Mobile Code. Acta Informatica 42, 4 (2005), 227–290.
- [23]Jérémie Koenig and Zhong Shao. 2021. CompCertO: compiling certified open C components. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (Virtual, Canada) (PLDI 2021). Association for Computing Machinery, New York, NY, USA, 1095–1109. doi:10.1145/3453483.3454097DOI
- [24]Eliza Kozyri, Stephen Chong, and Andrew C. Myers. 2022. Expressing Information Flow Properties. Foundations and Trends in Privacy and Security 3, 1 (2022), 1–102. doi:10.1561/3300000008DOI
- [25]Jed Liu, Michael D. George, K. Vikram, Xin Qi, Lucas Waye, and Andrew C. Myers. 2009. Fabric: A Platform For Secure Distributed Computation and Storage. In 22nd ACM Symp. on Operating System Principles (SOSP). 321–334. http://www.cs.cornell.edu/andru/papers/fabric-sosp09.html
- [26]Nancy A. Lynch and Mark R. Tuttle. 1987. Hierarchical Correctness Proofs for Distributed Algorithms. In 6th ACM Symp. on Principles of Distributed Computing. Fred B. Schneider (Ed.). ACM, 137–151. doi:10.1145/41840.41852DOI
- [27]The mathlib Community. 2020. The lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (New Orleans, LA, USA) (CPP 2020). Association for Computing Machinery, New York, NY, USA, 367–381. doi:10.1145/3372885.3373824DOI
- [28]Leonardo de Moura and Sebastian Ullrich. 2021. The Lean 4 Theorem Prover and Programming Language. In Automated Deduction – CADE 28: 28th International Conference on Automated Deduction, Virtual Event, July 12–15, 2021, Proceedings. Springer-Verlag, Berlin, Heidelberg, 625–635. doi:10.1007/978-3-030-79876-5_37DOI
- [29]Andrew C. Myers. 1999. JFlow: Practical Mostly-Static Information Flow Control. In 26th ACM Symp. on Principles of Programming Languages (POPL). 228–241. doi:10.1145/292540.292561DOI
- [30]Max S. New, William J. Bowman, and Amal Ahmed. 2016. Fully abstract compilation via universal embedding. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (Nara, Japan) (ICFP 2016). Association for Computing Machinery, New York, NY, USA, 103–116. doi:10.1145/2951913.2951941
- [31]Ben Niu and Gang Tan. 2014. Modular control-flow integrity. SIGPLAN Not. 49, 6 (June 2014), 577–587. doi:10.1145/2666356.2594295DOI
- [32]Marco Patrignani, Robert Künnemann, and Riad S. Wahby. 2022. Universal Composability is Robust Compilation. ACM Transactions on Programming Languages and Systems (2022). doi:10.1145/3436809
- [33]Marco Patrignani, Riad S. Wahby, and Robert Künnemann. 2019. Universal Composability is Secure Compilation. arXiv ePrint 1910.08634. doi:10.48550/arXiv.1910.08634DOI
- [34]Vineet Rajani, Deepak Garg, and Tamara Rezk. 2016. On Access Control, Capabilities, Their Equivalence, and Confused Deputy Attacks. In 2016 IEEE 29th Computer Security Foundations Symposium (CSF), 150–163. doi:10.1109/CSF.2016.18DOI
- [35]Silei Ren, Coşku Acay, and Andrew C. Myers. 2025. An Algebraic Approach to Asymmetric Delegation and Polymorphic Label Inference. In European Symposium on Research in Computer Security (ESORICS).DOI
- [36]James Riely and Matthew Hennessy. 2003. Trust and Partial Typing in Open Systems of Mobile Agents. J. Automated Reasoning 31, 3 (2003), 335–370.
- [37]Andrei Sabelfeld and Andrew C. Myers. 2003. Language-Based Information-Flow Security. IEEE Journal on Selected Areas in Communications 21, 1 (Jan. 2003), 5–19. doi:10.1109/JSAC.2002.806121
- [38]Fred B. Schneider. 2001. Enforceable Security Policies. ACM Transactions on Information and System Security 3, 1 (2001), 30–50. Also available as TR 99-1759, Computer Science Department, Cornell University, Ithaca, New York.
- [39]Jeremy Siek and Walid Taha. 2007. Gradual Typing for Objects. In 21st European Conf. on Object-Oriented Programming, 2–27.
- [40]Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015. Refined Criteria for Gradual Typing. In Summit on Advances in Programming Languages. https://api.semanticscholar.org/CorpusID:15383644DOI
- [41]Matías Toro, Ronald Garcia, and Éric Tanter. 2018. Type-Driven Gradual Security with References. ACM Transactions on Programming Languages and Systems 40, 4, Article 16 (2018). doi:10.1145/3229061DOI
- [42]Philip Wadler and Robert Bruce Findler. 2009. Well-typed programs can’t be blamed. In European Symposium on Programming.
- [43]Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Information and Computation 115, 1 (1994), 38–94. doi:10.1006/inco.1994.1093DOI
- [44]Siqiu Yao, Haobin Ni, Andrew C. Myers, and Ethan Cecchetti. 2024. SCIF: A Language for Compositional Smart Contract Security. Technical Report abs/2407.01204. arXiv. https://arxiv.org/abs/2407.01204
- [45]Steve Zdancewic and Andrew C. Myers. 2001. Robust Declassification. In 14th IEEE Computer Security Foundations Workshop (CSFW) (Cape Breton, Nova Scotia, Canada), 15–23. doi:10.1109/CSFW.2001.903133
- [46]Steve Zdancewic and Andrew C. Myers. 2001. Secure Information Flow and CPS. In 10th European Symposium on Programming (Lecture Notes in Computer Science, Vol. 2028), David Sands (Ed.). Springer Berlin Heidelberg, 46–61. doi:10.1007/3-540-45309-1_4DOI
- [47]Steve Zdancewic and Andrew C. Myers. 2003. Observational Determinism for Concurrent Program Security. In 16th IEEE Computer Security Foundations Workshop (CSFW) (Pacific Grove, California), 29–43. doi:10.1109/CSFW.2003.1212703DOI



