Monday Jun 27, 2005
Monday Jun 27, 2005
What set this off was a lunchtime discussion on how buffer overflows can affect processors with register windows. If you don't know what I'm talking about then check the Wikipedia article. Fascinating ... if you're technically minded.
The thing with register windows is that the return pointer you want to overflow may not be in memory. You have to overflow spilled register sets. I was struggling to find a reference to this and most people I've asked just give me a blank look. For sometime now I've been wondering if I've been missing something obvious.
Thankfully, Google came to the rescue and found a paper all about this. It contains this quote:
As long as register windows are available, it is not possible for an overflow to overwrite the function's return address or frame pointer as they will still be contained in registers. However when the oldest window is saved to the stack, they are again vulnerable to overwriting.Apologies to the authors if I should not have quoted this article, I couldn't find any distribution or copyright notices
The paper discusses the state of the 'art'. That above quote came from a discussion on StackGhost which attempts to validate return addresses when filling the register window.
So it does appear that register windows do offer some protection but I've never managed to demonstrate this with simple overflow code. If anybody has an example to back me up I'd be very interested to try it.