+ All Categories
Home > Documents > Retrofitting Legacy Code for Authorization Policy Enforcement

Retrofitting Legacy Code for Authorization Policy Enforcement

Date post: 07-Feb-2016
Category:
Upload: nikki
View: 18 times
Download: 0 times
Share this document with a friend
Description:
Retrofitting Legacy Code for Authorization Policy Enforcement. 2006 IEEE Symposium on Security and Privacy Oakland, California. Client: Bob. Client: Alice. Alice. Bob. Motivating example. X Server. BOB. ALICE. X server with multiple X clients. BOB. ALICE. Bob’s malicious X client. - PowerPoint PPT Presentation
45
Retrofitting Legacy Code for Authorization Policy Enforcement Vinod Ganapathy [email protected] Trent Jaeger [email protected]. edu Somesh Jha [email protected] u 2006 IEEE Symposium on Security and Privacy Oakland, California
Transcript
Page 1: Retrofitting Legacy Code for Authorization Policy Enforcement

Retrofitting Legacy Code for Authorization Policy Enforcement

Vinod [email protected]

Trent [email protected]

Somesh [email protected]

2006 IEEE Symposium on Security and PrivacyOakland, California

Page 2: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 2

Motivating exampleClient: Alice

Alice

X Server

Client: Bob

Bob

Page 3: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 3

X server with multiple X clients

BOB

ALICE

Page 4: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 4

BOB

Bob’s malicious X client

ALICE

Page 5: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 5

BOB

Bob stealing Alice’s password

ALICE

Page 6: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 6

Collaboration

BOB

PROJECT FOO

ALICE

PROJECT FOO

Page 7: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 7

Desirable information flow

BOB

PROJECT FOO

ALICE

PROJECT FOO

Page 8: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 8

Undesirable information flow

BOB

PROJECT FOO

ALICE

PROJECT FOO

ALICE

Page 9: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 9

Many more examples• Prevent unauthorized

– copy-and-paste [Epstein et al., 1991]

– modification of inputs meant for other clients– changing window settings of other clients– retrieval of bitmaps: screenshots– …several more examples…

Source: [Kilpatrick et al., 2003]

Page 10: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 10

Fine-grained enforcement• Fine-grained, server-level enforcement of

authorization policies

• Server offers shared resources to clients• Manages multiple clients simultaneously

Request Allowed?

Yes/NoReplyClient Server

• X Client X Server: Give me input keystrokes• X Server Policy Engine: Is this allowed?• X Server X Client: Here are the keystrokes

Policy

Page 11: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 11

Problem statement• Provide server-level mechanisms for

enforcement of authorization policies

• Make server code security-policy-aware

Page 12: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 12

Contributions• Analyses for legacy code retrofits

– Enforcing authorization policies• Fingerprints

– Code-patterns of security-sensitive operations• Two prototype tools

– AID: automates fingerprint-finding– ARM: uses fingerprints to retrofit code

• Real-world case study– Retrofitting the X server

Page 13: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 13

Talk outline• Motivation and contributions• Retrofitting legacy code: Lifecycle• Our techniques

– Fingerprints– Finding fingerprints: AID– Using fingerprints: ARM

• Conclusion

Page 14: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 14

Retrofitting legacy code: Lifecycle

1. Identify security-sensitive operations2. Locate where they are performed in code3. Retrofit these locations

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

Page 15: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 15

Lifecycle: State-of-the-art

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

Page 16: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 16

State-of-the-art: Consequences• Tedious

– Linux Security Modules ~ 2 years [Wright et al., 2002]

– X11/SELinux ~ 2 years [Kilpatrick et al., 2003]

• Error-prone– Violation of complete mediation [Jaeger et al. 2002]

Page 17: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 17

Talk outline• Motivation and contributions• Retrofitting legacy code: Lifecycle• Our techniques

– Fingerprints– Finding fingerprints: AID– Using fingerprints: ARM

• Conclusion

Page 18: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 18

AID ARMLifecycle: Our contributions

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

Page 19: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 19

Overview of our work

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

• Operations on shared resources• Manually identified list

– For X server, used NSA study [Kilpatrick et al., 2003]

Page 20: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 20

• Main concept: fingerprints• Approach: analysis of runtime traces

Overview of our work

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

Page 21: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 21

Overview of our work

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code Policy checks

Can the client receive this

INPUT_EVENT?

• Main concept: reference monitoring• Approach: static matching of fingerprints

[Ganapathy/Jaeger/Jha, CCS’05]

Page 22: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 22

Talk outline• Motivation• Case study: X window system• Retrofitting legacy code: Lifecycle• Our techniques

– Fingerprints– Finding fingerprints: AID– Using fingerprints: ARM

• Conclusion

Page 23: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 23

What are fingerprints?• Code-level description of security-sensitive

operations• Each operation has at least one fingerprint

INPUT_EVENTCREATEDESTROYCOPYPASTEMAP...

Security-sensitive operations Source Code

Page 24: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 24

Code-patterns

Examples of Fingerprints• INPUT_EVENT :- Call ProcessKeybdEvent• INPUT_EVENT :- Call ProcessPointerEvent• ENUMERATE:-

Read Window->firstChild & Read Window->nextSib & Compare Window ≠ 0

Page 25: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 25

Finding and using fingerprints

AID

Legacy Code

Security-sensitiveoperations

ARMRetrofitted

Code

Page 26: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 26

AID: A fingerprint finder

AID

Legacy Code

Security-sensitiveoperations

Page 27: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 27

Main problem solved by AID• Inputs:

1. Source code of legacy server2. Security-sensitive operations

• Security-sensitive operations [NSA’03]

• Output: Fingerprints

INPUT_EVENT Input to window from deviceCREATE Create new windowDESTROY Destroy existing windowMAP Map window to console

Page 28: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 28

Key insight used by AID• Induce server to perform a security-

sensitive operation – typing to window will induce INPUT_EVENT

• Code-patterns in its fingerprint must be exercised by the server– Call ProcessKeybdEvent must be in trace

• Analyze runtime traces to find fingerprints!

Page 29: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 29

Runtime traces• Trace the server and record

– function calls and returns– reads/writes to critical data structures

• Data structures used to represent resources

• Example: from X server startup CALL SetWindowToDefaults SET Window->prevSib TO 0 SET Window->firstChild TO 0 SET Window->lastChild TO 0 … about 1400 such code-patterns

Page 30: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 30

Using traces for fingerprinting• Obtain traces for each security-sensitive

operation– Series of controlled tracing experiments

• Examples– Typing to keyboard generates INPUT_EVENT– Creating new window generates CREATE– Creating window also generates MAP– Closing existing window generates DESTROY

Page 31: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 31

Analyzing traces• Input:

– Traces annotated with the security-sensitive operations they perform

• Output:– Fingerprint for each security-sensitive

operation

Page 32: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 32

Analyzing traces: “diff” and “∩”

Openxterm

Closexterm

Movexterm

Openbrowser

Switchwindows

CREATEDESTROYMAPUNMAP

INPUTEVENT

Annotation is currently a manual step

Page 33: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 33

- Trace 3CREATE = Trace1 ∩ Trace4

Analyzing traces: “diff” and “∩”

Openxterm

Closexterm

Movexterm

Openbrowser

SwitchWindows

CREATEDESTROYMAPUNMAP

INPUTEVENT

Perform same set operations on code-patterns in traces

Page 34: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 34

How effective is trace analysis?• Source code: 1,000,000 lines of C code• Raw traces: 54,000 code-patterns• Pre-analysis: Relevant portion of trace

– Average of 900 distinct code-patterns– Average of 140 distinct functions

• Post-analysis: Each result– Average of 126 distinct code-patterns– Average of 15 distinct functions

18x

~60x

~9x~7x

Page 35: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 35

Examples of fingerprintsOperation FingerprintCREATE Call CreateWindowDESTROY Call DeleteWindowUNMAP Set xEvent->type To

UnmapNotifyCHSTACK Call MoveWindowInStack

INPUT_EVENT Call ProcessPointerEvent,Call ProcessKeybdEvent

Page 36: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 36

ARM: Static code retrofitter

AID

Legacy Code

Security-sensitiveoperations

ARMRetrofitted

Code

Page 37: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 37

Fingerprints from AIDOperation FingerprintCREATE Call CreateWindowDESTROY Call DeleteWindowUNMAP Set xEvent->type To

UnmapNotifyCHSTACK Call MoveWindowInStack

INPUT_EVENT Call ProcessPointerEvent,Call ProcessKeybdEvent

Page 38: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 38

Using fingerprints: simple example

CreateWindow(Client *pClient) { Window *pWin; … // Create new window here pWin = newly-created window;}

CreateWindow(Client *pClient) { Window *pWin; if (CHECK(pClient, CREATE) == FAIL) { return; } // Create new window here pWin = newly-created window;}

Page 39: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 39

More complex example• ENUMERATE:-

Read Window->firstChild & Read Window->nextSib & Compare Window ≠ 0

• Paper has details on how we match these

Page 40: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 40

Talk outline• Motivation• Case study: X window system• Retrofitting legacy code: Lifecycle• Our techniques

– Fingerprints– Finding fingerprints: AID– Using fingerprints: ARM

• Conclusion

Page 41: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 41

X server case study• Applied AID and ARM to the X server

• Added policy checks for window operations– Policy lookups at 24 locations

Page 42: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 42

Similar example in the paper

BOB

PROJECT FOO

ALICE

PROJECT FOO

ALICE

Page 43: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 43

Limitations1. AID uses analysis of runtime traces

– no guarantees of finding all fingerprints– Possible remedies

• coverage metrics to augment runtime tracing• static fingerprint-finding technique

2. Identification of security-sensitive operations is still manual

Page 44: Retrofitting Legacy Code for Authorization Policy Enforcement

IEEE S&P 2006 Ganapathy/Jaeger/Jha: Retrofitting Legacy Code for Authorization Policy Enforcement 44

Summary of important ideas• Analysis techniques to retrofit servers for

policy enforcement• Fingerprints

– Code-patterns of security-sensitive operations• Two prototype tools

– AID: automates fingerprint-finding– ARM: uses fingerprints to retrofit code

• Case study on X server

Page 45: Retrofitting Legacy Code for Authorization Policy Enforcement

Questions?Retrofitting Legacy Code for

Authorization Policy Enforcement

http://www.cs.wisc.edu/~vg/papers/ieee-sp2006

Vinod [email protected]

Trent [email protected]

Somesh [email protected]


Recommended