Verified Firewall Policy Transformations for Test Case Generation - - PowerPoint PPT Presentation

verified firewall policy transformations for test case
SMART_READER_LITE
LIVE PREVIEW

Verified Firewall Policy Transformations for Test Case Generation - - PowerPoint PPT Presentation

Verified Firewall Policy Transformations for Test Case Generation Achim D. Brucker 1 ugger 2 Lukas Br Paul Kearney 3 Burkhart Wolff 4 1 SAP Research, Germany 2 Information Security, ETH Z urich, Switzerland 3 Security Futures Practice, BT


slide-1
SLIDE 1

–sourcefile– –revision– 2010-04-08 –time– –owner–

Verified Firewall Policy Transformations for Test Case Generation

Achim D. Brucker1 Lukas Br¨ ugger2 Paul Kearney3 Burkhart Wolff4

1SAP Research, Germany 2Information Security, ETH Z¨

urich, Switzerland

3Security Futures Practice, BT Innovate & Design, UK 4Universit´

e Paris-Sud, France

ICST 2010

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 1 / 27

slide-2
SLIDE 2

–sourcefile– –revision– 2010-04-08 –time– –owner–

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach Scenario Model Testing

4

Firewall Testing: the Optimized Approach The Idea The Method Empirical Results

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 2 / 27

slide-3
SLIDE 3

–sourcefile– –revision– 2010-04-08 –time– –owner– Motivation

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach

4

Firewall Testing: the Optimized Approach

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 3 / 27

slide-4
SLIDE 4

–sourcefile– –revision– 2010-04-08 –time– –owner– Motivation

Motivation

Firewalls are cornerstones of security infrastructures Policies often change heavily over time Their configuration varies and is highly error-prone: “NSA found that inappropriate or incorrect security configurations were responsible for 80 percent of Air Force vulnerabilities.” Our goal: Test if a firewall configuration conforms to a specification

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 4 / 27

slide-5
SLIDE 5

–sourcefile– –revision– 2010-04-08 –time– –owner– Motivation

Motivation

Scenario 1: Single Firewall

DMZ Internet (extern) Intranet (intern)

  • Scenario 2: Networks

A B

H5 H4 H3 H2 H1

Our goal: Test if several network component configurations conform to a specification

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 5 / 27

slide-6
SLIDE 6

–sourcefile– –revision– 2010-04-08 –time– –owner– Background

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach

4

Firewall Testing: the Optimized Approach

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 6 / 27

slide-7
SLIDE 7

–sourcefile– –revision– 2010-04-08 –time– –owner– Background

Model-based Testing with HOL-TestGen

An interactive model-based test tool built upon the theorem prover Isabelle/HOL generates test drivers successfully used in various case-studies freely available at: http://www.brucker.ch/projects/hol-testgen/

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 7 / 27

slide-8
SLIDE 8

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach Scenario Model Testing

4

Firewall Testing: the Optimized Approach

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 8 / 27

slide-9
SLIDE 9

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Scenario

A Typical Scenario

DMZ Internet (extern) Intranet (intern)

  • source

destination protocol port action Internet dmz smtp 25 allow Internet dmz http 80 allow dmz intranet smtp 25 allow intranet dmz imaps 993 allow intranet Internet http 80 allow any any any any deny

In this talk, firewalls are stateless packet filters HOL-TestGen can also handle stateful firewalls (not considered in this talk)

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 9 / 27

slide-10
SLIDE 10

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Model

HOL-Model of a Firewall Policy

A firewall makes a decision based on single packets. types (α,β) packet = id ×(α::adr) src × (α::adr) dest ×β content Different address and content representations are possible. A policy either allows or denies a packet: datatype α decision = allow α | deny α A policy is a mapping from packets to decisions: types (α,β) Policy = (α,β) packet ⇀((α,β) packet) decision A library of policy combinators allows to define policies on a natural level: definition allow all from :: (α::adr) net ⇒ (α,β) Policy where allow all from src net ≡ allow all | ‘ {pa. src pa ⊏ src net}

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 10 / 27

slide-11
SLIDE 11

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Model

The Policy

source destination protocol port action Internet dmz smtp 25 allow Internet dmz http 80 allow dmz intranet smtp 25 allow intranet dmz imaps 993 allow intranet Internet http 80 allow any any any any deny

definition Policy ≡ deny all ++ allow port intranet internet 80 ++ allow port intranet dmz 993 ++ allow port dmz intranet 25 ++ allow port internet dmz 80 ++ allow port internet dmz 25

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 11 / 27

slide-12
SLIDE 12

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Testing

Testing Stateless Firewalls

The test specification: test spec test: “P x = ⇒FUT x = Policy x’’ FUT: Placeholder for Firewall Under Test P: a predicate specifying which kind of packets we are interested in. E.g.: wellformed packets which cross some network boundary. Generates test data like: FUT (12, ((7,13,12,10),6), ((172,168,2,1),80), content) = Some (deny (12, ((7,13,12,10),6), ((172,168,2,1),80), content))

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 12 / 27

slide-13
SLIDE 13

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Testing

Problems with the direct approach

The direct approach does not scale: R1 R2 R3 R4 Networks 3 3 4 3 Rules 12 9 13 13 TC Generation Time (sec) 26382 187 59364 1388 Test Cases 1368 264 1544 470

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 13 / 27

slide-14
SLIDE 14

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Direct Approach Testing

Problems with the direct approach

The direct approach does not scale: R1 R2 R3 R4 Networks 3 3 4 3 Rules 12 9 13 13 TC Generation Time (sec) 26382 187 59364 1388 Test Cases 1368 264 1544 470 Reason: Large cascades of case distinctions over input and output However, many of these case splits are redundant

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 13 / 27

slide-15
SLIDE 15

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach

4

Firewall Testing: the Optimized Approach The Idea The Method Empirical Results

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 14 / 27

slide-16
SLIDE 16

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Idea

Idea

Input to test case generation is a representation of the model Test case generation depends on that specific representation Use a representation of (semantically equivalent) model, which is “easier” to test Idea is to remove redundant case-splits beforehand; they can be detected syntactically on a sequence of policy rules Make transformations between representations automatic and verify them in Isabelle

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 15 / 27

slide-17
SLIDE 17

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Idea

Model Transformations for Test Case Generation (1/2)

Test Case Generation Test Case Generation

Verified Model Transformation

Model of Firewall Policy Optimized Model

  • f Firewall Policy

Test Cases Test Cases

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 16 / 27

slide-18
SLIDE 18

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Idea

Model Transformations for Test Case Generation (2/2)

Idea is fundamental to model-based test case generation. E.g.: if x < −10 then if x < 0 then P else Q else Q if x < −10 then P else Q lead to different test cases

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 17 / 27

slide-19
SLIDE 19

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Idea

Model Transformations for Test Case Generation (2/2)

Idea is fundamental to model-based test case generation. E.g.: if x < −10 then if x < 0 then P else Q else Q if x < −10 then P else Q lead to different test cases Similarly, the following two policies produce a different set of test cases: deny all ++ deny port dmz internet 21 ++ allow all from to dmz internet deny all ++ allow all from to dmz internet

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 17 / 27

slide-20
SLIDE 20

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Method

The Method

Represent transformations as recursive function directly in HOL Provide only a fixed number of combinators datatype (α,β) Combinators = DenyAll | DenyAllFromTo α α | AllowPortFromTo α α β | Conc ((α,β) Combinators) ((α,β) Combinators) (⊕) and map them to the standard combinators: fun C where C DenyAll = deny all |C (DenyAllFromTo x y) = deny all from to x y |C (AllowPortFromTo x y p) = allow port x y p |C (x ⊕y) = C x ++ C y

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 18 / 27

slide-21
SLIDE 21

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Method

A Typical Transformation

Remove all rules allowing a port between two networks, if a former rule already denies all the rules between these two networks. fun removeShadowRules2:: where removeShadowRules2 ((AllowPortFromTo x y p)#z) = if (DenyAllFromTo x y) mem z then removeShadowRules2 z else (AllowPortFromTo x y p)#(removeShadowRules2 z) | removeShadowRules2 (x#y) = x#(removeShadowRules2 y) | removeShadowRules2 [] = []

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 19 / 27

slide-22
SLIDE 22

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Method

More Transformations

Other transformations include:

◮ Remove all the rules after a DenyAll ◮ Sort the rules along the subnet hierarchy ◮ Add additional rules (i.e. split a global rule into smaller ones) ◮ Remove duplicate rules ◮ Remove rules with an empty domain ◮ Separate the policy into several policies

Each of them is proven formally to keep the semantics under certain preconditions

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 20 / 27

slide-23
SLIDE 23

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Method

Computing a Normal Form for Policy Models

Transformations can be combined to compute a normal form The full normalization procedure consists of nine such transformations The result is a list of policies, in which:

◮ each element completely specifies the behavior of some network

segment

◮ no element contains redundant rules

Thus, the normalization does:

◮ pre-partition the test space ◮ remove redundancies Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 21 / 27

slide-24
SLIDE 24

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach The Method

Correctness of the Normalization

Correctness of the normalization must hold for arbitrary input policies, satisfying certain preconditions As HOL-TestGen is built upon the theorem prover Isabelle/HOL, we can prove formally the correctness of such normalizations: E.g.: theorem C eq normalize: assumes member DenyAll p assumes allNetsDistinct p shows C (list2policy (normalize p)) = C p

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 22 / 27

slide-25
SLIDE 25

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach Empirical Results

Empirical Results

The normalization of policies decreases the number of test cases and the required time by several orders of magnitude. R1 R2 R3 R4 Not Normalized Networks 3 3 4 3 Rules 12 9 13 13 TC Generation Time (sec) 26382 187 59364 1388 Test Cases 1368 264 1544 470 Normalized Rules 14 14 24 26 Normalization (sec) 0.6 0.4 1.1 0.8 TC Generation Time (sec) 0.9 0.6 1.2 0.7 Test Cases 20 20 34 22

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 23 / 27

slide-26
SLIDE 26

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach Empirical Results

Number of Test Cases

10 100 1000 ETH 1 ETH 2 ETH 3 R 1 R 2 R 3 R 4 R 5 R 6 R 7 R 8 R 9 R 10 number of test cases unnormalized policy normalized policy

The normalization of policies decreases the number of test cases by several

  • rders of magnitude.

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 24 / 27

slide-27
SLIDE 27

–sourcefile– –revision– 2010-04-08 –time– –owner– Firewall Testing: the Optimized Approach Empirical Results

Number of Rules

100 200 300 400 500 600 50 100 150 200 250 300 number of rules (normalized) number of rules (unnormalized) 5 networks 10 networks 25 networks

The number of rules of a policy after normalization increases with both the number of rules in the unnormalized policy and the number

  • f networks.

It can be smaller or greater than before

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 25 / 27

slide-28
SLIDE 28

–sourcefile– –revision– 2010-04-08 –time– –owner– Conclusion

1

Motivation

2

Background

3

Firewall Testing: the Direct Approach

4

Firewall Testing: the Optimized Approach

5

Conclusion

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 26 / 27

slide-29
SLIDE 29

–sourcefile– –revision– 2010-04-08 –time– –owner– Conclusion

Conclusion

Nice scenario of an integrated approach for test and proof. Theorem-prover-based testing can increase the overall system security by ensuring that network devices implement the security policy correctly. Large gains in performance allows to process realistic policies. All transformations are verified. Normalization is domain-specific, could potentially be generalized. More investigations into the quality of test data required. http://www.brucker.ch/projects/hol-testgen/

Brucker, Br¨ ugger, Kearney, Wolff () Verified Policy Transformations ICST 2010 27 / 27