+ All Categories
Home > Documents > Verified Firewall Policy Transformations for Test Case...

Verified Firewall Policy Transformations for Test Case...

Date post: 01-Feb-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
29
Verified Firewall Policy Transformations for Test Case Generation Achim D. Brucker 1 Lukas Br¨ ugger 2 Paul Kearney 3 Burkhart Wolff 4 1 SAP Research, Germany 2 Information Security, ETH Z¨ urich, Switzerland 3 Security Futures Practice, BT Innovate & Design, UK 4 Universit´ e Paris-Sud, France ICST 2010 Brucker, Br¨ ugger, Kearney, Wolff Verified Policy Transformations ICST 2010 1 / 27
Transcript
Page 1: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Verified Firewall Policy Transformationsfor Test Case Generation

Achim D. Brucker1 Lukas Brugger2

Paul Kearney3 Burkhart Wolff4

1SAP Research, Germany

2Information Security, ETH Zurich, Switzerland

3Security Futures Practice, BT Innovate & Design, UK

4Universite Paris-Sud, France

ICST 2010

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 1 / 27

Page 2: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

1 Motivation

2 Background

3 Firewall Testing: the Direct ApproachScenarioModelTesting

4 Firewall Testing: the Optimized ApproachThe IdeaThe MethodEmpirical Results

5 Conclusion

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 2 / 27

Page 3: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 3 / 27

Page 4: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 securityconfigurations were responsible for 80 percent of Air Forcevulnerabilities.”

Our goal: Test if a firewall configuration conforms to a specification

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 4 / 27

Page 5: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 conformto a specification

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 5 / 27

Page 6: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 6 / 27

Page 7: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Background

Model-based Testing with HOL-TestGen

An interactivemodel-based test tool

built upon thetheorem proverIsabelle/HOL

generates testdrivers

successfully used invarious case-studies

freely available at:

http://www.brucker.ch/projects/hol-testgen/

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 7 / 27

Page 8: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Firewall Testing: the Direct Approach

1 Motivation

2 Background

3 Firewall Testing: the Direct ApproachScenarioModelTesting

4 Firewall Testing: the Optimized Approach

5 Conclusion

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 8 / 27

Page 9: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 allowInternet dmz http 80 allow

dmz intranet smtp 25 allowintranet dmz imaps 993 allowintranet 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 thistalk)

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 9 / 27

Page 10: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 naturallevel:

definitionallow all from :: (α::adr) net ⇒ (α,β) Policy whereallow all from src net ≡ allow all | ‘ {pa. src pa @ src net}

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 10 / 27

Page 11: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Firewall Testing: the Direct Approach Model

The Policy

source destination protocol port action

Internet dmz smtp 25 allowInternet dmz http 80 allow

dmz intranet smtp 25 allowintranet dmz imaps 993 allowintranet 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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 11 / 27

Page 12: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 12 / 27

Page 13: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 3Rules 12 9 13 13TC Generation Time (sec) 26382 187 59364 1388Test Cases 1368 264 1544 470

Reason: Large cascades of case distinctions over input and output

However, many of these case splits are redundant

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 13 / 27

Page 14: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 3Rules 12 9 13 13TC Generation Time (sec) 26382 187 59364 1388Test Cases 1368 264 1544 470

Reason: Large cascades of case distinctions over input and output

However, many of these case splits are redundant

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 13 / 27

Page 15: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 ApproachThe IdeaThe MethodEmpirical Results

5 Conclusion

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 14 / 27

Page 16: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 bedetected syntactically on a sequence of policy rules

Make transformations between representations automatic and verifythem in Isabelle

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 15 / 27

Page 17: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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

of Firewall Policy

Test Cases Test Cases

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 16 / 27

Page 18: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 testcases:

deny all ++ deny port dmz internet 21++ allow all from to dmz internet

deny all ++ allow all from to dmz internet

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 17 / 27

Page 19: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 testcases:

deny all ++ deny port dmz internet 21++ allow all from to dmz internet

deny all ++ allow all from to dmz internet

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 17 / 27

Page 20: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 whereC 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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 18 / 27

Page 21: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 rulealready denies all the rules between these two networks.

fun removeShadowRules2::whereremoveShadowRules2 ((AllowPortFromTo x y p)#z) =

if (DenyAllFromTo x y) mem zthen removeShadowRules2 zelse (AllowPortFromTo x y p)#(removeShadowRules2 z)

| removeShadowRules2 (x#y) = x#(removeShadowRules2 y)| removeShadowRules2 [] = []

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 19 / 27

Page 22: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Firewall Testing: the Optimized Approach The Method

More Transformations

Other transformations include:I Remove all the rules after a DenyAll

I Sort the rules along the subnet hierarchy

I Add additional rules (i.e. split a global rule into smaller ones)

I Remove duplicate rules

I Remove rules with an empty domain

I Separate the policy into several policies

Each of them is proven formally to keep the semantics under certainpreconditions

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 20 / 27

Page 23: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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:I each element completely specifies the behavior of some network

segment

I no element contains redundant rules

Thus, the normalization does:I pre-partition the test space

I remove redundancies

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 21 / 27

Page 24: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 inputpolicies, satisfying certain preconditions

As HOL-TestGen is built upon the theorem prover Isabelle/HOL, wecan prove formally the correctness of such normalizations: E.g.:

theorem C eq normalize:assumes member DenyAll passumes allNetsDistinct p

shows C (list2policy (normalize p)) = C p

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 22 / 27

Page 25: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 andthe required time by several orders of magnitude.

R1 R2 R3 R4

Not Normalized Networks 3 3 4 3Rules 12 9 13 13TC Generation Time (sec) 26382 187 59364 1388Test Cases 1368 264 1544 470

Normalized Rules 14 14 24 26Normalization (sec) 0.6 0.4 1.1 0.8TC Generation Time (sec) 0.9 0.6 1.2 0.7Test Cases 20 20 34 22

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 23 / 27

Page 26: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Firewall Testing: the Optimized Approach Empirical Results

Number of Test Cases

10

100

1000

ETH 1ETH 2

ETH 3R 1 R 2 R 3 R 4 R 5 R 6 R 7 R 8 R 9 R 10

num

ber

ofte

stca

ses

unnormalized policy normalized policy

The normalization of policies decreases the number of test cases by severalorders of magnitude.

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 24 / 27

Page 27: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

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

Firewall Testing: the Optimized Approach Empirical Results

Number of Rules

0

100

200

300

400

500

600

50 100 150 200 250 300num

ber

ofru

les

(nor

mal

ized

)

number of rules (unnormalized)

5 networks 10 networks 25 networks

The number of rules of a policy after normalization increases withboth the number of rules in the unnormalized policy and the numberof networks.

It can be smaller or greater than before

Brucker, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 25 / 27

Page 28: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 26 / 27

Page 29: Verified Firewall Policy Transformations for Test Case ...archiv.infsec.ethz.ch/people/lukasbru/2010-icst-presentation.pdf · {source le{ {revision{ 2010-04-08 {time{ {owner{Veri

–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 securityby ensuring that network devices implement the security policycorrectly.

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, Brugger, Kearney, Wolff ()Verified Policy Transformations ICST 2010 27 / 27


Recommended