Docsity

Network Provenance: SNP for Adversarial Distributed Systems, Exams of History

Toggle sidebar
bg1
Secure Network Provenance
Wenchao Zhou
University of Pennsylvania
Qiong Fei
University of Pennsylvania
Arjun Narayan
University of Pennsylvania
Andreas Haeberlen
University of Pennsylvania
Boon Thau Loo
University of Pennsylvania
Micah Sherr
Georgetown University
ABSTRACT
This paper introduces secure network provenance (SNP), a
novel technique that enables networked systems to explain to
their operators why they are in a certain state – e.g., why a
suspicious routing table entry is present on a certain router,
or where a given cache entry originated. SNP provides net-
work forensics capabilities by permitting operators to track
down faulty or misbehaving nodes, and to assess the damage
such nodes may have caused to the rest of the system. SNP
is designed for adversarial settings and is robust to manip-
ulation; its tamper-evident properties ensure that operators
can detect when compromised nodes lie or falsely implicate
correct nodes.
We also present the design of SNooPy, a general-purpose
SNP system. To demonstrate that SNooPy is practical,
we apply it to three example applications: the Quagga
BGP daemon, a declarative implementation of Chord, and
Hadoop MapReduce. Our results indicate that SNooPy can
efficiently explain state in an adversarial setting, that it can
be applied with minimal effort, and that its costs are low
enough to be practical.
Categories and Subject Descriptors
C.2.4 [Computer Systems Organization]: Computer-
Communication Networks—Distributed Systems; D.4.5
[Software]: Operating Systems—Reliability
General Terms
Algorithms, Design, Reliability, Security
Keywords
Accountability, Byzantine faults, Distributed systems, Evi-
dence, Provenance, Security
1. INTRODUCTION
Operators of distributed systems often find themselves need-
ing to answer a diagnostic or forensic question. Some part
of the system is found to be in an unexpected state – for
example, a suspicious routing table entry is discovered, or a
proxy cache is found to contain an unusually large number of
advertisements. The operators must determine the causes of
this state before they can decide on an appropriate response.
On the one hand, there may be an innocent explanation: the
routing table entry could be the result of a misconfiguration,
and the cache entries could have appeared due to a workload
change. On the other hand, the unexpected state may be the
symptom of an ongoing attack: the routing table entry could
be the result of route hijacking, and the cache entries could
be a side-effect of a malware infection. If an attack or mis-
configuration is discovered, the operators must determine its
effects, such as corrupted state or configuration changes on
other nodes, so that these nodes can be repaired and the
system brought back to a correct state.
In this paper, we consider forensics in an adversarial set-
ting, that is, we assume that a faulty node does not neces-
sarily crash but can also change its behavior and continue
operating. To be conservative, we assume that faults can
be Byzantine [24], i.e., a faulty node can behave arbitrar-
ily. This covers a wide range of faults and misbehavior, e.g.,
cases where a malicious adversary has compromised some of
the nodes, but also more benign faults, such as hardware
failures or misconfigurations. Getting correct answers to
forensic queries in an adversarial setting is difficult because
the misbehaving nodes can lie to the querier. For example,
the adversary can attempt to conceal his actions by causing
his nodes to fabricate plausible (but incorrect) responses to
forensic queries, or he can attempt to frame correct nodes
by returning responses that blame his own misbehavior on
them. Thus, the adversary can gain valuable time by mis-
directing the operators and/or causing them to suspect a
problem with the forensic system itself.
Existing forensic systems are either designed for non-
adversarial settings [43, 50] or require some trusted com-
ponents, e.g., a trusted virtual-machine monitor [3, 21], a
trusted host-level monitor [27], a trusted OS [29], or trusted
hardware [7]. However, most components that are avail-
able today are not fully trustworthy; OSes and virtual ma-
chine monitors have bugs, which a powerful adversary could
exploit, and even trusted hardware is sometimes compro-
mised [20]. We argue that it is useful to have alternative
techniques available that do not require this type of trust.
We introduce secure network provenance (SNP), a tech-
nique for building forensic systems that can operate in a
completely untrusted environment. We assume that the ad-
versary may have compromised an arbitrary subset of the
nodes, and that he may have complete control over these
nodes. On the one hand, this very conservative threat model
requires some compromises: an SNP system can only answer
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Network Provenance: SNP for Adversarial Distributed Systems and more Exams History in PDF only on Docsity!

Secure Network Provenance

Wenchao Zhou

University of Pennsylvania

Qiong Fei

University of Pennsylvania

Arjun Narayan

University of Pennsylvania

Andreas Haeberlen

University of Pennsylvania

Boon Thau Loo

University of Pennsylvania

Micah Sherr

Georgetown University

ABSTRACT

This paper introduces secure network provenance (SNP), a novel technique that enables networked systems to explain to their operators why they are in a certain state – e.g., why a suspicious routing table entry is present on a certain router, or where a given cache entry originated. SNP provides net- work forensics capabilities by permitting operators to track down faulty or misbehaving nodes, and to assess the damage such nodes may have caused to the rest of the system. SNP is designed for adversarial settings and is robust to manip- ulation; its tamper-evident properties ensure that operators can detect when compromised nodes lie or falsely implicate correct nodes. We also present the design of SNooPy, a general-purpose SNP system. To demonstrate that SNooPy is practical, we apply it to three example applications: the Quagga BGP daemon, a declarative implementation of Chord, and Hadoop MapReduce. Our results indicate that SNooPy can efficiently explain state in an adversarial setting, that it can be applied with minimal effort, and that its costs are low enough to be practical.

Categories and Subject Descriptors

C.2.4 [Computer Systems Organization]: Computer- Communication Networks—Distributed Systems; D.4. [Software]: Operating Systems—Reliability

General Terms

Algorithms, Design, Reliability, Security

Keywords

Accountability, Byzantine faults, Distributed systems, Evi- dence, Provenance, Security

1. INTRODUCTION

Operators of distributed systems often find themselves need- ing to answer a diagnostic or forensic question. Some part of the system is found to be in an unexpected state – for example, a suspicious routing table entry is discovered, or a proxy cache is found to contain an unusually large number of advertisements. The operators must determine the causes of this state before they can decide on an appropriate response.

On the one hand, there may be an innocent explanation: the routing table entry could be the result of a misconfiguration, and the cache entries could have appeared due to a workload change. On the other hand, the unexpected state may be the symptom of an ongoing attack: the routing table entry could be the result of route hijacking, and the cache entries could be a side-effect of a malware infection. If an attack or mis- configuration is discovered, the operators must determine its effects, such as corrupted state or configuration changes on other nodes, so that these nodes can be repaired and the system brought back to a correct state. In this paper, we consider forensics in an adversarial set- ting, that is, we assume that a faulty node does not neces- sarily crash but can also change its behavior and continue operating. To be conservative, we assume that faults can be Byzantine [24], i.e., a faulty node can behave arbitrar- ily. This covers a wide range of faults and misbehavior, e.g., cases where a malicious adversary has compromised some of the nodes, but also more benign faults, such as hardware failures or misconfigurations. Getting correct answers to forensic queries in an adversarial setting is difficult because the misbehaving nodes can lie to the querier. For example, the adversary can attempt to conceal his actions by causing his nodes to fabricate plausible (but incorrect) responses to forensic queries, or he can attempt to frame correct nodes by returning responses that blame his own misbehavior on them. Thus, the adversary can gain valuable time by mis- directing the operators and/or causing them to suspect a problem with the forensic system itself. Existing forensic systems are either designed for non- adversarial settings [43, 50] or require some trusted com- ponents, e.g., a trusted virtual-machine monitor [3, 21], a trusted host-level monitor [27], a trusted OS [29], or trusted hardware [7]. However, most components that are avail- able today are not fully trustworthy; OSes and virtual ma- chine monitors have bugs, which a powerful adversary could exploit, and even trusted hardware is sometimes compro- mised [20]. We argue that it is useful to have alternative techniques available that do not require this type of trust. We introduce secure network provenance (SNP), a tech- nique for building forensic systems that can operate in a completely untrusted environment. We assume that the ad- versary may have compromised an arbitrary subset of the nodes, and that he may have complete control over these nodes. On the one hand, this very conservative threat model requires some compromises: an SNP system can only answer

queries about observable network state—i.e., state that has directly or indirectly affected at least one correct node— and its responses can be incomplete, although the missing parts are always clearly identified. On the other hand, an SNP system provides strong, provable guarantees: it ensures that an observable symptom of a fault or an attack can al- ways be traced to a specific event—passive evasion or active misbehavior—on at least one faulty node, even when an ad- versary attempts to prevent this. Two existing concepts, data provenance and tamper- evident logging, can provide a starting point for building SNP systems. Data provenance [4, 50] tracks and records data dependencies as data flows through the system. In the context of distributed systems, network provenance [50] is captured as a global dependency graph, where vertices are data items that represent state at a particular node, and edges represent local processing or message transmissions across nodes. This graph can then be used to answer foren- sic queries. Tamper-evident logging [17] can record data in such a way that forgeries, omissions, and other forms of tam- pering can be detected and proven to a third party. However, as is often the case in computer security, a sim- ple layering of these two concepts fails to achieve the de- sired goal. If an existing network provenance system, say ExSPAN [50], were combined with a system like PeerRe- view [17] that supports tamper-evident logging, an adversary could potentially subvert the resulting system by attacking it twice. The first attack would corrupt the system’s internal data structures; this would require a protocol violation that PeerReview could detect, but not diagnose or repair. With the data structures suitably damaged, the adversary could then carry out the second attack without further protocol vi- olations, and without leaving visible traces in the provenance system. Thus, the second attack would be invisible. We have designed SNooPy, a system that provides se- cure network provenance by combining evidence-based dis- tributed query processing with a novel provenance model that is specially designed with fault detection in mind. We have formalized SNP’s security properties, and we have proven that SNooPy satisfies them. To demonstrate SNooPy’s practicality and generality, we have implemented a prototype, and we have applied it to three example ap- plications: the Quagga BGP daemon [35], a declarative im- plementation of Chord [26], and Hadoop MapReduce [12]. Our evaluation demonstrates SNooPy’s ability to solve real- world forensic problems, such as finding the causes and effects of BGP misconfigurations, DHT routing attacks, and corrupt Hadoop mappers; our results also show that SNooPy’s costs (additional bandwidth, storage, and com- putation) vary with the application but are low enough to be practical. In summary, we make the following contributions:

  • A provenance graph for causal, dynamic, and historical provenance queries that is suitable for SNP (Section 3);
  • SNP, a method to securely construct network prove- nance graphs in untrusted environments (Section 4);
  • The design of SNooPy, a system that implements SNP for the provenance graph presented earlier (Section 5);
  • A proof of correctness for SNooPy (included in the appendix);
  • An application of SNooPy to Quagga, Chord, and Hadoop MapReduce (Section 6); and
  • A quantitative evaluation (Section 7).

Why did that route change just now?

Alice

Figure 1: Motivating scenario. Alice is running a distributed system and observes some unexpected behavior that may indicate a fault or an attack.

  1. OVERVIEW Figure 1 illustrates the scenario that we are addressing in this paper. An administrator, here called Alice, is operat- ing a distributed system – perhaps a cluster, a corporate network, or a content distribution system. At some point, Alice observes some unexpected behavior in the system and decides to investigate whether the behavior is legitimate or perhaps a symptom of a fault or an attack. Our goal is to enable Alice to query the system about the causes and effects of the unexpected behavior, and to obtain reliable results. To achieve this goal, we extend each node in the system with a monitoring component that maintains some forensic information. We refer to the system that is being monitored as the primary system and to our additional components as the provenance system. To be useful to Alice, the provenance system should have the following two high-level properties:
    • When the queried behavior is legitimate, the system should return a complete and correct explanation.
    • When the queried behavior is a symptom of a fault or misbehavior, the explanation should tie it to a specific event on a faulty or misbehaving node.

By behavior, we mean a state change or a message trans- mission on any node. We assume that Alice knows what behavior is legitimate, e.g., because she knows which soft- ware the system was expected to run.

2.1 Threat model Since we would like to enable Alice to investigate a wide range of problems, ranging from simple misconfigurations to hardware faults and even clandestine attacks, we conserva- tively assume Byzantine faults [24], i.e., that an adversary may have compromised an unknown subset of the nodes, and that he has complete control over them. Thus, the non-malicious problems are covered as a special case. We assume that the adversary can change both the primary sys- tem and the provenance system on these nodes, and he can read, forge, tamper with, or destroy any information they are holding. We also assume that no nodes or components of the system are inherently safe, i.e., Alice does not a priori trust any node other than her own local machine. Handling such a broad range of faults is challenging be- cause Alice cannot be sure that any data she is receiving is actually correct. When she queries a compromised node, the adversary can cause that node to lie or equivocate. In particular, he can try to forge a plausible explanation for the symptoms Alice has observed, or he can try to make it ap- pear as if the symptoms were caused by a different node. If

3.1 System model

For ease of exposition, we adopt a system model that is commonly used in database systems to reason about data provenance. In this model, the state of the primary system is represented as tuples, and its algorithm is represented as derivation rules [50], which describe how tuples are derived from the system’s inputs. Few practical systems are explic- itly built in terms of tuples and derivation rules, but this is not required to apply SNP: in Section 5.3, we describe three general techniques for extracting tuples and deriva- tions from existing systems, and in Section 6 we report how we applied these techniques to Quagga, Chord, and Hadoop MapReduce. Each node in a distributed system has its own set of tu- ples, and derivation rules can span multiple nodes. For ex- ample, the state of a router r might consist of tuples such as link(@r,a) to show that r has a link to a, or route(@r,b,c) to show that r knows a route to b on which the next hop is c. Here, link and route are the names of specific relations, and @r indicates that the tuple is maintained on r. The lower- case letters are constants; we later use upper-case letters for variables. Where the specific relation does not matter, we simply write τ @n to denote a tuple τ on a node n. Tuples can either be base tuples or derived tuples. Base tuples correspond to local inputs that are assumed to be true without derivations, e.g., a list of physical links that is input to a routing protocol. Derived tuples are obtained from other tuples through a derivation rule of the form τ @n ← τ 1 @n 1 ∧ τ 2 @n 2 ∧ · · · ∧ τk @nk. This is interpreted as a conjunction: tuple τ should be derived on n whenever all τi exist on their respective nodes ni, and τ should then continue to exist until at least one of the τi disappears. (If a tuple has more than one derivation, we can distinguish between them using a logical reference counter.) When a derivation rule spans multiple nodes, the nodes must notify each other of relevant tuple changes: if a node i has a rule that depends on a tuple τ @j, j must send a message +τ to i whenever τ is derived or inserted as a base tuple, and j must send −τ to i whenever τ is underived or removed. We require that all derivations are finite and have no cyclic dependencies. This can be achieved by carefully writing the derivation rules, and it holds for our three example applications. We assume that each node applies its rules deterministi- cally. Thus, we can model the expected behavior of a node i as a state machine Ai, whose inputs are incoming messages and changes to base tuples, and whose outputs are messages that need to be sent to other nodes. An execution of the system can then be represented as a sequence of message transmissions, message arrivals, base tuple insertions, and base tuple deletions. We say that a node i is correct in an execution e if i’s outputs in e are legal, given Ai and i’s inputs in e. Otherwise we say that i is faulty in e.

Routing example. The derivation rule route(@R,C,B) ← link(@R,B) ∧ route(@B,C,D) expresses network reach- ability in a router: a router R has route to C via B (route(@R,C,B)) whenever it has a link to another router B (link(@R,B)) that already has a route to C via some third router D (route(@B,C,D)). Here, R, B, C, and D are variables that can refer to any router. If we declare the link tuples to be base tuples and add another rule to say that each router has a route to its immediate neighbors, the re- sulting system implements a simplified form of path-vector routing [26].

3.2 Vertices and edges Having explicit derivation rules makes it very easy to see the provenance of a tuple: if a tuple τ was derived from other tuples τ 1 ,... , τk , then τ ’s immediate provenance sim- ply consists of all the τi taken together. To capture transitive provenance, we can define, for any execution e, a provenance graph G(e) = (V (e), E(e)), in which each vertex v ∈ V (e) represents a state or state change, and each edge (v 1 , v 2 ) in- dicates that v 1 is part of the provenance of v 2. The complete explanation for the existence of a tuple τ in e would then be a subtree that is embedded in G(e) and rooted at the vertex that corresponds to τ. The leaves of this subtree consist of base tuple insertions or deletions, which require no further explanation. V (e) consists of twelve vertex types. The following seven types are used to represent local states and state changes:

  • insert(n, τ, t) and delete(n, τ, t): Base tuple τ was inserted/deleted on node n at time t;
  • appear(n, τ, t) and disappear(n, τ, t): Tuple τ ap- peared/disappeared on node n at time t;
  • exist(n, τ, [t 1 , t 2 ]): Tuple τ existed on node n during interval [t 1 , t 2 ]; and
  • derive(n, τ, R, t) and underive(n, τ, R, t): Tuple τ was derived/underived on n via rule R at time t.

In contrast to other provenance graphs, such as the one in [50], the graph G we present here has an explicit rep- resentation for state changes, which is useful to support dy- namic queries. G also retains information about tuples that no longer exist, which is necessary for historic queries; note particularly that vertices such as delete, underive, and disappear would not be necessary in a provenance graph that contains only extant tuples. The timestamps t should be interpreted relative to node n. The remaining five vertex types are used to represent in- teractions between nodes. For the purposes of SNP, it is important that each vertex v has a specific node that is ‘re- sponsible’ for it. (We will refer to this node as host(v).) To achieve this property, derivations and underivations from remote tuples must be broken up into a sequence of smaller steps that can each be attributed to a specific node. For example, when a rule τ 1 @i ← τ 2 @j is triggered, we do not simply connect τ 1 ’s derive vertex to τ 2 ’s appear vertex; rather, we say that the provenance of τ 1 ’s derivation was i’s belief that τ 2 had appeared on j, which was caused by the arrival of +τ 2 on i, the transmission of +τ 2 by j, and finally the appearance of τ 2 on j. Thus, if j’s message is later found to be erroneous, i’s belief—and thus its derivation—is still legitimate, and the error can be attributed to j. The specific vertex types are the following:

  • send(n, n′, ±τ, t): At time t, node n sent a notification to node n′^ that tuple τ has appeared/disappeared; and
  • receive(n, n′, ±τ, t): At time t, node n received a message from node n′^ that tuple τ has ap- peared/disappeared.
  • believe-appear(n, n′, τ, t) and believe-disappear (n, n′, τ, t): At time t, node n learned of the (dis)appearance of tuple τ on node n′;
  • believe(n, n′, τ, [t 1 , t 2 ]): During [t 1 , t 2 ], node n be- lieved that tuple τ existed on node n′;

Finally, we introduce a color for each vertex v ∈ V (e). Col- ors are used to indicate whether a vertex is legitimate: cor- rect vertices are black, and faulty vertices are red. For ex- ample, if a faulty node i has no tuple τ but nevertheless sends a message +τ to another node, τ @i has no legitimate provenance, so we use a red send vertex to represent the transmission of +τ. In Section 4.2, we will introduce a third color, yellow, for vertices whose true color is not yet known.

3.3 Example: Minimum cost routing

a

b c

d

e

6 2

3 5

1 3

5

10

As a simple example, consider the net- work depicted on the right, which con- sists of five routers that are connected by links of different costs. Each router attempts to find the lowest-cost path to router d using a MinCost proto- col. There are three types of tuples: link(@X,Y,K) indicates that router X has a direct link to router Y with cost K; cost(@X,Y,Z,K) in- dicates that X knows a path to Y via Z with total cost K; and bestCost(@X,Y,K) indicates that the cheapest path known by X to Y has cost K. The link tuples are base tuples because they are part of the static configuration of the routers (we assume that routers have a priori knowledge of their local link costs, and that links are symmetric), whereas cost and bestCost tuples are derived from other tuples according to one of three derivation rules: each router knows the cost of its direct links (R1); it can learn the cost of an advertised route from one of its neighbors (R2); and it chooses its own bestCost tuple according to the lowest-cost path it currently knows (R3). Figure 2 shows an example of a provenance tree for the tuple bestCost(@c,d,5). This tuple can be derived in two different ways. Router c knows its direct link to d via link(@c,d,5), which trivially produces cost(@c,d,d,5). Similarly, router b derives cost(@b,d,d,3) via its direct link with d, and since no other path from b to d offers a lower cost, b produces the tuple bestCost(@b,d,3). b then combines the knowledge along with link(@b,c,2) to derive cost(@c,d,b,5) and communicates it to c.

3.4 Constraints and ‘maybe’ rules

We now introduce two extensions to the provenance graph. The first extension is a second type of rule, called a ‘maybe’

rule and written τ @n

maybe ←−−−− τ 1 @n 1 ∧... ∧ τk @nk , which stipulates that the tuple τ on node n may be derived from tuples τ 1 @n 1 ,... , τk @nk , but that the derivation is optional. In other words, as long as all of the underlying tuples are present, node n is free to decide whether or not to derive τ , and it is free to change its decision while the underlying tuples still exist. The rule merely describes τ ’s provenance if and when it exists. There are at least two situations in which ‘maybe’ rules are useful. The first involves a node on which some rules or tu- ples are confidential. In this case, the node can be assigned two sets of rules: one full set for the actual computation (without ‘maybe’ rules) and another to define provenance, in which the confidential computation is replaced by ‘maybe’ rules. The second set can then be safely revealed to queriers. Another situation involves a node with a black-box compu- tation, for which only the general dependencies are known. For example, a node n might choose a tuple τ from a set of other tuples, but the details of the decision process might

EXIST(c, bestCost(@c,d,5), [t5=min(t3,t4), now])

DERIVE(c, bestCost(@c,d,5), R3, t4) DERIVE(c, bestCost(@c,d,5), R3, t3) APPEAR(c, cost(@c,d,d,5), t4)

INSERT(c, link(@c,d,5), t4)

DERIVE(c, cost(@c,d,d,5), R1, t4)

APPEAR(b, bestCost(@b,d,3), t2)

BELIEVE-APPEAR(c, b, cost(@c,d,b,5), t3)

DERIVE(b, cost(@c,d,b,5), R2, t2) EXIST(b, link(@b,c,2), [t1, now]) APPEAR(b, link(@b,c,2), t1)

RECEIVE(c, b, +cost(@c,d,b,5), t3) SEND(b, c, +cost(@c,d,b,5), t2)

APPEAR(c, bestCost(@c,d,5), R3, t4)

APPEAR(c, link(@c,d,5), t4)

APPEAR(c, bestCost(@c,d,5), R3, t3)

INSERT(b, link(@b,c,2), t1)

APPEAR(b, cost(@c,d,b,5), R2, t2)

DERIVE(b, bestCost(@b,d,3), R3, t2) APPEAR(b, cost(@b,d,d,3), t2)

INSERT(b, link(@b,d,3), t2)

DERIVE(b, cost(@b,d,d,3), R1, t2) APPEAR(b, link(@b,d,3), t2)

Figure 2: Provenance of bestCost(@c,d,5) at c

not be known (e.g., because it is performed by a third-party binary). In this case, ‘maybe’ rules can be used to infer provenance by observing the set of tuples: if all the τi ex- ist, we cannot predict whether τ will appear, but if τ does appear, it must have been derived from the τi. The second extension is intended for applications where the presence of constraints prevents us from modeling the state as completely independent tuples. For example, given tuples α and β, an application might derive either a tuple γ or a tuple δ, but not both. Modeling this with disjunctive rules would lose important information: if tuple δ replaces tuple γ, the appearance of δ and the disappearance of γ are not merely independent events, they are causally related. Thus, the explanation of δ’s appearance should include the disappearance of γ. In G, we represent this by a direct edge between the corresponding appear and disappear vertices.

3.5 Graph construction Conceptually, we can think of the provenance graph G(e) as being constructed incrementally as the execution e unfolds – each new derivation, tuple insertion or deletion, or message transmission/arrival causes some new vertices to be added and/or existing believe and exist vertices to be updated. In practice, our implementation does not store the vertices and edges themselves; rather, it records only enough infor- mation to securely construct the subgraphs of G(e) that are relevant to a given query. Appendix B specifies the full algortihm that computes G(e) for any execution e. We do not present the details of this algorithm here, but we briefly anticipate three of its key properties. The first property says that the graph can be constructed incrementally:

Theorem 1 If an execution e 1 is a prefix of an execution e 2 , then G(e 1 ) is a subgraph of G(e 2 ).

This holds because, at least conceptually, G(e) contains ver- tices and edges for all tuples that have ever existed; vertices can be added but not removed. (Of course, our practical im- plementation has only limited storage and must eventually ‘forget’ about old vertices and edges.) Theorem 1 makes it possible to answer queries while the system is still running, without risking an inaccurate result. Graph construction is also compositional:

Theorem 2 To construct the vertices v ∈ V (e) with host(v) = i, it is sufficient to run the algorithm on the events that have occurred on i.

Query processor

Users Primary system Provenance system Alice

Application Graph recorder

Microquery module

Query processor

Log

recorder module

Network

Figure 3: Architecture of a single SNooPy node

in Gν ( + i); this makes it possible to explore all of Gν by invoking microquery recursively. We also require that microquery preserve accuracy, that is, if host(v) is correct, it must return black(v), as well as Pv and Sv.

4.4 Discussion

microquery is sufficient to achieve the goals we stated in Section 2. Any system behavior that Alice can observe (such as derivations, messages, or extant tuples) corresponds to some vertex v in the provenance graph. Alice can then re- cursively invoke microquery to learn the causes or effects of v. To learn the causes of v, Alice can start at v and navi- gate the graph backwards until she arrives at the legitimate root causes (i.e., base tuples) or at some vertex that is col- ored red. To learn the effects of v, Alice can navigate the graph in the forward direction. The completeness of SNP ensures that, when a detectable fault has occurred, even an adversary cannot prevent Alice from discovering it. The ac- curacy of SNP ensures that the adversary cannot cause Alice to believe that a correct node is faulty. Note that, if v is a vertex on a faulty node, it is possi- ble that microquery returns only yellow(v), and nothing else. This is a consequence of the final limitation from Sec- tion 4.2, and it can prevent Alice from identifying all faulty nodes, since she may not be able to navigate ‘past’ a yellow vertex. However, Alice can still discover that a fault exists, and she can identify at least one faulty or misbehaving node. At worst, this provides a starting point for a more detailed investigation by supplying evidence against the faulty node. If the faulty node is able to be repaired and its prior ob- servable actions can be verified to conform to its expected behavior, then the node can be recolored black, and subse- quent microquerys will identify whether faults exist(ed) on other nodes.

  1. THE SNOOPY SYSTEM

We next present the design of SNooPy, a system that imple- ments secure network provenance for the provenance graph G that was defined earlier in Section 3.

5.1 Architecture

SNooPy consists of three major building blocks: a graph recorder, a microquery module, and a query processor (Fig- ure 3). The graph recorder extracts provenance information from the actions of the primary system (Section 5.3) and stores it in a tamper-evident log (Section 5.4). The micro- query module (Section 5.5) uses the information in this log to implement microquery; it uses authenticators as a specific form of evidence.

The query processor accepts higher-level (macro) queries, such as simple provenance queries, but also causal, histor- ical, or dynamic queries, and answers them by repeatedly invoking microquery to retrieve the relevant part of the provenance graph. In some primary systems, this graph can be very large; therefore, queries can be parametrized with a scope k, which causes the query processor to return only vertices that are within distance k of the queried vertex. For a discussion of scope in an actual usage scenario, see Section 7.3.

5.2 Assumptions and requirements SNooPy makes the following assumptions:

  1. A message sent from one correct node to another is eventually received, if retransmitted sufficiently often;
  2. Each node i has a certificate that securely binds a key- pair to the node’s identity;
  3. Nodes have access to a cryptographic hash function, and the signature of a correct node cannot be forged;
  4. In the absence of an attack, messages are typically re- ceived within at most time Tprop;
  5. Each node has a local clock, and clocks are synchro- nized to within ∆clock;
  6. Apart from the ‘maybe’ rules, the computation on each node is deterministic; and
  7. Queriers are allowed to see any vertex and any edge in the provenance graph.

The first three assumptions are needed for the tamper- evident log. Assumption 2 prevents faulty nodes from chang- ing their identity and from creating fictitious nodes; it could be satisfied by installing each node with a certificate that is signed by an offline CA. Assumption 3 is commonly assumed to hold for algorithms like RSA and SHA-1. The next two as- sumptions are for simplicity; there are ways to build tamper- evident logs without them [17]. Both Tprop and ∆clock can be large, e.g., on the order of seconds. The sixth assump- tion is needed to efficiently store and verify the provenance graph; it is also required for certain BFT systems [6], and it can be enforced for different types of applications [17], including legacy binaries [13]. The final assumption was al- ready discussed in Section 2.3.

5.3 Extracting provenance To generate the provenance graph, SNooPy must extract information about events from the application to which it is applied. Provenance extraction (or the more general prob- lem of correlating changes to network state based on in- coming/outgoing messages) is an ongoing area of active re- search [29, 30] that is largely orthogonal to the main focus of this paper. In SNooPy, we have found the following three techniques useful for extracting provenance for the target applications that we have examined: Method #1: Inferred provenance. SNooPy can infer provenance by transparently tracking data dependencies as inputs flow through the system. Inferred provenance can be applied when the dependencies are already explicitly cap- tured in the programming language. We have applied this method to a version of the Chord DHT written in a declar- ative language (Section 6.1). Method #2: Reported provenance. Following the ap- proach from [29], applications can explicitly call methods in

SNooPy to report data dependencies. This requires modifi- cations to the source code; also, key parts of the application must be deterministic to enable the querier to verify that provenance was reported correctly. We have applied this method to the Hadoop MapReduce system (Section 6.2). Method #3: External specification. When black- box applications cannot use either of the previous two ap- proaches, SNooPy can rely on an external specification of how the application’s outputs are derived from its inputs. SNooPy can then generate the provenance graph by observ- ing the inputs and outputs. We have applied this method to the Quagga BGP daemon (Section 6.3).

5.4 Graph recorder

The graph recorder stores the extracted provenance infor- mation securely at runtime, so that it can later be used by the microquery module when a query is issued. Recall from Section 3 that our provenance graph G = (V, E) is designed so that each vertex v ∈ V can be at- tributed to a specific node host(v). Thus, we can partition the graph so that each v ∈ V is stored on host(v). To en- sure accuracy, we must additionally keep evidence for each cross-node edge, i.e., (v 1 , v 2 ) ∈ E with host(v 1 ) 6 = host(v 2 ). Specifically, host(v 1 ) must be able to prove that host(v 2 ) has committed to v 2 , and vice versa, so that each node can prove that its own vertex is legitimate, even if the other node is compromised. Finally, according to assumption 6, each node’s subgraph of G is completely determined by its inputs, its outputs, and the behavior of its ‘maybe’ rules; hence, it is sufficient to store messages, changes to base tu- ples, and any (un)derivations that directly involve a ‘maybe’ rule. When necessary, the microquery module can recon- struct the node’s subgraph of G from this information. In the following, we will write σi(x) to indicate a signature on x with i’s private key, and πi(x, y) to indicate a check whether x is a valid signature on y with i’s private key. H(·) stands for the hash function, and || for concatenation. Logs and authenticator sets: SNooPy’s log is a simpli- fied version of the log from PeerReview [17]. The log λi of a node i consists of entries of the form ek := (tk , yk , ck ), where tk is a timestamp, yk is an entry type, and ck is some type- specific content. There are five types of entries: snd and rcv record messages, ack records acknowledgments, and ins and del record insertions and deletions of base tuples and, where applicable, tuples derived from ‘maybe’ rules. Note that log entries are different from vertex types. Each entry is asso- ciated with a hash value hk = H(hk− 1 || tk || yk || ck ) with h 0 := 0. Together, the hk form a hash chain. A node i can issue an authenticator ak := (tk , hk , σi(tk || hk )), which is a signed commitment that ek (and, through the hash chain, e 1 ,... , ek− 1 ) must exist in λi. Each node i stores the authen- ticators it receives from another node j in its authenticator set Ui,j. Commitment: When a node i needs to send a mes- sage m (+τ or -τ ) to another node j, it first appends a new entry ex := (tx, snd, (m, j)) to its local log. Then it sends (m, hx− 1 , tx, σi(tx || hx)) to j. When a node j receives a message (m, a, b, c), j calculates h′ x := H(a || b || snd || (m, j)) and then checks whether the authen- ticator is properly signed, i.e., πi(c, (b || h′ x)), and whether tx is within ∆clock+Tprop of its local time. If not, j discards the message. Otherwise, j adds (tx, h′ x, c) to its authentica-

tor set Uj,i, appends an entry ey := (k, rcv, (m, i, a, b, c)) to λj , and sends (ack, tx, hy− 1 , ty , σj (ty || hy )) back to i. Once i receives (ack, a, b, c, d) from j, it first checks its log to see whether there is an entry ex = (a, snd, (m, j)) in its log that has not been acknowledged yet. If not, it discards the message. i then calcu- lates h′ y := H(b || c || rcv || (m, i, hx− 1 , tx, σi(tx || hx))), and checks πj (d, (c || h′ y )) and ty is within ∆clock+Tprop of its local time. If not, i discards the message. Otherwise, i adds (c, h′ y , d) to its authenticator set Ui,j and appends an entry ez := (t, ack, a, b, c, d) to its log. If i does not receive a valid acknowledgment within 2 ·Tprop, it immediately notifies the maintainer of the dis- tributed system. Any such notification is a clear indication of a fault: at least one of i, j, or the connection between them must be faulty. Once the maintainer acknowledges the notification, the problem is known and can be ignored for the purposes of forensics. However, if the maintainer has not received a notification and a query later uncovers a snd without a matching ack, SNooPy can color the corre- sponding send vertex red because the sender is clearly faulty. Without the notification mechanism, this situation would be ambiguous and could not be reliably attributed to i or j. Retrieval: The graph recorder implements a primitive retrieve(v, aik ) which, when invoked on i := host(v) with a vertex v and an authenticator aik of i, returns the prefix^2 of the log in which v was generated. In essence, retrieve implements the function ϕ from Section 4 but evaluates it on demand. Typically, the prefix retrieve returns is the prefix authenticated by aik , but if v is an exist or believe vertex that exists at ek , the prefix is extended to either a) the point where v ceases to exist, or b) the current time. (The special case is necessary because an existing or believed tuple can be involved in further derivations between ek and the time it disappears, so its vertex may acquire additional outbound edges.) If the prefix extends beyond ek , i must also return a new authenticator that covers the entire prefix. A correct node can always comply with such a request.

5.5 Microquery module The microquery module implements microquery(v, ). At a high level, this works by 1) using  to retrieve a log prefix from host(v), 2) replaying the log to regenerate host(v)’s partition of the provenance graph G, and 3) check- ing whether v exists in it. If v exists and was derived cor- rectly, its predecessors and successors are returned, and v is colored black; otherwise v is colored red. More formally, the evidence for a vertex v is an authen- ticator from host(v) that covers a log prefix in which v ex- isted. When microquery(v, ) is invoked on a node i, i first outputs yellow(v) to indicate that v’s real color is not yet known, and then invokes retrieve(v, ) on j := host(v). If j returns a log prefix that matches , i replays the pre- fix to regenerate j’s partial provenance subgraph Gν () | j. This is possible because we have assumed that the compu- tation is deterministic. If Gν () | j does not contain v or replay fails (i.e., the sent messages do not match the send entries in the log, a send does not have a matching ack, or the authenticators in the recv and ack entries do not satisfy the conditions from Section 5.4), i outputs red(v); otherwise it outputs black(v) and returns the predecessors (^2) In practice, SNooPy usually does not return an entire pre- fix; see Section 5.6 for a list of optimizations.

this path, so the vertices on the path are queried in turn. Now consider some vertex v′′^ along the path. When v′′^ is queried, we either obtain the next vertex on the path, along with valid evidence, or v′′^ must turn red or yellow. Thus, either this color appears before we reach v, or we eventually obtain evidence of v. 2

5.8 Limitations

By design, SNooPy is a forensic system; it cannot actively detect faults, but rather relies on a human operator to spot the initial symptom of an attack, which can then be investi- gated using SNooPy. Investigations are limited to the part of the system that is being monitored by SNooPy. We do not currently have a solution for partial deployments, al- though it may be possible to use the approach adopted by NetReview [14] at the expense of slightly weaker guarantees. SNooPy also does not have any built-in redundancy; if the adversary sacrifices one of his nodes and destroys all the provenance state on it, some parts of the provenance graph may no longer be reachable via queries (though any discon- nection points will be marked yellow in the responses). This could be mitigated by replicating each log on some other nodes, although, under our threat model, the problem can- not be avoided entirely because we have assumed that any set of nodes—and thus any replica set we may choose—could be compromised by the adversary. Finally, SNooPy does not provide negative provenance, i.e., it can only explain the existence of a tuple (or its appearance or disappearance), but not its absence. Negative provenance is known to be a very difficult problem that is actively being researched in the database community [28]. We expect that SNooPy can be enhanced to support negative provenance by incorporating recent results from this community.

5.9 Prototype implementation

We have built a SNooPy prototype based on components from ExSPAN [50] and PeerReview [17], with several mod- ifications. We completely redesigned ExSPAN’s provenance graph according to Section 3, added support for constraints and ‘maybe’ rules, and implemented the graph recorder and the microquery module. Unlike ExSPAN, the provenance graph is not maintained at runtime; rather, the prototype records just enough information to reconstruct relevant parts of the graph on demand when a query is issued. This is done using deterministic replay, but with additional instrumenta- tion to capture provenance. Since auditing in SNooPy is driven by the forensic investigator, PeerReview’s witnesses are not required, so we disabled this feature. It would not be difficult to connect the prototype to a visualizer for prove- nance graphs, e.g., VisTrails [45]. Macroqueries are currently expressed in Distributed Dat- alog (DDlog), a distributed query language for maintaining and querying network provenance graphs. All three methods from Section 5.3 for extracting provenance are supported: since the prototype is internally based on DDlog, it can di- rectly infer provenance from any DDlog program, but it also contains hooks for reporting provenance, as well as an API for application-specific proxies.

  1. APPLICATIONS

To demonstrate that SNooPy is practical, we have applied our prototype implementation to three existing applications, using a different provenance extraction method each time.

6.1 Application #1: Chord To test SNooPy’s support for native DDlog programs, we applied it to a declarative implementation [26] of the Chord distributed hash table that uses RapidNet [37]. There are several known attacks against DHTs, so this seems like an attractive test case for a forensic system. Since ExSPAN can automatically transform any DDlog program into an equiv- alent one that automatically reports provenance, and since RapidNet is already deterministic, no modifications were re- quired to the Chord source code.

6.2 Application #2: Hadoop MapReduce To test SNooPy’s support for reported provenance, we ap- plied it to Hadoop MapReduce [12]. We manually instru- mented Hadoop to report provenance to SNooPy at the level of individual key-value pairs. Our prototype considers input files to be base tuples. The provenance of an intermediate key-value pair consists of the arguments of the corresponding map invocation, and the provenance of an output consists of the arguments of the corresponding reduce invocation. The set of intermedi- ate key-value pairs sent from a map task to a reduce task constitutes a message that must be logged; thus, if there are m map tasks and r reduce tasks, our prototype sends up to 2 mr messages (a request and a response for each pair). To avoid duplication of the large data files, we apply a trivial optimization: rather than copying the files in their entirety into the log, we log their hash values, which is sufficient to authenticate them later during replay. Since we are mainly interested in tracking the provenance of key-value pairs, we treat inputs from the JobTracker as base tuples. It would not be difficult to extend our prototype to the JobTracker as well. Individual map and reduce tasks are already deterministic in Hadoop, so replay required no special modifications. We did, however, add code to replay map and reduce tasks sepa- rately, as well as a switch for enabling provenance reporting (recall that this is only needed during replay). More specifi- cally, we assign a unique identifier (UID) [19] to each of the input, output and intermediate tuples, based on its content and execution context (which indicates, for example, a tuple τ is an input of map task m). The Hadoop implementation is instrumented to automatically track cross-stage causalities. This is achieved by adding edges between corresponding ver- tices when tuples are communicated across stages (e.g. from a map output file to a reducer). For the causalities within a stage, users need to report them using a provided API, which takes as arguments the UID of the output tuple, the UIDs of the input tuples that contribute to the output, and the execution context. The reported provenance information is then passed to and maintained in the graph recorder. Altogether, we added or modified less than 100 lines of Java code in Hadoop itself, and we added another 550 lines for the interface to SNooPy.

6.3 Application #3: Quagga To test SNooPy’s support for application-specific proxies, we applied it to the Quagga BGP daemon. BGP interdo- main routing is plagued by a variety of attacks and mal- functions [32], so a secure provenance system seems useful for diagnostics and forensics. SNooPy could complement se- cure routing protocols such as S-BGP [40]: it cannot actively prevent routing problems from manifesting themselves, but

it can investigate a wider range of problems, including route equivocation (i.e., sending conflicting route announcements to different neighbors), replaying of stale routes, and failure to withdraw a route, which are not addressed by S-BGP. Rather than instrumenting Quagga for provenance and deterministic replay, we treated it as a ‘black box’ and im- plemented a small proxy that a) transparently intercepts Quagga’s BGP messages and converts them into SNooPy tuples, and b) converts incoming tuples back to BGP mes- sages. The proxy uses a small DDlog specification of only four rules. The first rule specifies how announcements prop- agate between networks, and the next two express the con- straint that a network can export at most one route to each prefix at any given time, as required by BGP. The fourth rule is a ‘maybe’ rule (Section 3.4); it stipulates that each route must either be originated by the network itself, or ex- tend the path of a route that was previously advertised to it. Due to the ‘maybe’ rule, we did not need to model the details of Quagga’s routing policy (which may be confiden- tial); rather, the proxy can infer the essential dependencies between routes from the incoming and outgoing BGP mes- sages it observes. In addition to the four rules, we wrote 626 lines of code for the proxy. Much of this code is generic and could be reused for other black-box applications. We did not modify any code in Quagga.

6.4 Summary

Our three application prototypes demonstrate that SNooPy can be applied to different types of applications with rela- tively little effort. Our prototypes cover all three prove- nance extraction methods described in Section 5.3. More- over, the three applications generate different amounts of communication, process different amounts of data, have dif- ferent scalability requirements, etc., so they enable us to evaluate SNooPy across a range of scenarios.

  1. EVALUATION

In this section, we evaluate SNooPy using our three applica- tions in five different scenarios. Since we have already proven that SNooPy correctly provides secure network provenance, we focus mostly on overheads and performance. Specifically, our goal is to answer the following high-level questions: a) can SNooPy answer useful forensic queries? b) how much overhead does SNooPy incur at runtime? and c) how ex- pensive is it to ask a query?

7.1 Experimental setup

We examine SNooPy’s performance across five application configurations: a Quagga routing daemon (version 0.99.16) deployment, two Chord installations (derived from Rapid- Net [37] v0.3), and two Hadoop clusters (version 0.20.2). Our Quagga experiment is modeled after the setup used for NetReview [14]. We instantiated 35 unmodified Quagga daemons, each with the SNooPy proxy from Section 6.3, on an Intel machine running Linux 2.6. The daemons formed a topology of 10 ASes with a mix of tier-1 and small stub ASes, and both customer/provider and peering relationships. The internal topology was a full iBGP mesh. To ensure that both the BGP traffic and the routing table sizes were realistic, we injected approximately 15,000 updates from a RouteViews [39] trace. The length of the trace, and thus

the duration of the experiment, was 15 minutes. In all ex- periments, each node was configured with a 1,024-bit RSA key. We evaluated the Chord prototype (Section 6.1) in two different configurations: Chord-Small contains 50 nodes and Chord-Large contains 250 nodes. The experiments were performed in simulation, with stabilization occurring every 50 seconds, optimized finger fixing every 50 seconds, and keep-alive messages every 10 seconds. Each simulation ran for 15 minutes of simulated time. In the Hadoop-Small experiment, we ran the prototype described in Section 6.2 on 20 c1.medium instances on Ama- zon EC2 (in the us-east-1c region). The program we used (WordCount) counts the number of occurrences of each word in a 1.2 GB Wikipedia subgraph from WebBase [46]. We used 20 mappers and 10 reducers; the total runtime was about 79 seconds. Our final experiment, Hadoop-Large, used 20 c1.medium instances with 165 mappers, 10 reducers, and a 10.3 GB data set that consisted of the same Wikipedia data plus the 12/2010 Newspapers crawl from WebBase [46]; the runtime for this was about 255 seconds. Quagga, Chord, and Hadoop have different characteristics that enable us to study SNooPy under varying conditions. For instance, Quagga and Chord have small messages com- pared to Hadoop, while Quagga has a large number of mes- sages. In terms of rate of system change, Quagga has the highest, with approximately 1,350 route updates per minute. In all experiments, the actual replay during query evaluation was carried out on an Intel 2.66GHz machine running Linux with 8GB of memory.

7.2 Example queries To evaluate SNooPy’s ability to perform a variety of foren- sic tasks as well as to measure its query performance, we tested SNooPy using the following provenance queries, each of which is motivated by a problem or an attack that has been previously reported in the literature: Quagga-Disappear is a dynamic query that asks why an entry from a routing table has disappeared. In our scenario, the cause is the appearance of an alternative route in an- other AS j, which replaces the original route in j but, unlike the original route, is filtered out by j’s export policy. This is modeled after a query motivated in Teixeira et al. [44]; note that, unlike Omni, SNooPy works even when nodes are compromised. Quagga-BadGadget query asks for the provenance of a ‘fluttering’ route; the cause is an instance of BadGadget [11], a type of BGP configuration problem. Chord-Lookup is a historical query that asks which nodes and finger entries were involved in a given DHT lookup, and Chord-Finger returns the provenance of a given finger table entry. Together, these two queries can detect an Eclipse attack [42], in which the attacker gains control over a large fraction of the neighbors of a correct node, and is then able to drop or reroute messages to this node and prevent correct overlay operation. Hadoop-Squirrel asks for the provenance of a given key- value pair in the output; for example, if WordCount produces the (unlikely) output (squirrel,10000) to indicate that the word ‘squirrel’ appeared 10,000 times in the input, this could be due to a faulty or compromised mapper. Such queries are useful to investigate computation results on outsourced Cloud databases [34].

0

Quagga Chord Small

Chord Large

Hadoop Small

Hadoop Large

Per-node log growth (MB/minute)

Index Authenticators Signatures Messages

Figure 6: Per-node log growth in SNooPy, excluding checkpoints.

reasons. To quantify the incremental storage cost, we ran our five experiments in the SNooPy configuration, and we measured the size of the resulting logs. Figure 6 shows the average amount of log data that each node produced per minute, excluding checkpoints. In abso- lute terms, the numbers are relatively low; they range from 0 .066 MB/min (Chord-Small) to 0.74 MB/min (Quagga). We expect that most forensic queries will be about fairly re- cent events, e.g., within one week. To store one week’s worth of data, each node would need between 7.3 GB (Quagga) and 665 MB (Chord-Small). Note that, in contrast to proactive detection systems like PeerReview [17], this data is merely archived locally at each node and is only sent over the net- work when a query is issued. Also, it should be possible to combine SNooPy with state-of-the-art replay techniques such as ODR [1], which produce very small logs. The log contains copies of all received messages (for Hadoop, references to files), authenticators for each sent and received message, and acknowledgments. Thus, log growth depends both on the number of messages and their size dis- tribution. As a result, Figure 6 shows that log growth was fastest for Quagga, given that its baseline system generates the largest number of messages. In the case of Hadoop, our proxy benefits from the fact that Hadoop already retains copies of the input files unless the user explicitly deletes them. Thus, the proxy can save space by merely referencing these files from the log, and the incremental storage cost is extremely low (less than 0.1 MB/minute). The size of the input files was 1.2 GB for Small and 10.3 GB for Large. If these files were not retained by Hadoop, they would have to be copied to the log. As described in Section 5.6, SNooPy can additionally keep checkpoints of the system state. The size of a typi- cal checkpoint is 25 kB for Chord and 64 MB for Quagga. Since replay starts at checkpoint, more checkpoints result in faster queries but consume more space. For Hadoop, the equivalent of a checkpoint is to keep the intermediate files that are produced by the Map tasks, which requires 207 MB for Small and 682 MB for Large.

7.6 Computation

We next measured the computation cost imposed by SNooPy. We expect the cost to be dominated by signature generation and verification and, in the case of Hadoop, hash- ing the input and output files (see Section 6.2). To verify this, we used dstat to measure the overall CPU utilization of a Quagga node with and without the SNooPy proxy; the

0

1

2

3

4

Quagga Chord Small

Chord Large

Hadoop Small

Hadoop Large

Average additional CPU load

(% of a single core)

SHA-1 hash RSA verify RSA sign

Figure 7: Additional CPU load for generating and verifying signatures, and for hashing.

log and the checkpoints were written to a RAM disk to iso- late computation from I/O overhead. Our results show an average utilization of 5.4% of one core with SNooPy, and 0.9% without. As expected, more than 70% of the overhead can be explained by the cost of signature generation and ver- ification alone (in our setup, 1.3 ms and 66 μs per 1,024-bit signature); the rest is due to the proxy logic. To get a more detailed breakdown of the crypto over- head in our three applications, we counted the number of crypto operations in each configuration, and we multiplied the counts with the measured cost per operation to estimate the average additional CPU load they cause. As our results in Figure 7 show, the average additional CPU load is below 4% for all three applications. For Quagga and Chord, the increase is dominated by the signatures, of which two are re- quired for each message – one for the authenticator and the other for the acknowledgment. Hadoop sends very few mes- sages (one from each mapper to each reducer) but handles large amounts of data, which for SNooPy must be hashed for commitment. Note that we do not include I/O cost for the hashed data because the data would have been written by the unmodified Hadoop as well; SNooPy merely adds a SHA-1 hash operation, which can be performed on-the-fly as the data is written. The message batching optimization from Section 5.6 can be used to reduce the CPU load. To evaluate this, we per- formed an additional experiment with Quagga, and we found that a window size of Tbatch= 100 ms reduced the total num- ber of signatures by a factor of six. Message batching also prevents the CPU load from spiking during message bursts, since it limits the rate at which signatures are generated to at most 1/Tbatch per destination.

7.7 Query performance Next, we evaluate how quickly SNooPy can answer queries, and how much data needs to be downloaded. Since the an- swer depends on the query, we performed several different queries in different systems. For each query, we measured a) how much data (log segments, authenticators, and check- points) was downloaded, b) how long it took to verify the log against the authenticators, and c) how much time was needed to replay the log and to extract the relevant prove- nance subgraph. Figure 8 shows our results. Note that the query turnaround time includes an estimated download time, based on an assumed download speed of 10 Mbps. The results show that both the query turnaround times and the amount of data downloaded can vary consider-

0

4

8

12

16

Quagga Disappear Quagga BadGadget Chord Lookup (Small)

Chord Lookup (Large)

Hadoop Squirrel (Small)

0

1

2

60

64

68

20

21

Query turnaround time (s)

Traffic (MB)

Auth check Replay Download Authenticators Logs Checkpoints

Figure 8: Query turnaround time (left bar) and data downloaded to answer the query (right bar).

ably with the query. The Chord and Quagga-BadGadget queries were completed in less than five seconds; the Quagga- Disappear query took 19 seconds, of which 14 were spent verifying partial checkpoints using a Merkle Hash Tree; and the Hadoop-Squirrel query required 68 seconds, including 51 for replay. The download varied between 133 kB for Quagga- BadGadget and 20.8 MB for Hadoop-Squirrel. The numbers for Hadoop are larger because our prototype does not create checkpoints within map or reduce tasks, and so must replay a node’s entire task to reconstruct a vertex on that node. Fine-grained checkpoints could be added but would require more changes to Hadoop. Generally, there is a tradeoff be- tween storage and query performance: finer-grained check- points require more storage but reduce the size of the log segments that need to be downloaded and replayed. In summary, the downloads and query turnaround times vary between queries but generally seem low enough to be practical for interactive forensics.

7.8 Scalability

In our final experiment, we examine how SNooPy’s over- head scales with the number of nodes N. We ran our Chord experiment with a range of different system sizes between N = 10 and N = 500 nodes, and we measured two of the main overheads, traffic and log size, for each N. Figure 9 shows our results, plus the baseline traffic for comparison. The results show that both overheads increase only slowly with the system size. This is expected because, as discussed in Sections 7.4 and 7.5, the overhead is a function of the number and size of the messages sent. If the per-node traffic of the application did not depend on N , the runtime over- head would not depend on N either; however, recall that Chord’s traffic increases with O(log N ), as illustrated here by the baseline traffic results, so the SNooPy overheads in this experiment similarly grow with O(log N ). Note the contrast to accountability systems like PeerRe- view [17] where the overhead itself grows with the system size. This is because PeerReview uses witnesses to ensure that each pair of authenticators from a given node is seen by at least one correct node. SNooPy relies on the querier’s node for this property (see Section 5.5) and, as a forensic system, it does not audit proactively. In summary, SNooPy does not reduce the scalability of the primary system; its per-node overheads mainly depend upon the number of messages sent.

0

100

200

300

400

500

600

700

800

0 100 200 300 400 500

Per-node traffic (Bytes/s)

Number of nodes

Chord (SNP) Chord (Baseline) 0

20

40

60

80

100

0 100 200 300 400 500

Per-node log growth (kB/minute)

Number of nodes

Chord (SNP)

Figure 9: Scalability for Chord: Total traffic (left) and log size (right)

7.9 Summary SNooPy’s runtime costs include a fixed-size authenticator and acknowledgment for each message, processing power to generate and verify the corresponding signatures, and stor- age space for a per-node log with enough information to re- construct that node’s recent execution. Some part of the log needs to be downloaded and replayed when a query is issued. In the three different applications we evaluated, these costs are low enough to be practical. We have also described sev- eral example queries that can be used to investigate attacks previously reported in the literature, and we have demon- strated that SNooPy can answer them within a few seconds.

  1. RELATED WORK Debugging and forensics: The main difference between SNP and existing forensic systems is that SNP does not re- quire trust in any components on the compromised nodes. For example, Backtracker [21, 22] and PASS [29] require a trusted kernel, cooperative ReVirt [3] a trusted VMM, and A2M [7] trusted hardware. ForNet [41] and NFA [48] assume a trusted infrastructure and collaboration across domains. Other systems, such as the P2 debugger [43], ExSPAN [50], Magpie [2], D3S [25], QI [33], Friday [9], and Pip [38] are designed to diagnose non-malicious faults, such as bugs or race conditions. When nodes have been compromised by an adversary, these systems can return incorrect results. Accountability: Systems like PeerReview [17] and Net- Review [14] can automatically detect when a node deviates from the algorithm it is expected to run. Unlike SNP, these systems cannot detect problems that arise from interactions between multiple nodes, such as BadGadget [11] in inter- domain routing, or problems that are related to inputs or unspecified aspects of the algorithm. Also, accountability systems merely report that a node is faulty, whereas SNP also offers support for diagnosing faults and for assessing their effects on other nodes. Fault tolerance: An alternative approach to the problem of Byzantine faults is to mask their effects, e.g., using tech- niques like PBFT [6]. Unlike SNP, these techniques require a high degree of redundancy and a hard bound on the number of faulty nodes, typically one third of the total. The two ap- proaches are largely complementary and could be combined. Proofs of misbehavior: Many systems that are designed to handle non-crash faults internally use proofs of misbe- havior, such as the signed confessions in Ngan et al. [31], a set of conflicting tickets in sharp [8], or the pom mes-

[15] A. Haeberlen and P. Kuznetsov. The Fault Detection Problem. In Proc. Intl. Conference on Principles of Distributed Systems (OPODIS), Dec. 2009. [16] A. Haeberlen, P. Kuznetsov, and P. Druschel. The case for Byzantine fault detection. In Proc. Workshop on Hot Topics in System Dependability (HotDep), Nov.

[17] A. Haeberlen, P. Kuznetsov, and P. Druschel. PeerReview: Practical accountability for distributed systems. In Proc. ACM Symposium on Operating Systems Principles (SOSP), Oct. 2007.

[18] R. Hasan, R. Sion, and M. Winslett. Preventing history forgery with secure provenance. ACM Transactions on Storage (TOS), 5(4):1–43, 2009. [19] R. Ikeda, H. Park, and J. Widom. Provenance for generalized map and reduce workflows. In Proc. Conference on Innovative Data Systems Research (CIDR), Jan. 2011. [20] B. Kauer. OSLO: Improving the security of Trusted Computing. In Proc. 16th USENIX Security Symposium, Aug 2007. [21] S. T. King and P. M. Chen. Backtracking intrusions. ACM Transactions on Computer Systems (TOCS), 23(1):51–76, 2005.

[22] S. T. King, Z. M. Mao, D. Lucchetti, and P. Chen. Enriching intrusion alerts through multi-host causality. In Proc. Annual Network and Distributed Systems Security Symposium (NDSS), Feb. 2005.

[23] R. Kotla, L. A. M. Dahlin, A. Clement, and E. Wong. Zyzzyva: Speculative Byzantine fault tolerance. ACM Trans. on Comp. Syst. (TOCS), 27(4), Dec. 2009. [24] L. Lamport, R. Shostak, and M. Pease. The Byzantine generals problem. ACM Trans. on Prog. Lang. and Systems (TOPLAS), 4(3):382–401, 1982. [25] X. Liu, Z. Guo, X. Wang, F. Chen, X. Lian, J. Tang, M. Wu, M. F. Kaashoek, and Z. Zhang. D3S: debugging deployed distributed systems. In Proc. USENIX Symposium on Networked Systems Design and Implementation (NSDI), Apr. 2008.

[26] B. T. Loo, T. Condie, M. Garofalakis, D. E. Gay, J. M. Hellerstein, P. Maniatis, R. Ramakrishnan, T. Roscoe, and I. Stoica. Declarative Networking. CACM, 2009. [27] P. McDaniel, K. Butler, S. McLaughlin, R. Sion, E. Zadok, and M. Winslett. Towards a Secure and Efficient System for End-to-End Provenance. In Proc. USENIX Workshop on the Theory and Practice of Provenance (TaPP), Feb. 2010. [28] A. Meliou, W. Gatterbauer, K. M. Moore, and D. Suciu. The complexity of causality and responsibility for query answers and non-answers. In Proc. International Conference on Very Large Data Bases (VLDB), Aug. 2011.

[29] K.-K. Muniswamy-Reddy, D. A. Holland, U. Braun, and M. Seltzer. Provenance-aware storage systems. In Proc. USENIX Annual Technical Conference, 2006. [30] J. Newsome and D. Song. Dynamic taint analysis for automatic detection, analysis, and signature generation of exploits on commodity software. In Proc. Annual Network and Distributed Systems Security Symposium (NDSS), Feb. 2005. [31] T.-W. Ngan, D. Wallach, and P. Druschel. Enforcing fair sharing of peer-to-peer resources. In Proc.

International Workshop on Peer-to-Peer Systems (IPTPS), Feb. 2003. [32] O. Nordstroem and C. Dovrolis. Beware of BGP attacks. ACM Comp. Comm. Rev. (CCR), Apr 2004. [33] A. J. Oliner and A. Aiken. A query language for understanding component interactions in production systems. In Proc. International Conference on Supercomputing (ICS), June 2010. [34] H. Pang and K.-L. Tan. Verifying Completeness of Relational Query Answers from Online Servers. ACM Transactions on Information and System Security (TISSEC), 11:5:1–5:50, May 2008. [35] Quagga Routing Suite. http://www.quagga.net/. [36] A. Ramachandran, K. Bhandankar, M. Bin Tariq, and N. Feamster. Packets with provenance. Technical Report GT-CS-08-02, Georgia Tech, 2008. [37] RapidNet. http://netdb.cis.upenn.edu/rapidnet/. [38] P. Reynolds, C. Killian, J. L. Wiener, J. C. Mogul, M. A. Shah, and A. Vahdat. Pip: Detecting the unexpected in distributed systems. In Proc. USENIX Symposium on Networked Systems Design and Implementation (NSDI), May 2006. [39] RouteViews project. http://www.routeviews.org/. [40] Secure BGP. http://www.ir.bbn.com/sbgp/. [41] K. Shanmugasundaram, N. Memon, A. Savant, and H. Bronnimann. ForNet: A distributed forensics network. In Proc. Intl. Workshop on Mathematical Methods, Models and Architectures for Computer Networks Security (MMM-ACNS), Sept. 2003. [42] A. Singh, M. Castro, P. Druschel, and A. Rowstron. Defending against the Eclipse attack in overlay networks. In Proc. ACM SIGOPS European Workshop, Sept. 2004. [43] A. Singh, P. Maniatis, T. Roscoe, and P. Druschel. Using queries for distributed monitoring and forensics. In Proc. EuroSys Conference, Apr. 2006. [44] R. Teixeira and J. Rexford. A measurement framework for pin-pointing routing changes. In Proc. SIGCOMM Network Troubleshooting Workshop, Sep 2004. [45] Vistrails. http://www.vistrails.org/. [46] The Stanford WebBase Project. http: //diglib.stanford.edu/~testbed/doc2/WebBase/. [47] J. Widom. Trio: A system for integrated management of data, accuracy, and lineage. In Proc. Conference on Innovative Data Systems Research (CIDR), Jan. 2005. [48] Y. Xie, V. Sekar, M. Reiter, and H. Zhang. Forensic analysis for epidemic attacks in federated networks. In Proc. IEEE International Conference on Network Protocols (ICNP), Nov. 2006. [49] W. Zhou, L. Ding, A. Haeberlen, Z. Ives, and B. T. Loo. TAP: Time-aware provenance for distributed systems. In Proc. USENIX Workshop on the Theory and Practice of Provenance (TaPP), June 2011. [50] W. Zhou, M. Sherr, T. Tao, X. Li, B. T. Loo, and Y. Mao. Efficient querying and maintenance of network provenance at Internet-scale. In Proc. ACM SIGMOD Conference, June 2010.

APPENDIX

A. PRELIMINARIES

We begin with a few additional definitions and clarifications that are not included in the main paper.

A.1 Simplifications

The system model was already described in Section 3.1, but for the purposes of the proof, we simplify this model in two ways: we assume that tuples have unique derivations, and we assume that no constraints or maybe rules are used. Neither of these simplifications reduces generality, for the following reason. If the system contains a tuple τ with k > 1 derivations, we can consider an equivalent system that has k additional tuples τ 1 ,... , τk , one for each possible derivation, and an extra derivation rule that causes τ to be derived whenever at least one of the τi exists.

If the system contains a maybe rule τ @n maybe ←−−−− τ 1 @n 1 ∧

... ∧ τk @nk , we can consider an equivalent system that con- tains an extra base tuple β@n, in which the maybe rule is replaced with τ @n ← τ 1 @n 1 ∧... ∧ τk @nk ∧ β@n, and in which n inserts or deletes β whenever it chooses to trigger the maybe rule, or to stop it.

A.2 Definitions

In the following, we will write N to denote the set of nodes, and R to denote the set of rules. We define a message m to be (+τ, t) or (−τ, t), where t is the sender’s local timestamp, or ack(m′, t′), where m′^ is another message (+τ, t) or (−τ, t). We say that ack(m′) is an acknowledgment of the message m′. A message (+τ, t) sent by a node i indicates that a tuple τ now exists on i; a message (−τ, t) indicates that τ has ceased to exist on i; and an acknowledgment of m′^ indicates that m′^ was received by the sender of the acknowledgment. We assume that messages can be authenticated. In the following, we will simply write +τ or −τ when the timestamp is irrelevant. We write src(m) to denote the node that sent message m, dst(m) to denote the node to which m was sent, and txmit(m) to denote the timestamp t. In Section 3.1, we have assumed that each node i applies its local rules deterministically, and that this process can be modeled as a state machine Ai that maintains i’s tuple set and responds to inputs (incoming messages or base tuple changes) by updating the tuple set and by sending messages to other nodes. We now precisely define the inputs and out- puts. Ai accepts the inputs ins(β), del(β), and rcv(m), where β is a base tuple and m is a message with dst(m) = i. Ai produces outputs der(τ ), und(τ ), and snd(m), where τ is a tuple (but not a base tuple) and m is a message with src(m) = i.

A.3 Histories and executions

We must have a way to talk about what ‘has actually hap- pened’ in the primary system by the time a query is issued to the provenance system. For this purpose, we define the con- cept of a history, which describes the behavior of the primary system from the perspective of an omniscient observer that can observe all messages and base tuple insertions/deletions. This will serve as the ‘ground truth’ against which the re- sponses of the provenance system can be evaluated. The following definitions are based on the ones in [15, 16].

An history h of the primary system is a sequence of events ek = (tk , ik , xk ), where k = 1, 2 , 3 ,.. ., tk > tk− 1 , ik ∈ N and xk is one of the following:

  1. snd(m), which indicates that ik has sent message m;
  2. rcv(m), which indicates that ik has received message m;
  3. ins(τ ), which indicates that a base tuple τ has been inserted on ik ; and
  4. del(τ ), which indicates that a base tuple τ has been removed from ik. Each message can be sent at most once (recall the sequence numbers), and each sent message is received at most once. Base tuples are inserted before they can be removed, and no base tuple is removed more than once. We write h | i to denote the subsequence of h that consists of all the events associated with i in h. We define an execution e of the primary system to be a history in which each sent message is sent exactly once. We say that a node i is correct in an execution e iff e | i conforms to Ai, i.e., if the following holds for e | i:
  • e|i starts with a rcv, ins or del event; and
  • for any prefix p of e | i that starts with a rcv, ins, or del event, we can construct another prefix p′^ of e | i by appending 1) snd(ack(m)) if p ended with rcv(m), and 2) all the snd outputs that Ai produces when fed with all the inputs in p, but excluding der and und outputs, as well as any outputs that are already in p. If p′^6 = e | i, p′^ must not be followed by a snd event in e | i. If i is not correct in e, we say that i is faulty in e.

B. PROVENANCE GRAPH In this section, we give a definition of the ‘true’ provenance graph G(e) for an execution e. Ideally, we would like SNP to answer queries about this graph. However, in an actual distributed system, no single node can know the entire ex- ecution e, which includes the actual events on all nodes, including the faulty ones. In Appendix C, we will give a definition of another provenance graph Gν (), which relies on evidence  that is available at a single node (or can be collected by a single node). Since faulty nodes can lie or equivocate, we cannot guarantee that Gν is always identical to G; instead, our goal will be for Gν to approximate G as closely as possible.

B.1 The graph construction algorithm We say that the provenance graph G(h) := (V (h), E(h)) for a given history h is the graph that is produced by the graph construction algorithm (GCA), which consists of the pseudocode in Tables 10 and 11, as well as the following steps:

  1. Initialize V and E as empty sets.
  2. If there are no more events, terminate.
  3. Take the next event ek := (tk , ik , xk ) and invoke the corresponding handle-event function. If xk is snd, continue with step 2
  4. Feed the input that corresponds to ek to the state ma- chine Ai.

have been inserted at least once before t, and this insertion must be reflected in the history. Let ek := (tk , i, ins(τ )) be the event that corresponds to the last insertion before t, i.e., tk < t. When ek is reached, handle-event-ins will be invoked, which, as we have seen earlier, causes a suitable exist vertex to be added. A subsequent deletion can still update the second timestamp in this vertex, but, since τ existed at time t, this deletion can only happen after t, so the vertex still meets our criteria. Now consider the case where τ is a derived tuple. Recall that the state machine Ai is deterministic. Since the history contains Ai’s inputs and the GCA replays these exact same inputs to Ai in the same order, Ai goes through the same se- quence of states as in the original execution. Thus, because τ existed at time t, Ai must output der(τ ) at least once before t. Let tk < t be the last such instance. handle-output-der will be invoked with argument tk and, as above, cause a suit- able exist vertex to be added. As above, this vertex can still be modified when τ is underived later, but, since this can only happen after t, the vertex still meets our criteria. Finally, we consider part 2) of the claim. Assume that exist(i, τ, [t 1 , t 2 ]) ∈ V (h). As we have seen, this must mean that τ has been inserted or derived at time t 1. If t 2 = ∞, τ can never have been deleted or underived because this would have caused t 2 to be updated, so it must certainly have ex- isted at t > t 1. If t 2 < ∞, we know that a) a deletion or underivation happened at t 2 , and b) no such deletion or un- derivation can have happened before t 2 , since exist vertices can be updated at most once. But since t 2 ≥ t, τ must still have existed at time t, and the claim holds. 2

B.5 GCA is compositional

A key property of SNP is that the provenance graph is com- positional, i.e., we can run the GCA separately on the events from each node, and then stitch together the resulting sub- graphs. This is important for two reasons. First, we want the property that the subgraph for a correct node cannot (with very few exceptions) depend on events on faulty nodes, so that an adversary cannot ‘change history’. Second, compo- sitionality is important for efficient query processing, since it enables us to reconstruct the subgraph for individual nodes without considering events on other nodes. We formalize the compositionality of the GCA with the following theorem:

Theorem 2 For any history h, G(h | i) = G(h) | i.

Proof: We first prove G(h | i) ⊆∗^ G(h) | i. Observe that, with two important exceptions, the GCA state is completely partitioned by node, so the ‘extra’ events in h (compared to h | i) do not influence the vertices and edges that are created by events on i. The two exceptions are send and receive vertices: a send(m) can be created on src(m) when a rcv(m) event is processed on dst(m), and a receive(m) vertex can be created on dst(m) when rcv(ack(m)) is pro- cessed on src(m). However, the remote vertex either already exists, or it is created as a ‘standalone’ vertex that is not connected to any other vertex on the remote note. In the case of send, this does not matter because a send vertex can never be a predecessor of a vertex on the same node. Although receive could in principle have a forward edge to a believe-(dis)appear vertex and thus influence the out- come of subsequent handle-output invocations, this for- ward edge is created only when the corresponding rcv event is processed; a receive that is created only in response to

a remote event cannot influence further edges or vertices on its node. Finally, note that any remote, disconnected ver- tices that are not subsequently connected by events on the remote node are colored yellow in line 56 or line 76. These are the only vertices that can have a different color in the two graphs, but since they are yellow and yellow is dominated by both other colors, the property still holds. Next, we prove that G(H) | i ⊆∗^ G(h | i), i.e., we have to show that G(h) | i does not contain additional vertices or edges. Now, recall from above that vertices are only created on the node whose events or outputs are being processed, with the exception of send and receive. Thus, the only vertices that could be in G(h) | i but not in G(h|i) | i are send and receive vertices. But a send(m) could only be created remotely when a rcv(m) event on another node is processed; since we have assumed that signatures cannot be forged, any such m must have been actually sent by i, and h|i must contain the corresponding snd event, which will cause the send(m) vertex to be created locally as well. Similarly, a receive(m) could only be created remotely when a matching ack is processed on another node – but then i must have actually sent the ack, and the corresponding rcv event must be in h|i. G(h) | i cannot contain any extra edges either because the only edges that can be created in response to remote events are those between send and receive. Hence, the claim follows. 2

B.6 No red vertices on correct nodes Since we want to use the color black to denote ‘correct’ ver- tices, it is important to have the property that stable vertices on correct nodes are always black, no matter what the adver- sary may cause the faulty nodes to do. Note the restriction to stable vertices: if a send vertex has been added very re- cently, the corresponding ack may not have arrived yet, so the GCA has no choice but to color it yellow until the ack arrives.

Lemma 2 If h is a history and i ∈ N is a node that is correct in h, then all stable vertices v ∈ V (h) with host(v) = i are colored black.

Proof: There are only five points in the GCA that can cause a vertex to be colored red, namely in lines 41, 46, 89, 95, and 122. We consider these in turn. Assume a vertex on i was colored red in line 41. Then Ai must have produced a snd output that was added to the pending set in line 189 but was not removed in line 124 before flag-all-pending was invoked. Now, flag-all-pending is invoked whenever a rcv, ins, or del event is seen in the history (lines 100, 107, and 130). But a correct node immediately sends all required messages be- fore it proceeds to the next input. Therefore, Ai must have produced a snd output, but i did not actually send the cor- responding message. This contradicts our assumption that i is correct in h. The case for line 122 is quite similar. This line is executed only when a snd event is found in the history that does not correspond to a snd output that has previously been pro- duced (and added to pending). But since i is correct, it cannot have fabricated an output, and since Ai is determin- istic, the outputs produced during graph construction are the same as the ones produced in the original execution, so we have another contradiction.

Line 95 is reached when a new receive vertex is cre- ated in response to a rcv(m) event and added to ackpend (line 140), but the rcv(m) is not immediately followed by a snd(ack(m)) event; any other event would cause line 95 to be reached either indirectly via flag-all-pending or di- rectly via line 126. But since i is a correct node, it will send an ack(m) immediately after receiving a message m, so the receive vertex will be removed from ackpend again in line 116 before flag-ack is reached. Line 89 is only reachable from handle-extra-msg, which is not used in the basic GCA. (This is invoked when a node forks its log, which a correct node would not do either.) Finally, assume that a vertex v on i was colored red in line

  1. This means that a) v must have been in unacked, and b) its timestamp must be older than 2·Tprop. send vertices are added to unacked in line 58 when they are created, and removed in line 135 when the corresponding acknowledgment is seen in the history. If one of i’s send vertices was in this set at the end of graph reconstruction, i must have failed to receive an ack within 2·Tprop, but this cannot be the case if h is quiescent. This completes the proof. 2

B.7 Red vertices on faulty nodes Our goal is to use the color red for vertices in G that are definitely the result of misbehavior; thus, it is important to prove that at least one red vertex will always exist on a faulty node. However, keep in mind that G is defined in terms of the true global history h; hence, if a node i is faulty in h but not detectably faulty, G(h) will contain a red vertex on i, but we may not be able to reconstruct that vertex in Gν (), at least for any  that is available on correct nodes.

Lemma 3 If h is a history and i ∈ N is a node that is faulty in h, then at least one vertex v ∈ V (h) with host(v) = i will be colored red.

Proof: Recall from Section A.3 what it means for i to be faulty: it can 1) send a message without receiving any input; it can 2) fail to send an acknowledgment immediately after each received message, it can 3) send a message that Ai would not have produced, or it can 4) fail to send a message that Ai did produce.^3 Note that we are not considering “lies” such as equivocation or failure to record an incoming message; these types of misbehavior only make sense in the context of SNooPy, where nodes can make claims about their histories (for this, see Appendix C). We consider each of the four types of misbehavior in turn. If i sends an extra message m that is not an acknowledg- ment and does not correspond to any output of Ai, this will be detected in line 119 because m does not match any el- ements in pending (recall that such an entry is created for each snd output in line 189). This immediately causes a send vertex v with host(v) = i to be created in line 120, which is then colored red in line 122. Therefore, claims 1) and 3) hold. If i fails to send an acknowledgment after receiving a message m, this will cause the vertex v := receive(m)

(^3) Recall that, in Section A.3, correctness was defined with respect to a hypothetical state machine that is fed with all the inputs that i actually receives. Hence, we do not need to consider cases where i ignores inputs or injects fictitious inputs.

to be colored red in line 95. (Clearly, host(v) = i be- cause receive vertices are always created on the receiv- ing node.) The reason is that, in handle-event-rcv, v is added to the ackpend send; any subsequent handle-event calls other than handle-event-snd will im- mediately call flag-all-pending and thus lead to line 95. handle-event-snd can also reach line 95 via the flag-ack call at the end; the only way v can remain black is if v is removed from ackpend in line 116, which only occurs if the transmitted message is an acknowledgment for m. There- fore, claim 2) holds. If i fails to send a message m that Ai produces, this will cause the send(m) vertex to be colored red in flag-all-pending, specifically in line 41. This method is called from lines 100, 107, and 130, i.e., whenever Ai accepts the next input. Ai’s snd outputs are added to the pending set in line 189, and they are removed in line 124 only when the corresponding snd event is seen in the history. If m is output by Ai but not sent by i in h, (m,send(m)) will be added but not removed, and the red send vertex will be generated by the next call to flag-all-pending. Therefore, claim 4) holds. This completes the proof. Note that there are two additional ways in which ver- tices can be colored red, but neither is relevant for the present lemma. Line 89 can be reached only from handle-extra-msg, which is not used here, and line 46 can- not be reached because we have assumed that h is quiescent. 2

B.8 GCA uses colors appropriately Now we can easily prove the following corollary:

Theorem 3 If h is a history, then at least one vertex v ∈ V (h) with host(v) = i will be colored red if and only if i ∈ N is faulty in h.

Proof: This follows directly from the combination of Lemma 2 and Lemma 3. 2

C. GRAPH WITH HISTORIES In this section, we extend the model from Section B to a distributed setting. We no longer assume that the ’true’ history of the primary system is known; rather, we assume that nodes can make claims about their local histories. We model these claims as a history map ϕ(m), which is attached to each message m. Correct nodes set this map to their own history prefix at the time the message is sent; faulty nodes can set it arbitrarily. The problem, then, becomes how to reconstruct the provenance graph from a set of history maps, e.g., the ones that correspond to messages received by a cor- rect node. The resulting provenance graph may not be the ‘true’ provenance graph that would be generated from the actual execution, but we can establish a close correspondence between the two.

C.1 History map We say that a history h|i of a node i is valid if it conforms to Ai; if i is correct in a history h, one trivial example of a valid history of i is h|i. A pair (h 1 , h 2 ) of histories of i is consistent if h 1 is a prefix of h 2 , or vice versa. Let M (e) denote the set of messages received by the nodes in an execution e. We assume that there exists a history map ϕ that associates every message m ∈ M (e) with a history