Top Banner
Scalable Verification of Stateful Networks Aurojit Panda, Ori Lahav, Katerina Argyraki, Mooly Sagiv, Scott Shenker UC Berkeley, TAU, ICSI
80

Scalable Verification of Stateful Networks

Dec 27, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scalable Verification of Stateful Networks

Scalable Verification of Stateful Networks

Aurojit Panda, Ori Lahav, Katerina Argyraki, Mooly Sagiv, Scott ShenkerUC Berkeley, TAU, ICSI

Page 2: Scalable Verification of Stateful Networks

Roadmap

• Why consider stateful networks?

• The current state of stateful network verification?

• VMN: Our system for verifying stateful networks.

• Scaling verification.

Page 3: Scalable Verification of Stateful Networks

Why consider stateful networks?

Page 4: Scalable Verification of Stateful Networks

Network State Increasingly Common

• 1/3rd of deployed network devices are middleboxes

• These are typically stateful (e.g., firewalls, caches, etc.)

• NFV will only make these more common

Page 5: Scalable Verification of Stateful Networks

Network State Increasingly Common

• 1/3rd of deployed network devices are middleboxes

• These are typically stateful (e.g., firewalls, caches, etc.)

• NFV will only make these more common

• Later in this conference: stateful programming for P4 switches.

• SNAP: Stateful Network-Wide Abstractions for Packet Processing

Page 6: Scalable Verification of Stateful Networks

Network State Increasingly Common

• 1/3rd of deployed network devices are middleboxes

• These are typically stateful (e.g., firewalls, caches, etc.)

• NFV will only make these more common

• Later in this conference: stateful programming for P4 switches.

• SNAP: Stateful Network-Wide Abstractions for Packet Processing

• Bottomline: Stateful is increasingly relevant.

Page 7: Scalable Verification of Stateful Networks

Verification Checks Invariants

• We look at Reachability/Isolation invariants (same as stateless verification)

Page 8: Scalable Verification of Stateful Networks

Verification Checks Invariants

• We look at Reachability/Isolation invariants (same as stateless verification)

• Packets from host A cannot reach host B

Page 9: Scalable Verification of Stateful Networks

Verification Checks Invariants

• We look at Reachability/Isolation invariants (same as stateless verification)

• Packets from host A cannot reach host B

• But statefulness raises some important issues:

Page 10: Scalable Verification of Stateful Networks

Verification Checks Invariants

• We look at Reachability/Isolation invariants (same as stateless verification)

• Packets from host A cannot reach host B

• But statefulness raises some important issues:

• Invariants include temporal aspects.

Page 11: Scalable Verification of Stateful Networks

Verification Checks Invariants

• We look at Reachability/Isolation invariants (same as stateless verification)

• Packets from host A cannot reach host B

• But statefulness raises some important issues:

• Invariants include temporal aspects.

• Storing state can result in spooky action at a distance.

Page 12: Scalable Verification of Stateful Networks

Temporal Invariants

Server 0

Server 1Firewall

User 0

User 1User 1 receives no packets from server 0 unless a connection is initiated.

denyserver*user*

Page 13: Scalable Verification of Stateful Networks

Temporal Invariants

Server 0

Server 1Firewall

User 0

User 1User 1 receives no packets from server 0 unless a connection is initiated.

Standard Reachability Temporal Property

denyserver*user*

Page 14: Scalable Verification of Stateful Networks

Action at a Distance

Server 0

Server 1Firewall Cache

User 0

User 1

denyuser1server0

User 1 receives no packets from Server 0

Page 15: Scalable Verification of Stateful Networks

Action at a Distance

Server 0

Server 1Firewall

Secret

Cache

User 0

User 1

denyuser1server0

User 1 receives no packets from Server 0

Page 16: Scalable Verification of Stateful Networks

Action at a Distance

Server 0

Server 1Firewall

Secret

Secret

Cache

User 0

User 1

denyuser1server0

User 1 receives no packets from Server 0

Page 17: Scalable Verification of Stateful Networks

Action at a Distance

Server 0

Server 1Firewall

Secret

Secret

Cache

User 0

User 1

denyuser1server0

User 1 receives no packets from Server 0

Secret

Page 18: Scalable Verification of Stateful Networks

Action at a Distance

Server 0

Server 1Firewall

Secret

Secret

Cache

User 0

User 1

denyuser1server0

User 1 receives no packets from Server 0User 1 receives no data from Server 0

Secret

Page 19: Scalable Verification of Stateful Networks

Roadmap

• Why consider stateful networks?

• The current state of stateful network verification?

• VMN: Our system for verifying stateful networks.

• Scaling verification.

Page 20: Scalable Verification of Stateful Networks

Network Verification Today• Lots of existing work has looked at network verification.

Page 21: Scalable Verification of Stateful Networks

Network Verification Today• Lots of existing work has looked at network verification.• Switches: Static forwarding rules in switches.

HSA, Veriflow, NetKAT, etc.

Page 22: Scalable Verification of Stateful Networks

Network Verification Today• Lots of existing work has looked at network verification.• Switches: Static forwarding rules in switches.

HSA, Veriflow, NetKAT, etc.

• SDN Controller: Code generating these rules.

Vericon, FlowLog, etc

Page 23: Scalable Verification of Stateful Networks

Network Verification Today• Lots of existing work has looked at network verification.• Switches: Static forwarding rules in switches.

HSA, Veriflow, NetKAT, etc.

• SDN Controller: Code generating these rules.

Vericon, FlowLog, etc

• Testing for stateful networks

Buzz: Generate packets that are likely to trigger interesting behavior.

Page 24: Scalable Verification of Stateful Networks

Network Verification Today• Lots of existing work has looked at network verification.• Switches: Static forwarding rules in switches.

HSA, Veriflow, NetKAT, etc.

• SDN Controller: Code generating these rules.

Vericon, FlowLog, etc

• Testing for stateful networks

Buzz: Generate packets that are likely to trigger interesting behavior.

• Verification for stateful networks

SymNet: Uses symbolic execution to verify networks with middleboxes.

Page 25: Scalable Verification of Stateful Networks

Roadmap

• Why consider stateful networks?

• The current state of stateful network verification?

• VMN: Our system for verifying stateful networks.

• Scaling verification.

Page 26: Scalable Verification of Stateful Networks

VMN: System for scalable verification of stateful networks.

Page 27: Scalable Verification of Stateful Networks

VMN FlowModel each middlebox in the network

Build network forwarding model

Invariant Holds Example of violation

Logical Invariants

SMT Solver (Z3 from MSR)

Page 28: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

Page 29: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

Page 30: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

• Code written to match bit patterns in packet, etc.

Page 31: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

• Code written to match bit patterns in packet, etc.

• Configuration is in terms of higher level abstractions

Page 32: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

• Code written to match bit patterns in packet, etc.

• Configuration is in terms of higher level abstractions

• E.g., source and destination addresses, payload matches regex, etc.

Page 33: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

• Code written to match bit patterns in packet, etc.

• Configuration is in terms of higher level abstractions

• E.g., source and destination addresses, payload matches regex, etc.

• Operators think and configure in terms of these abstractions.

Page 34: Scalable Verification of Stateful Networks

Modeling Middleboxes• One approach: Extract model from code

• Problem: At the wrong level of abstraction.

• Code written to match bit patterns in packet, etc.

• Configuration is in terms of higher level abstractions

• E.g., source and destination addresses, payload matches regex, etc.

• Operators think and configure in terms of these abstractions.

• Verify invariants written in these terms.

Page 35: Scalable Verification of Stateful Networks

Example Middlebox Configuration

• Drop all packets from connections transmitting infected files.

• How to define infected files: bit pattern for all worms: not really accurate

• Also not how operators think about this.

Page 36: Scalable Verification of Stateful Networks

Modeling Middleboxes• Take a different tack: model specified in terms of classification oracle.

• Oracle responsible for classifying packet.

• We are not verifying implementation (nor is anyone else).

Page 37: Scalable Verification of Stateful Networks

Modeling Middleboxes• Take a different tack: model specified in terms of classification oracle.

• Oracle responsible for classifying packet.

• We are not verifying implementation (nor is anyone else).

• Model specifies forwarding behavior in terms of these abstractions.

• Need to know forwarding behavior to reason about reachability.

• Require that any state that affects forwarding behavior also specified.

Page 38: Scalable Verification of Stateful Networks

Modeling Middleboxes

Page 39: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify PacketDetermines what application sent a packet, etc. Complex, proprietary processing.

Page 40: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Update Classification State

Determines what application sent a packet, etc. Complex, proprietary processing.

Update state required for classification.

Page 41: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Update Classification State

Determines what application sent a packet, etc. Complex, proprietary processing.

Update state required for classification.

Update Forwarding State Update forwarding State.

Page 42: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Update Classification State

Forward Packet

Determines what application sent a packet, etc. Complex, proprietary processing.

Update state required for classification.

Always simple: forward or drop packets.

Update Forwarding State Update forwarding State.

Page 43: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Update Classification State

Forward Packet

Determines what application sent a packet, etc. Complex, proprietary processing.

Update state required for classification.

Always simple: forward or drop packets.

Oracle: Specify data dependencies and outputs

Update Forwarding State Update forwarding State.

Page 44: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Update Classification State

Forward Packet

Determines what application sent a packet, etc. Complex, proprietary processing.

Update state required for classification.

Always simple: forward or drop packets.

Oracle: Specify data dependencies and outputs

Forwarding Model: Specify Completely

Update Forwarding State Update forwarding State.

Page 45: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Forward Packet

Update Forwarding State

Update Classification State

Page 46: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Forward Packet

Update Forwarding State

OutputsIs packet infected.

DependenciesSee all packets in connection (flow).

Update Classification State

Page 47: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Forward Packet

Update Forwarding State

OutputsIs packet infected.

DependenciesSee all packets in connection (flow).

if (infected) { infected_connections.add(packet.flow) }

Update Classification State

Page 48: Scalable Verification of Stateful Networks

Modeling Middleboxes

Classify Packet

Forward Packet

Update Forwarding State

OutputsIs packet infected.

DependenciesSee all packets in connection (flow).

if (packet.flow not in infected_connections) { forward (packet); }

if (infected) { infected_connections.add(packet.flow) }

Update Classification State

Page 49: Scalable Verification of Stateful Networks

Modeling Middleboxesinfected connection( f low(p))

=) (�rcv(n, p

0)^f low(p

0) = f low(p)^infected(p))

snd(n, p) =)(�rcv(n, p)^¬infected connection( f low(p)))

Page 50: Scalable Verification of Stateful Networks

VMN FlowModel each middlebox in the network

Build network forwarding model

Invariant Holds Example of violation

Logical Invariants

SMT Solver (Z3 from MSR)

Page 51: Scalable Verification of Stateful Networks

Network Transfer Functions

• Kazemian 2012 developed the idea of a network transfer function.

• A single function modeling the behavior of the entire network.

• VMN models static elements in the network using a transfer function.

Page 52: Scalable Verification of Stateful Networks

Network Transfer Function

Firewall (f) Cache (c)Switch Router Switch

A

B

C

D

Page 53: Scalable Verification of Stateful Networks

f(p, port) ⌘

8>>>>>><

>>>>>>:

(p, f) if port = A ^ (dst(p) = C _ dst(p) = D)

(p, c) if port = f ^ dst(p) = C _ dst(p) = D)

(p, C) if port = c ^ dst(p) = C

(p,D) if port = c ^ dst(p) = D

. . .

Network Transfer Function

Firewall (f) Cache (c)

A

B

C

D

Page 54: Scalable Verification of Stateful Networks

Roadmap

• Why consider stateful networks?

• The current state of stateful network verification?

• VMN: Our system for verifying stateful networks.

• Scaling verification.

Page 55: Scalable Verification of Stateful Networks

Networks are Large• Networks are huge in practice

• For example Google had 900K machines (approximately) in 2011

• ISPs connect large numbers of machines.

• Lots of middleboxes in these networks

• In datacenter each machine might be one or more middlebox.

• How do we address this?

Page 56: Scalable Verification of Stateful Networks

Scaling Techniques Thus Far

• Abstract middlebox models

• Simplify what needs to be considered per-middlebox.

• Abstract network

• Simplify network forwarding.

Page 57: Scalable Verification of Stateful Networks

Those Techniques are not Enough

Page 58: Scalable Verification of Stateful Networks

Those Techniques are not Enough

• TACAS 2016: Network verification with state is EXPSPACE-complete.

Page 59: Scalable Verification of Stateful Networks

Those Techniques are not Enough

• TACAS 2016: Network verification with state is EXPSPACE-complete.

• Practically for us SMT solvers timeout with large instances.

Page 60: Scalable Verification of Stateful Networks

Those Techniques are not Enough

• TACAS 2016: Network verification with state is EXPSPACE-complete.

• Practically for us SMT solvers timeout with large instances.

• Other methods also do not handle such large instances

• Symbolic execution is exponential in number of branches, not better.

Page 61: Scalable Verification of Stateful Networks

Those Techniques are not Enough

• TACAS 2016: Network verification with state is EXPSPACE-complete.

• Practically for us SMT solvers timeout with large instances.

• Other methods also do not handle such large instances

• Symbolic execution is exponential in number of branches, not better.

• Our techniques work for small instances, what to do about large instances?

Page 62: Scalable Verification of Stateful Networks

Scaling Verification

• Challenge: Run verification on a subnetwork of size independent of network.

• Avoid instability and scale to arbitrary network sizes.

Page 63: Scalable Verification of Stateful Networks

Scaling Verification

• Challenge: Run verification on a subnetwork of size independent of network.

• Avoid instability and scale to arbitrary network sizes.

• Goal: Identify subnetwork where verification results translate to whole network.

Page 64: Scalable Verification of Stateful Networks

Network Slices

• Slices: Subnetworks for which a bisimulation with the original network exists.

• Ensures equivalent step in subnetwork for each step in the original network

• Slices are selected depending on the invariant being checked.

Page 65: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Page 66: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Invariant: RR cannot access data from Coyote’s server

Page 67: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Invariant: RR cannot access data from Coyote’s server

Willie E Coyote

Page 68: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Invariant: RR cannot access data from Coyote’s server

Willie E CoyoteFirewall

Cache

Page 69: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Invariant: RR cannot access data from Coyote’s server

Willie E CoyoteFirewall

Cache

Page 70: Scalable Verification of Stateful Networks

Network SlicesACME Hosting

Willie E Coyote

Road RunnerFirewall

Cache

SylvesterTweety

Firewallpredator 6$ prey server

prey 6$ predator server

Invariant: RR cannot access data from Coyote’s server

Willie E CoyoteFirewall

Cache

Establishes a bisimulation between slice and network.Allows us to prove invariants in the slice.

Page 71: Scalable Verification of Stateful Networks

Cannot always find such a slice.

Page 72: Scalable Verification of Stateful Networks

Finding Slices: Flow Parallel Middleboxes• To achieve performance, many middleboxes are flow parallel

• State from one connection cannot affect another connection.

• Example: Stateful firewall.

• For networks with only flow parallel NFs

• Only need to consider paths between hosts.

• Network slices whose slice is independent of network size.

Page 73: Scalable Verification of Stateful Networks

Finding Slices: Origin Equivalence• Middleboxes like caches don’t distinguish where a request originates

• More generally, state is shared, but origin does not matter.

• In this case, need to ensure that all states in the network can appear in a slice.

• Pick one member from each policy group.

• Scalable if increasing network size does not increase number of policy groups

Page 74: Scalable Verification of Stateful Networks

Symmetry: Going Beyond Slices

• Slices merely reduce the size of the problem for each invariant

• Number of invariants is still a problem.

• Rely on the observation that lots of hosts in networks are symmetric

• Policies largely applied to groups of hosts (departments, etc.)

• Can use this symmetry to reduce number of invariants checked

Page 75: Scalable Verification of Stateful Networks

Evaluation Setup: Datacenter• Consider AWS like multi-tenant datacenter.

• Each tenant has policies for private and public hosts.

• Three verification tasks

• Private hosts for one tenant cannot reach another

• Public host for one tenant cannot reach private hosts for another

• Public hosts are universally reachable.

Page 76: Scalable Verification of Stateful Networks

Verification Time (Datacenter)

0.01

0.1

1

10

100

1000

10000

100000

Slice 5 10 15 20

Tim

e (S

)

# of Tenants

Priv-Priv Pub-Priv Priv-Pub

Page 77: Scalable Verification of Stateful Networks

Verification Time (Datacenter)

0.01

0.1

1

10

100

1000

10000

100000

Slice 5 10 15 20

Tim

e (S

)

# of Tenants

Priv-Priv Pub-Priv Priv-Pub

Page 78: Scalable Verification of Stateful Networks

Role of Symmetry• Consider a private datacenter

• User verification to prevent some bugs from a Microsoft DC (IMC 2013)

• Bugs include

• Misconfigured firewalls

• Misconfigured redundant firewalls

• Misconfigured redundant routing

• Measure time to verify as a function of number of symmetric policy groups

Page 79: Scalable Verification of Stateful Networks

Verification Time (With Symmetry)

0

50

100

150

200

250

300

350

25 50 100 250 500 1000

Tim

e (S

)

# of Policy Equivalence Classes

Rules Redundancy Traversal

Page 80: Scalable Verification of Stateful Networks

Conclusion

• Verifying stateful networks is increasingly more important.

• The primary challenge is scaling to realistic network.

• Splitting network into smaller verifiable portions is necessary.