Quantifying Security Impact of Operating-System Design
Total Page:16
File Type:pdf, Size:1020Kb
Copyright Notice School of Computer Science & Engineering COMP9242 Advanced Operating Systems These slides are distributed under the Creative Commons Attribution 3.0 License • You are free: • to share—to copy, distribute and transmit the work • to remix—to adapt the work • under the following conditions: 2019 T2 Week 09b • Attribution: You must attribute the work (but not in any way that Local OS Research suggests that the author endorses you or your use of the work) as @GernotHeiser follows: “Courtesy of Gernot Heiser, UNSW Sydney” The complete license text can be found at http://creativecommons.org/licenses/by/3.0/legalcode 1 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Quantifying OS-Design Security Impact Approach: • Examine all critical Linux CVEs (vulnerabilities & exploits database) • easy to exploit 115 critical • high impact Linux CVEs Quantifying Security Impact of • no defence available to Nov’17 • confirmed Operating-System Design • For each establish how microkernel-based design would change impact 2 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 3 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Hypothetical seL4-based OS Hypothetical Security-Critical App Functionality OS structured in isolated components, minimal comparable Trusted inter-component dependencies, least privilege to Linux Application computing App requires: base • IP networking Operating system Operating system • File storage xyz xyz • Display output Auth. Auth. Process Auth. ProcessProcess Server ServerServer Name Server File NameName ServerServer FileFile GPU Memory Server MemoryMemory Server IP Acc.Server Server NW Device Acc.Acc.Server Server NW NICDevice Server ServerServer Stack Control Stack Driver ControlControl Stack DriverDriver Hardware Hardware 4 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 5 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Analysing CVEs Analysing CVEs Map compromised component Map compromised component Example: to hypothetical OS to hypothetical OS Application Application Bug in page-table Not in TCB: management Operating system Attack defeated Operating system xyz xyz Auth. Auth. Auth. ProcessProcess Auth. ProcessProcess ServerServer ServerServer NameName ServerServer FileFile GPU NameName ServerServer FileFile GPU Server MemoryMemory Server IP Server MemoryMemory Server IP In microkernel: Acc.Acc.Server Server NW NICDevice Acc.Acc.Server Server NW NICDevice ServerServer Stack ServerServer Stack ControlControl Stack DriverDriver Example: ControlControl Stack DriverDriver Attack defeated USB driver bug by verifiation microkernel microkernel Hardware Hardware 6 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 7 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Analysing CVEs Analysing CVEs Map compromised component Map compromised component No full compromise to hypothetical OS to hypothetical OS Application Only crash essential Application but integrity or confi- service (DoS): dentiality violation: Operating system Strongly mitigated Operating system Weakly mitigated xyz xyz Auth. Auth. Auth. ProcessProcess Auth. ProcessProcess ServerServer ServerServer NameName ServerServer FileFile GPU NameName ServerServer FileFile GPU Server MemoryMemory Server IP Server MemoryMemory Server IP Acc.Acc.Server Server NW NICDevice Example: Acc.Acc.Server Server NW NICDevice Example: ServerServer Stack ServerServer Stack ControlControl Stack DriverDriver File system ControlControl Stack DriverDriver GPU compromised compromised microkernel microkernel Hardware Hardware 8 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 9 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Analysing CVEs All Critical Linux CVEs to 2017 Still full system Map compromised component Example: compromise: Not in TCB: to hypothetical OS Driver exploit hijacks Application No effect Attack defeated I2C bus, allowing firmware reflush Operating system 4% No full compromise, xyz 30% • 41% eliminated Auth. but violates integrity Auth. ProcessProcess Server or confidentiality: • 58% low severity NameNameServer ServerServer File GPU 38% MemoryMemory File • 96% not critical ServerServer Server IP Weakly mitigated Acc.Acc. ServerServer Server NW NICDevice Control StackStack Driver Control Driver Full system 11% compromise: Only crash essential microkernel No effect In microkernel: service (availability): 17% Attack defeated Hardware Strongly mitigated by verification 10 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 11 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Summary OS structure matters! • Microkernels definitely improve security • Monolithic OS design is fundamentally flawed from security point of view [Biggs et al., APSys’18] Cogent Use of a monolithic OS in security- or safety- critical scenarios is professional malpractice! 12 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 13 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Beyond the Kernel Cogent: Code & Proof Co-Generation Uncritical/ Aim: Reduce cost of 5 kLOC? 10 kLOC? untrusted Abstract Spec verified systems code Isabelle/HOL Apps 1 kLOC? 100 kLOC? Apps Apps 10 kLOC • Restricted, purely functional Manual, systems language equational 11 py Proof Device NW File Linux • Type- and memory safe, not Control Manual, driver stack system managed Cogent Proof one-off • Turing incomplete Auto- • File system case-studies: matic BilbyFs, ext2, F2FS, VFAT Proof Aim: Verified TCB at affordable cost! [O’Connor et al, ICFP’16; C ADTs (C) Amani et al, ASPLOS’16] 14 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 15 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Manual Proof Effort Addressing Verification Cost BilbyFS EffortEffort IsabelleIsabelle CogentCogent CostCost LoP/ Abstract Abstract Dependability-cost tradeoff: functions LoPLoP SLoCSLoC $/$/SLoCSLoC SLOC Spec Spec • Reduced faults through safe language isync()()/ 9.259.259.25 pm 13,00013,000 1,3501,350 150150 10 • Property-based testing (QuickCheck) iget() pm 8 py • Model checking Spec library Proof? reuse! Proof • Full functional correctness proof sync()- 3.753.75 pm 5,7005,700 300300 260260 19 Cogent specific pm Executable Work in progress: iget()- 11 pm pm 1,8001,800 200200 100100 9 Spec • Language expressiveness specific 0 py • Reduce boiler-plate code seL4 1212 py py 180,000180,000 8,7008,700 C C 350350 20 3 py Proof Proof • Network stacks BilbyFS: 4,200 LoC Cogent C C • Device drivers 16 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 17 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Refresh: Microarchitectural Timing Channels High Low Contention for shared hardware resources affects execution speed, Time Protection Shared resources leading to timing channels 18 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 19 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License OS Must Enforce Time Protection Time Protection: No Sharing of HW State High Low Temporally High Low High Low partition Flush Cache Cache Spatially Shared hardware partition High Low What are the OS Preventing interference is core duty of the OS! mechanisms? • Memory protection is well established • Time protection is completely absent Cache 20 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 21 COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Spatial Partitioning: Cache Colouring Spatial Partitioning: Cache Colouring Partitions • Partitions get frame pools of disjoint colours restricted to High Low coloured memory • seL4: userland supplies kernel memory System permanently ⇒ colouring userland colours kernel memory coloured TCB PT TCB PT High Low SD SD I+D I+D Cache Shared kernel image Initial process RAM Init I+D I+D RAM 22 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 23 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Channel Through Kernel Code Colouring the Kernel Ensure deterministic access! Remaining shared kernel data: 700 0.100000 datafile using 1:2:3 Each partition has Raw 600 0.010000 • Scheduler queue array & bitmap 500 0.001000 own kernel image channel 400 0.000100 • Few pointers to current thread state 300 LLC misses 0.000010 0 1 2 3 Resource Manager Resource Manager RM RM Kernel I+D I+D I+D I+D clone! Channel matrix: Conditional probability of observing output signal (time) given Global Resource Manager input signal (system-call number) RAM Init I+D I+D 24 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License 25 | COMP9242 2019T2 W09b: Local OS Research © Gernot Heiser 2019 – CC Attribution License Spatial Partitioning: Cache Colouring Channel Through Kernel Code • Partitions get frame pools of disjoint colours High Low 700 0.100000 datafile using 1:2:3 • seL4: userland supplies kernel memory Raw 600 0.010000 ⇒ colouring userland colours kernel memory 500 0.001000 channel 400 0.000100