You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
surround large allocations with guard-pages, as done in partitionAlloc, scudo, …
Freelist randomisation, see Linux' SLAB_FREELIST_RANDOM
isolate types in different heaps to make type confusion/use after free more difficult, as in kalloc_type. An additional benefit of type isolation + freelist bitmap is that we wouldn't need the object_store anymore to enumerate objects. A less invasive approach would be to simply isolate by size as done in partitionAlloc and Webkit's libpas
once this is done, heaps need to be pinned by size/type, to prevent an attacker from re-using the memory space of a destructed heap with one of different type/size.
allocate strings and array buckets in GigaCages so that a corrupt length doesn't allow to access anything else than other strings/array buckets. This will significantly increase the virtual-memory usage though. this isn't doable since those structures have a maximum size of SIZE_MAX
Description
Currently, PHP's heap implementation is ~trivial to exploit:
There are several hardening techniques that could/should be implemented, listed here in order of difficulty:
Disable ZEND_MM_CUSTOM by default: Make some parts of _zend_mm_heap read-only at runtime #14570SLAB_FREELIST_RANDOMallocate strings and array buckets in GigaCages so that a corrupt length doesn't allow to access anything else than other strings/array buckets. This will significantly increase the virtual-memory usage though.this isn't doable since those structures have a maximum size ofSIZE_MAXcc @arnaud-lb @cfreal @therealcoiffeur