1

The following questions regard linux processes with a stack that grows downwards from the end of the process memory.

  1. If I have a buffer overflow on the heap with unlimited size, are there any protection against me overwriting the entire process memory until reaching the stack and overwriting it?

  2. Same question for buffer overflows in mmaped memory regions, which in comparison to the heap can reside closer im memory to the stack

Thanks!

1 Answer 1

2

In theory, because the heap grows up and the stack grows down, maybe it could be possible if both were to grow far enough. However, in practice, it's very unlikely.

There is generally a large, unmapped range of memory between the heap and the stack, and there may be other regions mapped before the stack for shared libraries and such. The problem is, the moment you try to write to an unmapped address or a read-only page, you will trigger a segfault. This will certainly be the limiting factor if you attempt something like this. The same applies to your second question. Unless the memory region is directly adjacent to the stack with no gaps, you will probably have trouble.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .