All of lore.kernel.org
 help / color / mirror / Atom feed
* Stack growing and buffer overflows
@ 2003-03-10 23:00 Felipe Alfaro Solana
  2003-03-10 23:29 ` Patrick E Kane
  2003-03-11 12:23 ` =?unknown-8bit?Q?J=F6rn?= Engel
  0 siblings, 2 replies; 4+ messages in thread
From: Felipe Alfaro Solana @ 2003-03-10 23:00 UTC (permalink / raw)
  To: linux-kernel, phoebe-list

Hi `who | cut -f1 d' '`, 
 
Lately, I have been reading some articles on buffer overflows. Many of them seem to be caused by using local 
variables that are allocated on the stack and then written to with no proper bounds checking. I don't know of 
other architectures, but on x86, the stack grows downwards (from higher memory addresses to lower memory 
addresses). This makes buffer overflows attacks easy to exploit: if a function uses strcpy() instead of strncpy() to 
copy data (or memset or anything else that normally works upwards), due to the downwards nature of the stack 
implementation, it's possible to overwrite the function's return address, or even another function local data 
waiting in the call stack -> the stack grows downwards, but strcpy() works upwards, thus being able to cross 
stack function boundaries (overwritting other functions local data or even its return address). 
 
However, what would happen if the stack was implemented to grow upwards (from lower memory addresses to 
higher memory addresses)? With this kind of implementation, if the last function in the call stack invokes 
strcpy() over a local variable (allocated onto the stack) without checking bounds, the extra data would not 
overwrite neither the own function's return address nor any other function waiting onto the call stack -> the 
stack grows upwards and so does strcpy() when writting memory. 
 
I know there are hardware implementation details involved in this issue, like the way PUSH and POP work, but 
this is just an idea :-) 
 
Comments on this? Could this be viable? Is the whole idea stupid in general? 
 
Thanks! 
 
   Felipe Alfaro 
 
-- 
______________________________________________
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr

Powered by Outblaze

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-11 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-10 23:00 Stack growing and buffer overflows Felipe Alfaro Solana
2003-03-10 23:29 ` Patrick E Kane
2003-03-11 10:07   ` Helge Hafting
2003-03-11 12:23 ` =?unknown-8bit?Q?J=F6rn?= Engel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.