Static Checking of Dynamically-Varying Security Policies in - - PowerPoint PPT Presentation

static checking of dynamically varying security policies
SMART_READER_LITE
LIVE PREVIEW

Static Checking of Dynamically-Varying Security Policies in - - PowerPoint PPT Presentation

Static Checking of Dynamically-Varying Security Policies in Database-Backed Applications Adam Chlipala OSDI 2010 Beyond Code Injection 1.Injection An application includes an Dependent on application-specific unintended run-time program


slide-1
SLIDE 1

Static Checking of Dynamically-Varying Security Policies in Database-Backed Applications

Adam Chlipala OSDI 2010

slide-2
SLIDE 2

2

Beyond Code Injection

An application includes an unintended run-time program interpreter Dependent on application-specific authentication and access control regimes!

1.Injection 2.Cross Site Scripting 3.Broken Authentication and Session Mgmt. 4.Insecure Direct Object References 5.Cross Site Request Forgery 6.Security Misconfiguration 7.Insecure Cryptographic Storage ....

slide-3
SLIDE 3

3

Authentication Snafus

slide-4
SLIDE 4

4

Surprise attack Security Policy

Roads to Security

Resource Attack vector #1 Attack vector #2 Attack vector #3 Audit Audit Audit Information flow: who can learn what Access control: who can change what

slide-5
SLIDE 5

5

Dynamic Checking

Database Program Variable

Sensitive Datum

Program Variable Program Variable Output to User Store security information with values Check before interaction with environment.

Pros

  • Easy to add to existing programs
  • Flexibility in coding security checks

Cons

  • Bugs are only found for program paths that are tested.
  • Performance overhead
slide-6
SLIDE 6

6

Static Checking

Database Program Variable Program Variable Program Variable Output to User

Pros

  • Checks all program paths at compile time
  • No changes to run-time behavior required

Cons

  • Usually requires extensive program annotation
  • Limited policy expressiveness

Type Type Type Type Type

Sensitive Datum

High Security Low Security Subtyping check

slide-7
SLIDE 7

7

The Best of Both Worlds

The

UrFlow

analysis

for the Ur/Web programming language

Like Dynamic Checking:

  • No program annotations

required

  • Flexible and

programmer-accessible policy language (SQL) Like Security Typing:

  • Checks all program paths

statically

  • No run-time overhead
slide-8
SLIDE 8

8

A Word About Ur/Web

queryX (SELECT * FROM t) (fn row => <xml><tr> <td>{[row.T.A]}</td> <td>{[row.T.B]}</td> <td>{[row.T.C]}</td> <td>{[row.T.D]}</td> <td><form><submit action={delete row.T.A} value="Delete"/> </form></td> </tr></xml>);

Integrated parsing and type-checking of SQL and HTML

slide-9
SLIDE 9

9

Simple Policies

policy sendClient (SELECT Id, Name FROM Secrets)

Id Name Secret

Secrets

Client may learn anything this query could return.

slide-10
SLIDE 10

10

Reasoning About Knowledge

policy sendClient (SELECT * FROM Secrets WHERE known(Code))

Id Name Secret Code

Secrets

slide-11
SLIDE 11

11

What is “known”?

Web page that generated this request App source “foo” 42 AUTH (Username, Password) = (U, P) Cookies n v

known: “foo” 42 n v (U, P) U P ((42, v), P) (“foo”, n) (42, v)

slide-12
SLIDE 12

12

Multi-Table Policies

policy sendClient (SELECT Secret FROM Secrets, Users WHERE Owner = Users.Id AND known(Password))

Id Name Secret Owner

Secrets

Id Name Password

Users

slide-13
SLIDE 13

13

Understanding SQL Usage

Program Execution

... ... (U, P) = readCookie(AUTH); pass = SELECT Password FROM Users WHERE Id = U; if (pass != P) abort(); ... ... ... rows = SELECT Secret FROM Secrets WHERE Owner = U; // Send rows to client.... ...

∃ u ∈ Users. u.Id = U ∧ u.Password = P ∀ v. mightSend(v) ⇒ ∃ s ∈ Secrets. s.Owner = U ∧ v = s.Secret known (U, P)

slide-14
SLIDE 14

14

Understanding SQL Usage

∃ u ∈ Users. u.Id = U ∧ u.Password = P ∀ v. mightSend(v) ⇒ ∃ s ∈ Secrets. s.Owner = U ∧ v = s.Secret known (U, P)

∧ ∧

policy sendClient (SELECT Secret FROM Secrets, Users WHERE Owner = Users.Id AND known(Password)) ∀ s ∈ Secrets. ∀ u ∈ Users. s.Owner = u.Id ∧ known(u.Password) ⇒ allowed(s.Secret)

Prove: ∀ v. mightSend(v) ⇒ allowed(v)

slide-15
SLIDE 15

15

UrFlow Sketch

Program Code Policies (SQL) Policies (First-Order Logic) Finite set of execution paths Symbolic executions State: P1 P2 P3 ... PN Check: Q1 Q2 ... Automated Theorem-Prover P2 /\ policies => Q1

slide-16
SLIDE 16

16

Fancier Policies

policy sendClient (SELECT Body FROM Messages, ACL, Users WHERE ACL.Forum = Messages.Forum AND ACL.User = User.Id AND known(Password) AND Level >= 42)

Forum Body

Messages

Id Password

Users

Forum User Level

ACL

slide-17
SLIDE 17

17

Write Policies

policy mayInsert (SELECT * FROM Secrets AS New, Users WHERE New.Owner = Users.Id AND known(Password) AND known(New.Secret))

Id Name Secret Owner

Secrets

Id Name Password

Users

slide-18
SLIDE 18

18

Case Studies

slide-19
SLIDE 19

19

Progress

Programming Languages Researchers Practitioners Imperative programs are too hard to analyze! Just use declarative languages, and your life will be so much easier. Database App Maybe later. I'm going to get back to coding my web application, which does almost nothing besides SQL queries.

UrFlow

slide-20
SLIDE 20

20

Ur/Web Available At:

http://www.impredicative.com/ur/

Including online demos with syntax-highlighted source code