using hardware performance events for instruction level
play

Using Hardware Performance Events for Instruction-Level Monitoring - PowerPoint PPT Presentation

Using Hardware Performance Events for Instruction-Level Monitoring on the x86 Architecture Sebastian Vogl and Claudia Eckert {vogls,eckertc}@in.tum.de Chair for IT Security Technische Universitt Mnchen Munich, Germany 10.04.2012 S. Vogl


  1. Using Hardware Performance Events for Instruction-Level Monitoring on the x86 Architecture Sebastian Vogl and Claudia Eckert {vogls,eckertc}@in.tum.de Chair for IT Security Technische Universität München Munich, Germany 10.04.2012 S. Vogl and C. Eckert (TUM) 10.04.2012 1 / 42

  2. Outline Motivation 1 Performance Monitoring Counters (PMCs) 2 PMC-based Instruction-level Monitoring (ILM) 3 Experiments & Results 4 Summary 5 S. Vogl and C. Eckert (TUM) 10.04.2012 2 / 42

  3. Outline Motivation 1 Performance Monitoring Counters (PMCs) 2 PMC-based Instruction-level Monitoring (ILM) 3 Experiments & Results 4 Summary 5 S. Vogl and C. Eckert (TUM) 10.04.2012 3 / 42

  4. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? My Research Make use of full hardware virtualization to detect malware infections and exploitation attempts . S. Vogl and C. Eckert (TUM) 10.04.2012 4 / 42

  5. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vulnerable> 40070c: mov 0x0, %EAX vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 5 / 42

  6. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vu 0x40070c (RET) vuln lner erab able le> 40070c: mov 0x0, %EAX vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 6 / 42

  7. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vulnerable> 0x40070c (RET) 40070c: mov 0x0, %EAX RBP vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 7 / 42

  8. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vulnerable> 0x40070c (RET) 40070c: mov 0x0, %EAX RBP vulnerable 400584: push %rbp 400585: mov %rsp,% ,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 8 / 42

  9. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vulnerable> 0x40070c (RET) 40070c: mov 0x0, %EAX RBP BUFFER vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 9 / 42

  10. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main * /bin/bash DATA exit 400707: call 400584 <vulnerable> system 40070c: mov 0x0, %EAX DATA (EBP) vulnerable DATA 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 10 / 42

  11. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main * /bin/bash DATA exit 400707: call 400584 <vulnerable> system 40070c: mov 0x0, %EAX DATA (EBP) vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: : leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 11 / 42

  12. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main * /bin/bash DATA exit 400707: call 400584 <vulnerable> 40070c: mov 0x0, %EAX system vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> 4006b2: leave 4006b3: ret system S. Vogl and C. Eckert (TUM) 10.04.2012 12 / 42

  13. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? One possible Solution Make use of a Shadow Stack to verify the target of return instructions. S. Vogl and C. Eckert (TUM) 10.04.2012 13 / 42

  14. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vulnerable> 40070c: mov 0x0, %EAX vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> Shadow Stack 4006b2: leave 4006b3: ret S. Vogl and C. Eckert (TUM) 10.04.2012 14 / 42

  15. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main DATA 400707: call 400584 <vu 0x40070c (RET) vuln lner erab able le> 40070c: mov 0x0, %EAX vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> Shadow Stack 4006b2: leave 4006b3: ret 0x40070c (RET) S. Vogl and C. Eckert (TUM) 10.04.2012 15 / 42

  16. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Stack main * /bin/bash DATA exit 400707: call 400584 <vu vuln lner erab able le> 40070c: mov 0x0, %EAX system vulnerable 400584: push %rbp 400585: mov %rsp,%rbp 400588: sub $0x20,%rsp <vulnerable code> Shadow Stack 4006b2: leave 4006b3: ret 0x40070c (RET) system EIP: system S. Vogl and C. Eckert (TUM) 10.04.2012 16 / 42

  17. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Observation A Shadow Stack for return addresses can be implemented on the hypervisor-level by only trapping call and return instructions. S. Vogl and C. Eckert (TUM) 10.04.2012 17 / 42

  18. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Observation A Shadow Stack for return addresses can be implemented on the hypervisor-level by only trapping call and return instructions. ILM Requirements Based on full hardware virtualization 1 S. Vogl and C. Eckert (TUM) 10.04.2012 17 / 42

  19. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Observation A Shadow Stack for return addresses can be implemented on the hypervisor-level by only trapping call and return instructions. ILM Requirements Based on full hardware virtualization 1 Secure 2 S. Vogl and C. Eckert (TUM) 10.04.2012 17 / 42

  20. Motivation ▸ Why Instructions-Level Monitoring (ILM) ? Observation A Shadow Stack for return addresses can be implemented on the hypervisor-level by only trapping call and return instructions. ILM Requirements Based on full hardware virtualization 1 Secure 2 Flexible 3 S. Vogl and C. Eckert (TUM) 10.04.2012 17 / 42

  21. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 Trap Flag (TF) -based ILM 3 S. Vogl and C. Eckert (TUM) 10.04.2012 18 / 42

  22. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 3 Trap Flag (TF)-based ILM S. Vogl and C. Eckert (TUM) 10.04.2012 19 / 42

  23. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 3 Trap Flag (TF)-based ILM ▸ Insecure S. Vogl and C. Eckert (TUM) 10.04.2012 19 / 42

  24. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 3 Trap Flag (TF)-based ILM ▸ Insecure ▸ Incomplete S. Vogl and C. Eckert (TUM) 10.04.2012 19 / 42

  25. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 3 Trap Flag (TF)-based ILM ▸ Insecure ▸ Incomplete ▸ Inflexible S. Vogl and C. Eckert (TUM) 10.04.2012 19 / 42

  26. Motivation ▸ Why a new ILM mechanism? Existing Approaches Page-Fault (PF) -based ILM 1 Debug Register (DR) -based ILM 2 3 Trap Flag (TF)-based ILM ▸ Insecure ▸ Incomplete ▸ Inflexible ⇒ None of the existing methods can provide the desired flexbility . S. Vogl and C. Eckert (TUM) 10.04.2012 19 / 42

  27. Outline Motivation 1 Performance Monitoring Counters (PMCs) 2 PMC-based Instruction-level Monitoring (ILM) 3 Experiments & Results 4 Summary 5 S. Vogl and C. Eckert (TUM) 10.04.2012 20 / 42

  28. Performance Monitoring Counters (PMCs) ▸ Overview Performance Monitoring on the x86 architecture Performance Events S. Vogl and C. Eckert (TUM) 10.04.2012 21 / 42

  29. Performance Monitoring Counters (PMCs) ▸ Overview Performance Monitoring on the x86 architecture Performance Events PMCs that count these events S. Vogl and C. Eckert (TUM) 10.04.2012 21 / 42

  30. Performance Monitoring Counters (PMCs) ▸ Overview Performance Monitoring on the x86 architecture Performance Events PMCs that count these events ▸ Which event is counted can be programmed. S. Vogl and C. Eckert (TUM) 10.04.2012 21 / 42

  31. Performance Monitoring Counters (PMCs) ▸ Overview Performance Monitoring on the x86 architecture Performance Events PMCs that count these events ▸ Which event is counted can be programmed. ▸ Can be set to raise an interrupt on overflow. S. Vogl and C. Eckert (TUM) 10.04.2012 21 / 42

  32. Performance Monitoring Counters (PMCs) ▸ Performance Events All instructions ▸ All branch instructions ▸ All conditional branch instructions ▸ All near call instructions ▸ All near return instructions ▸ All far branch instructions ▸ S. Vogl and C. Eckert (TUM) 10.04.2012 22 / 42

  33. Outline Motivation 1 Performance Monitoring Counters (PMCs) 2 PMC-based Instruction-level Monitoring (ILM) 3 Experiments & Results 4 Summary 5 S. Vogl and C. Eckert (TUM) 10.04.2012 23 / 42

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