shreds
play

Shreds: Fine-grained Execution Units with S R D H E S Private - PowerPoint PPT Presentation

Shreds: Fine-grained Execution Units with S R D H E S Private Memory Yaohui Chen, Sebassujeen Reymondjohnson, Zhichuang Sun, Long Lu RiS3 Lab / Computer Science / Stony Brook University 1 Execution Units Traditional Execution Units


  1. Shreds: Fine-grained Execution Units with S R D H E S Private Memory Yaohui Chen, Sebassujeen Reymondjohnson, Zhichuang Sun, Long Lu RiS3 Lab / Computer Science / Stony Brook University 1

  2. Execution Units • Traditional Execution Units A Process Threads - Processes ‣ Separate address spaces - Threads ‣ Sharing one address space 2 Shreds: Fine-grained execution units with private memory

  3. In-process Memory Abuses • Definition: Malicious or compromised components try to steal data or execute code of other components running in the same process. • Two examples - Stealing secret data ‣ The Heartbleed bug - Executing private code ‣ Private APIs in iOS Apps 3 Shreds: Fine-grained execution units with private memory

  4. Potential Mitigations of in-Process Abuse Techniques Why unsuitable • IPC is expensive Process-level isolation • Adoption effort (OpenSSH, Chrome) • Require instrumenting untrusted code Software fault isolation-like techniques • Ineffective on dynamic or external code (Native Client) Hardware-assisted techniques • Overly restrictive execution environment • Semantic gap (SGX, Trustzone) 4 Shreds: Fine-grained execution units with private memory

  5. Introducing Shred A process • Shred Threads - Arbitrarily scoped segment of a thread execution • S-pool - The private memory pool for each shred • Shred APIs & OS-level supports Threat Model ๏ Trusted OS Shreds ๏ Untrusted component 5 Shreds: Fine-grained execution units with private memory

  6. Example Use Case • Password authentication on web server( w/o shred ) 0 Executable Heap Stack Local Hash Plaintext Libs password Kernel 6 Shreds: Fine-grained execution units with private memory

  7. Example Use Case cont. • Password authentication on web server( w/ shred ) 0 Executable Heap S-pool Stack Local Hash Plaintext Libs password Kernel 7 Shreds: Fine-grained execution units with private memory

  8. Shred APIs • err_t shred_enter (int pool_desc ); Shred creation APIs ‣ Start a shred execution on the current thread ‣ Unlock s-pool • err_t shred_exit (); ‣ Terminate a shred execution ‣ lock down the s-pool S-pool allocation APIs • void * spool_alloc (size_t size ); ‣ Allocate memory inside S-pool • err_t spool_free (void * ptr ); ‣ Free memory inside S-pool 8 Shreds: Fine-grained execution units with private memory

  9. Code Example—Lighttpd int http_request_parse (server *srv, connection *con) { ... char *cur; /* to receive password */ + if (strncmp(cur, auth_str, auth_str_len)==0){ ✖ + shred_enter (AUTH_PASSWD_POOL); + /* receive and save password */ + data_string *ds = s_ds_init (); + int pw_len = get_passwd_length(cur); + cur += auth_str_len + 1; + buffer_copy_string_len(ds->key, auth_str, auth_str_len); + buffer_copy_string_len(ds->value, cur, pw_len); + cur += pw_len; + shred_exit (); + } ... } Listing 1: lighttpd/src/request.c 9 Shreds: Fine-grained execution units with private memory

  10. Code Example cont. ... /* called inside a shred */ /* inside HTTP auth module */ data_string * s_ds_init (void) { + shred_enter (AUTH_PASSWD_POOL); data_string *ds; /* ds points passwd obj in spool */ + ds = spool_alloc (sizeof(*ds)); http_authorization = ds->value->ptr; ... /*hash passwd and compare with local copy*/ return ds; + s_ds_free (ds); } + shred_exit (); ... /* called inside a shred */ void s_ds_free (data_string *ds) { + ... + spool_free (ds->key); + ... return; } S-pool allocation APIs wrapper Listing 2: lighttpd/src/data_string.c Listing 3: lighttpd/src/mod_auth.c 10 Shreds: Fine-grained execution units with private memory

  11. System overview • Two major components S-driver S-compiler 11 Shreds: Fine-grained execution units with private memory

  12. System Component: S-driver Process S-driver Thread2 Thread1 ๏ Entry/exit of shreds shred_enter ( P1 ); shred_enter shred_exit (); (P1); ๏ S-pool (de)allocations shred_enter ( P2 ); shred_exit() ; ๏ Controls the access to S-pools shred_exit (); … S-pool Manager S-pool: P1 S-pool sharing Security Monitor S-pool: P2 Mem Space S-driver Runtime 12 Shreds: Fine-grained execution units with private memory

  13. How S-pool is Built • ARM Memory Domains—The building block Intel: Memory protection keys Page Table Descriptor D14 D1 D0 D15 Page Directory Descriptor … … D1 PDE# 0 PDE# 1 D1 Domain Access Control Register … … : Accessible PDE#1023 D14 : Not accessible … 13 Shreds: Fine-grained execution units with private memory

  14. Challenges & Solutions Domain Access Control Register Domain Access Control Register • ARM Memory Domain was not designed to serve our goal … … 1)The granularity of the accessing subject can only be checked at CPU level Core #1 Core #2 ✓ Create the notion of shred so the accessing subject can be recognized and use S-driver to manage them 2) Limited Domains: Only 16 Domains are available ✓ Statically bind an accessible domain to each CPU ✓ Reuse a domain for multiple S-pools if they are accessed from the same CPU s-pool s-pool #2 #1 Virtual Address Space 14 Shreds: Fine-grained execution units with private memory

  15. S-pool Managements S-driver will, • Lock s-pool when, • Unlock s-pool when, - Shred exits - Shred enters - Context-switch Out - Context-switch in - Resuming from asynchronous events - Asynchronous events: signal handling, etc 15 Shreds: Fine-grained execution units with private memory

  16. Moving the Domain Adjustments Off the Critical Path • Changing PDE is relatively cumbersome - Page table walking - TLB invalidation • TWO knobs to control the accessibility of S-pool - Domain of the corresponding page table entry - Value of corresponding DACR entry • Changing DACR value is much faster, only one instruction - MCR p15, 0, <Rd>, c3, c0, 0 ; Write DACR - Develop the domain fault handler to handle domain fault lazily ‣ Detecting attacks ‣ Recover from legitimate domain faults 16 Shreds: Fine-grained execution units with private memory

  17. Runtime Protections ๏ Secure stacks - Each shred has a secure stack allocated from its s-pool ๏ System interface protection - ptrace() - /dev/mem - Directly read secret from file - etc 17 Shreds: Fine-grained execution units with private memory

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