wedge splitting applications into reduced privilege
play

Wedge: Splitting Applications into Reduced-Privilege Compartments - PowerPoint PPT Presentation

Wedge: Splitting Applications into Reduced-Privilege Compartments Andrea Bittau Petr Marchenko Mark Handley Brad Karp University College London April 17, 2008 Vulnerabilities threaten sensitive data Exploits allow running arbitrary code


  1. Wedge: Splitting Applications into Reduced-Privilege Compartments Andrea Bittau Petr Marchenko Mark Handley Brad Karp University College London April 17, 2008

  2. Vulnerabilities threaten sensitive data ◮ Exploits allow running arbitrary code on servers. ◮ An exploited web server can be used to leak sensitive information such as credit card numbers. Have we managed to mitigate or prevent vulnerabilities? 1000 Vulnerabilities per year 800 600 400 200 0 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 Time (years) Source: osvdb.org

  3. Process-based privileges are too coarse-grained Need to keep SSL web server’s RSA private key secret. master (read) (process) (create) network /etc/rsa key worker (file)

  4. Process-based privileges are too coarse-grained Need to keep SSL web server’s RSA private key secret. Apache worker running as root: ◮ Can read any file. ◮ Can invoke any system call. master (read) (process) (create) network /etc/rsa key worker (file)

  5. Process-based privileges are too coarse-grained Need to keep SSL web server’s RSA private key secret. Apache worker running as root: ◮ Can read any file. Fix: run as nobody. ◮ Can invoke any system call. Fix: use systrace, SELinux, . . . master master (read) (read) (process) (process) (create) (create) network network /etc/rsa key /etc/rsa key worker worker (file) (file)

  6. Process-based privileges are too coarse-grained Need to keep SSL web server’s RSA private key secret. Apache worker running as root: ◮ Can read any file. Fix: run as nobody. ◮ Can invoke any system call. Fix: use systrace, SELinux, . . . Are we done protecting the private key? master master (read) (read) (process) (process) (create) (create) network network /etc/rsa key /etc/rsa key worker worker (file) (file)

  7. Process-based privileges are too coarse-grained Need to keep SSL web server’s RSA private key secret. Apache worker running as root: ◮ Can read any file. Fix: run as nobody. ◮ Can invoke any system call. Fix: use systrace, SELinux, . . . Are we done protecting the private key? master (read) (process) (create) network /etc/rsa key worker (file)

  8. Problem: processes grant all code access to all memory Need to keep SSL web server’s RSA private key secret. (worker process) network HTTP parser (code) private key (memory) SSL engine

  9. Problem: processes grant all code access to all memory Need to keep SSL web server’s RSA private key secret. (worker process) network HTTP parser (code) private key (memory) SSL engine (read)

  10. Problem: processes grant all code access to all memory Need to keep SSL web server’s RSA private key secret. (worker process) network HTTP parser (code) private key (memory) SSL engine (read)

  11. Problem: processes grant all code access to all memory Need to keep SSL web server’s RSA private key secret. This talk: how to limit access of code to memory at fine granularity. (worker process) network HTTP parser (code) private key (memory) SSL engine (read)

  12. Old idea: principle of least privilege Principle of least privilege: ◮ Partition code into compartments . ◮ Assign each compartment the minimal privileges it needs for its operation. ◮ Restrict interface and interactions between compartments. How to implement compartments? ◮ Processes?

  13. Why are traditional processes not sufficient? Creating compartments with UNIX, e.g. , fork : ◮ Default grant. Child inherits memory map and file descriptors. Operation of fork private key parent /etc/passwd

  14. Why are traditional processes not sufficient? Creating compartments with UNIX, e.g. , fork : ◮ Default grant. Child inherits memory map and file descriptors. Operation of fork private key parent fork child /etc/passwd

  15. Why are traditional processes not sufficient? Creating compartments with UNIX, e.g. , fork : ◮ Default grant. Child inherits memory map and file descriptors. Operation of fork private key parent fork child /etc/passwd Default-deny: inherit nothing from parent. Closer to least-privilege.

  16. But default-deny is difficult to use for legacy code How many permissions do we need to explicitly grant? (worker process) network HTTP parser (code) private key (memory) SSL engine

  17. But default-deny is difficult to use for legacy code How many permissions do we need to explicitly grant? Worker Worker Apache’s client handler uses over 600 memory objects.

  18. Contributions ◮ New system calls for default-deny. ◮ Creating compartments. ◮ Specifying privileges. ◮ Tools to make default-deny usable when partitioning legacy code. ◮ Identifying the privileges for compartments.

  19. Outline 1. Wedge. ◮ New system calls for default-deny. ◮ Crowbar: tool for partitioning legacy code. 2. Wedge applied to Apache+OpenSSL.

  20. sthreads: default-deny compartments private key parent /etc/passwd ◮ Like processes, but default-deny. ◮ Like threads: can easily share pointers and file descriptors. ◮ Programmer must explicitly grant all permissions.

  21. sthreads: default-deny compartments private key parent sthread create child (sthread) /etc/passwd ◮ Like processes, but default-deny. ◮ Like threads: can easily share pointers and file descriptors. ◮ Programmer must explicitly grant all permissions.

  22. Virtual memory { page n char *key, *buffer; char *config; page n+1 key = malloc(16); parser buffer = malloc(80); … config = malloc(128); }

  23. Tagged memory { page n tag = tag_new(); key = malloc(16); page n+1 buffer = parser smalloc(80,tag); … config = smalloc(128,tag); }

  24. How can sthreads use sensitive data? Callgates. Problem: unprivileged code cannot access sensitive data directly but must still use it. private key parser Callgates: an entry-point with predefined privileges. ◮ Callgates are created and invoked at a later time. ◮ At creation, a subset of creator’s privileges is given to callgate. ◮ At invocation, code is run with creation privileges.

  25. How can sthreads use sensitive data? Callgates. Problem: unprivileged code cannot access sensitive data directly but must still use it. session key private key parser Callgates: an entry-point with predefined privileges. ◮ Callgates are created and invoked at a later time. ◮ At creation, a subset of creator’s privileges is given to callgate. ◮ At invocation, code is run with creation privileges.

  26. How can sthreads use sensitive data? Callgates. Problem: unprivileged code cannot access sensitive data directly but must still use it. session key private key setup session key client handler invoke Callgates: an entry-point with predefined privileges. ◮ Callgates are created and invoked at a later time. ◮ At creation, a subset of creator’s privileges is given to callgate. ◮ At invocation, code is run with creation privileges.

  27. How can sthreads use sensitive data? Callgates. Problem: unprivileged code cannot access sensitive data directly but must still use it. session key private key setup session key client handler invoke Callgates: an entry-point with predefined privileges. ◮ Callgates are created and invoked at a later time. ◮ At creation, a subset of creator’s privileges is given to callgate. ◮ At invocation, code is run with creation privileges.

  28. Summary: Wedge applied to Apache session key private key setup session key client handler ◮ Sthreads: default-deny compartments—low privilege. ◮ Callgates: privilege elevation—high privilege. ◮ Tagged memory: naming memory for privilege specification.

  29. Ad-hoc code study? Worker Worker Apache’s client handler needs access to 222 heap objects and 389 globals. Need to read 72 source files (for heap only). 1. Which code is executed? 2. What objects do pointers point to? 3. Where were objects allocated? If privilege is omitted, you get a crash—repeat until no crashes.

  30. Static analysis of memory accesses? Static analysis for C code does not have runtime context ( e.g. , format string for printf ). Consequences: ◮ May fail. e.g., function pointers. ◮ If conservative, may give superset of privileges actually needed. e.g., may follow code paths corresponding to exploits!

  31. Crowbar: runtime analysis of memory accesses Dynamic analysis yields least privilege: private key GET URL POST data parser Server uses minimal privileges to execute an innocuous request. 1. Use runtime instrumentation to produce memory trace. 2. Train using benign requests. Need to ensure high trace coverage, e.g. , with test suite.

  32. Crowbar: runtime analysis of memory accesses Dynamic analysis yields least privilege: private key GET URL POST data parser Server uses minimal privileges to execute an innocuous request. 1. Use runtime instrumentation to produce memory trace. 2. Train using benign requests. Need to ensure high trace coverage, e.g. , with test suite.

  33. Crowbar: runtime analysis of memory accesses Dynamic analysis yields least privilege: private key GET URL POST data parser Server uses minimal privileges to execute an innocuous request. 1. Use runtime instrumentation to produce memory trace. 2. Train using benign requests. Need to ensure high trace coverage, e.g. , with test suite.

  34. Outline 1. Wedge. ◮ New system calls for default-deny. ◮ Crowbar: tool for partitioning legacy code. 2. Wedge applied to Apache+OpenSSL.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend