350 likes | 361 Views
This paper discusses the challenges and solutions of mining security-sensitive operations in legacy code through concept analysis. It explores the retrofitting process for authorization policy enforcement and provides case studies in real-world servers.
E N D
Mining Security-SensitiveOperations in Legacy Code 29th ICSE, Minneapolis, Minnesota May 25th, 2007
The X Window system REMOTE LOCAL Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
REMOTE LOCAL Malicious remote X client Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
REMOTE LOCAL Undesirable information flow Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Desirable information flow REMOTE LOCAL Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Operation request Response Allowed? YES/NO Retrofitting the X server X client X server Reference monitor • Subject: Alice • Object: Bob_Window • Security-sensitive operation: Input_Event Authorization policy Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Retrofitting for authorization • Mandatory access control for Linux • Linux Security Modules [Wright et al.,’02] • SELinux [Loscocco and Smalley,’01] • Secure windowing systems • Trusted X,Compartmented-mode workstation, X11/SELinux [Epstein et al.,’90][Berger et al.,’90][Kilpatrick et al.,’03] • Java Virtual Machine/SELinux [Fletcher,‘06] • IBM Websphere/SELinux [Hocking et al.,‘06] Painstaking, manual procedure Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Contributions • Mining security-sensitive operations via concept analysis • Application to real-world servers • ext2 file system • X11 server • PennMUSH Static analyses to retrofit legacy code for authorization policy enforcement Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Outline • Motivation • Challenges • Solution • Case studies • Conclusion Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Security-sensitive operations Source Code Input_Event Create Destroy Copy Paste Map Can the client receive this Input_Event? Retrofitting lifecycle • Identify security-sensitive operations • Locate where they are performed in code • Instrument these locations Policy checks Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Problems Time-consuming • X11/SELinux ~ 2 years [Kilpatrick et al., ‘03] • Linux Security Modules ~ 2 years [Wright et al., ‘02] • Violation of complete mediation • Time-of-check to Time-of-use bugs [Zhang et al., ‘02][Jaeger et al., ‘04] Error-prone Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Security-sensitive operations Source Code Input_Event Create Destroy Copy Paste Map Can the client receive this Input_Event? Our contributions Fingerprints Mining Matching Focus of this work [IEEE S&P 2006] Policy checks Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Outline • Motivation • Challenges • Solution • Fingerprints • Matching fingerprints • Mining fingerprints • Case studies • Conclusion Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
What are fingerprints? • Resource accesses that are unique to a security-sensitive operation • Denote key steps needed to perform the security-sensitive operation on a resource Code-level signatures of security-sensitive operations Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Security-sensitive operations Source Code Input_Event Create Destroy Copy Paste Map Examples of fingerprints • Input_Event :- Cmp xEvent->type == KeyPress Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Examples of fingerprints • Input_Event :- Cmp xEvent->type == KeyPress • Input_Event :- Cmp xEvent->type == MouseMove • Enumerate :- Read Window->firstChild & Read Window->nextSib & Cmp Window ≠ 0 Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Fingerprint matching • Enumerate :- ReadWindow->firstChild& • ReadWindow->nextSib& • CmpWindow ≠ 0 • X server function MapSubWindows MapSubWindows(Window *pParent, Client *pClient) { Window *pWin; … // Run through linked list of child windows pWin = pParent->firstChild; … for (;pWin != 0; pWin=pWin->nextSib) { ... // Code that maps each child window ... } } Performs Enumerate Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Placing authorization checks • X server function MapSubWindows MapSubWindows(Window *pParent, Client *pClient) { Window *pWin; … // Run through linked list of child windows if CHECK(pClient,pParent,Enumerate) == ALLOWED { pWin = pParent->firstChild; … for (;pWin != 0; pWin=pWin->nextSib) { ... // Code that maps each child window ... } } else { HANDLE_FAILURE } } Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Security-sensitive operations Source Code Input_Event Create Destroy Copy Paste Map Fingerprint mining • Resources • Window • xEvent • Cmp xEvent->type == KeyPress • ReadWindow->firstChild & • ReadWindow->nextSib & • CmpWindow ≠ 0 Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Straw-man solution I • Finest level of granularity • Cmp xEvent->type == KeyPress • ReadWindow->firstChild • ReadWindow->nextSib • CmpWindow ≠ 0 Each resource access is a fingerprint Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Problem with this solution • Cmp xEvent->type == KeyPress • ReadWindow->firstChild • ReadWindow->nextSib • CmpWindow ≠ 0 Difficult to write and maintain policies at this level of granularity Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Straw-man solution II • Coarsest level of granularity • CallMapSubWindows • CallMapWindow • Write policies allowing/disallowing the use of an API call Each API call is a fingerprint Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Problem with this solution • Call MapSubWindows • Enumerates child windows and maps them to the screen • Call MapWindows • Maps a window onto the screen Does not reflect actual resource accesses performed by API call Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Our solution • Each API entry point implicitly defines a set of resource accesses • Cluster resource accesses based upon the API entry points that perform them Cluster resource accesses that always happen together Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Clustering resource accesses Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Instances Features Clustering using concept analysis Concept analysis Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
A B C Concept analysis MapSub Windows Map Window Keyboard Input 1 2 3 4 5 6 SetxEvent->typeToMapNotify SetWindow->mappedToTrue ReadWindow->firstChild ReadWindow->nextSib CmpWindow ≠ 0 Cmp xEvent->type==KeyPress {A,B,C}, Ф {A,B}, {1,2} {C}, {6} {A}, {1,2,3,4,5} Ф, {1,2,3,4,5,6} Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
A B C Fingerprint 1 Fingerprint 2 Fingerprint 3 Mining fingerprints MapSub Windows Map Window Keyboard Input 1 2 3 4 5 6 SetxEvent->typeToMapNotify SetWindow->mappedToTrue ReadWindow->firstChild ReadWindow->nextSib CmpWindow ≠ 0 Cmp xEvent->type==KeyPress {A,B,C}, Ф {A,B}, {1,2} {C}, {6} {A}, {1,2,3,4,5} Ф, {1,2,3,4,5,6} Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Outline • Motivation • Challenges • Solution • Case studies • Conclusion Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Software LOC Fingerprints Avg. Size ext2 4,476 18 3.7 X Server/dix 30,096 115 3.7 PennMUSH 94,014 38 1.4 Results on case studies Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Results on case studies Manually identified Security-sensitive ops Benchmark Fingerprints ext2 11 18 X Server/dix 22 115 Able to find at least one fingerprint for each security-sensitive operation Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Identified automatically in a few minutes Identified as part of multi-year efforts Results on case studies Manually identified Security-sensitive ops Benchmark Fingerprints ext2 11 18 X Server/dix 22 115 Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
18 115 Results on case studies • Associated 59 candidate fingerprints with security-sensitive operations • Remaining are likely security-sensitive too Manually identified Security-sensitive ops Benchmark Fingerprints ext2 11 X Server/dix 22 • Read Window->DrawableRec->width& ReadWindow->DrawableRec->height Mining Security-Sensitive Operations in Legacy Code using Concept Analysis
Summary • Fingerprints • Fingerprint mining with concept analysis • Results: • Mined fingerprints for security-sensitive operations in ext2, X server and PennMUSH Static approach to retrofit legacy code for authorization policy enforcement Mining Security-Sensitive Operations in Legacy Code using Concept Analysis