From: "Felipe Alfaro Solana" <felipe_alfaro@linuxmail.org>
To: linux-kernel@vger.kernel.org, phoebe-list@redhat.com
Subject: Stack growing and buffer overflows
Date: Tue, 11 Mar 2003 00:00:12 +0100 [thread overview]
Message-ID: <20030310230012.26391.qmail@linuxmail.org> (raw)
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
next reply other threads:[~2003-03-10 22:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-10 23:00 Felipe Alfaro Solana [this message]
2003-03-10 23:29 ` Stack growing and buffer overflows Patrick E Kane
2003-03-11 10:07 ` Helge Hafting
2003-03-11 12:23 ` =?unknown-8bit?Q?J=F6rn?= Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030310230012.26391.qmail@linuxmail.org \
--to=felipe_alfaro@linuxmail.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phoebe-list@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.