Linux kernel heap quarantine versus use-after-free exploits
a13xp0p0v.github.io
a13xp0p0v.github.io
https://www.blackhat.com/docs/us-16/materials/us-16-Yason-Wi...
https://www.blackhat.com/docs/us-16/materials/us-16-Yason-Wi...
It's still not perfect, given the predictable nature of block coalescence. But it's quite a departure from the old manager.
If you change the size of your request you will go either to another bucket or the backend allocator. So that makes type confusions slightly harder if you don't control variably sized buffers.
Even before those 18 allocations, the specific tricks that used to work on the old manager, which is very similar to the behavior of linux kernel apparently, no longer work. It used to be that you could reliably get the same memory address if you allocated a same sized structure immediately after freeing another. But that no longer works.
The only technique that I currently know of is that the merging of free blocks on the backend allocator is still deterministic.
But to use that you must be sure your target has not already triggered LFH for the sizes that you're using while grooming.
https://en.wikipedia.org/wiki/Address_space_layout_randomiza...
However, even if the “heap is randomized”, that typically just means that the underlying blocks of memory (e.g. what mmap returns) have randomized virtual addresses. The allocator you use will still have to carve up those blocks from the OS—your kernel does not provide malloc(), after all.
Maybe with the new ways of interacting with the kernel, like io_uring it can be cheaper.
I remember, way back when, in college, when I would try to listen to music while my machine was torrenting a movie on the same HDD, the playback of the song would get totally borked because the queuing scheme of the linux I/O scheduler at that time could not cope with this(it was tuned for server operations) even though both Windows and MacOS could handle this scenario without a sweat since like forever.
IIRC BFQ scheduler finally addressed this later but I'm not 100% sure on this info.
[1] https://en.wikipedia.org/wiki/Defense_in_depth_(computing)
* In practice this isn't really true, and there are many ways to bypass KASLR
For anyone else wondering, it seems to be possible to turn on via a manifest:
https://chromium.googlesource.com/chromium/src/+/1a9f684dad2...
Now I'm curious if there's any way to turn it on dynamically from inside a traditional Win32 process.
You can also just edit the embedded manifest of traditional win32 processes as a hack before runtime :/
Good job.
If I'm not mistaken, science publishing doesn't work like this. Only good results are published - successful failures aren't.
https://ftp.openbsd.org/papers/eurobsdcon2009/otto-malloc.pd...
https://chromium.googlesource.com/chromium/src/+/refs/heads/...
> And the main kudos go to Jann Horn, who reviewed the
> security properties of my slab quarantine mitigation and
> created a counter-attack that re-enabled UAF exploitation
> in the Linux kernel.https://www.twitch.tv/keescook
Past recordings can be found on youtube: https://www.youtube.com/channel/UC6zmTkbgwe2q6l6TNjABSCg/vid...
EDIT: I realized it's mentioned in the blog post! But more airtime doesn't hurt :)