an overview of the lfh
play

An overview of the LFH Mitigation Observations Conclusion Bruno - PowerPoint PPT Presentation

An overview of the LFH Bruno Pujos Introduction How it works Windows An overview of the LFH Mitigation Observations Conclusion Bruno Pujos July 20, 2014 Plan An overview of the LFH Bruno Pujos Introduction How it works Windows


  1. An overview of the LFH Bruno Pujos Introduction How it works Windows An overview of the LFH Mitigation Observations Conclusion Bruno Pujos July 20, 2014

  2. Plan An overview of the LFH Bruno Pujos Introduction How it works Windows Mitigation 1 Introduction Observations Conclusion

  3. The LFH? An overview of the LFH Bruno Pujos Introduction How it works Windows • Low Fragmentation Heap: Front End allocator Mitigation • Userland (sorry, no kernel this time. . . ) Observations Conclusion • Windows 8/8.1 32bit • Why talk about it? • Some details were left out to keep it simple

  4. General Memory Management An overview of the LFH Bruno Pujos Introduction How it works Windows Mitigation Observations Conclusion

  5. A little bit of history An overview of the LFH Bruno Pujos Introduction How it works • LFH released with Windows XP (2001) but not Windows Mitigation enabled by default Observations • The Look-Aside-List was another Front End allocator Conclusion at that time • Since Vista, no more LAL, and LFH is enabled by default

  6. Plan An overview of the LFH Bruno Pujos 1 Introduction Introduction How it works 2 How it works Windows Mitigation Structures Observations Allocation Conclusion Free Windows Mitigation 3 Observations 4 Conclusion 5

  7. Plan An overview of the LFH Bruno Pujos Introduction How it works Structures How it works 2 Allocation Free Structures Windows Allocation Mitigation Free Observations Conclusion

  8. Plan An overview of the LFH Bruno Pujos Introduction How it works Structures How it works 2 Allocation Free Structures Windows Allocation Mitigation Free Observations Conclusion

  9. General Overview An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  10. General Overview An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  11. _HEAP & _LFH_HEAP An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  12. General Overview An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  13. _HEAP_BUCKET An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  14. General Overview An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  15. _HEAP_LOCAL_SEGMENT_INFO An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  16. General Overview An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  17. Subsegment & UserBlocks An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  18. Plan An overview of the LFH Bruno Pujos Introduction How it works Structures How it works 2 Allocation Free Structures Windows Allocation Mitigation Free Observations Conclusion

  19. Allocation Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  20. LFH activation & Back-end An overview of the LFH Bruno Pujos Introduction How it works • RtlpAllocateHeap(_HEAP *Heap, int Flags, int Size, Structures Allocation unsigned int RoundedSize, _LIST_ENTRY *ListHint, Free int *RetCode) Windows Mitigation • HEAP_NO_SERIALIZE Observations • Heap->CompatibilityFlags & 0x20000000: activation Conclusion of the LFH needed • RtlpPerformHeapMaintenance(_HEAP *Heap)

  21. LFH activation & Back-end An overview of the LFH Allocation of size < 0x4000 Bruno Pujos • if the LFH is not activated: set the CompatibilityFlags Introduction • if the LFH is not activated for this size: How it works Structures • add 0x21 in the Heap->FrontEndHeapUsageData[] Allocation Free • if 0x10 consecutive allocations or Windows Heap->FrontEndHeapUsageData[] > 0xff00: activate Mitigation for the next allocation of the same size Observations Conclusion Activation for a given size • set Heap->FrontEndHeapUsageData[] to the BucketIndex • set Heap->FrontEndHeapStatusBitmap[] to 1 (activated)

  22. Allocation Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  23. LFH Allocation An overview of the LFH Bruno Pujos Introduction How it works Structures • size <= 0x4000 Allocation Free • HEAP_NO_SERIALIZE Windows Mitigation • Heap->FrontEndHeapStatusBitmap == 1 Observations • RtlpLowFragHeapAllocFromContext(_LFH_HEAP Conclusion *LFH, unsigned short BucketIndex, int Size, char Flags)

  24. LFH Allocation Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  25. LFH Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  26. LFH Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  27. LFH Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  28. LFH Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  29. LFH Randomization An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  30. LFH Randomization An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  31. LFH Randomization An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows • RtlpLowFragHeapRandomData Mitigation • LowFragHeapDataSlot (in the TEB) Observations Conclusion

  32. LFH Allocation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  33. LFH Allocation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  34. LFH Cache An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  35. LFH Cache An overview of the LFH Bruno Pujos Introduction How it works Structures • Check the cache Allocation Free • Try to allocate UserBlocks and/or Subsegment Windows Mitigation • Fail if RtlAllocateHeap fails Observations • Update RtlpLowFragHeapRandomData in Conclusion Subsegment allocation

  36. LFH Cache An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  37. LFH Allocation Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  38. Plan An overview of the LFH Bruno Pujos Introduction How it works Structures How it works 2 Allocation Free Structures Windows Allocation Mitigation Free Observations Conclusion

  39. Free Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  40. Free Back-end An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free • RtlpFreeHeap(_HEAP *Heap, int Flags, Windows _HEAP_ENTRY *Header, void *Chunk) Mitigation Observations • Decrement the counter in Conclusion Heap->FrontEndHeapUsageData[]

  41. Free Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  42. LFH Free An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation • No longer handled by RtlpLowFragHeapFree Free Windows • Same algorithm idea in Windows 8 and 8.1 Mitigation Observations • Header->UnusedBytes & 0x80 Conclusion • Always returns true

  43. LFH Free Workflow An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  44. LFH Free Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

  45. LFH Free Initialisation An overview of the LFH Bruno Pujos Introduction How it works Structures Allocation Free Windows Mitigation Observations Conclusion

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