From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
To: jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org
Cc: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Jeff Garzik <jgarzik-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>,
Dan Williams <dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Jouni Malinen <jkm-r/za7OOdgF0ztatW0fm/fQ@public.gmane.org>
Subject: Re: wireless extensions vs. 64-bit architectures
Date: Thu, 08 Mar 2007 18:37:07 +0100 [thread overview]
Message-ID: <1173375427.3248.33.camel@johannes.berg> (raw)
In-Reply-To: <1173364747.14001.7.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
On Thu, 2007-03-08 at 15:39 +0100, Johannes Berg wrote:
> Oh, btw, this also means that we have an information leak on 64-bit
> kernels. Those alignment bytes aren't ever cleared or anything, they
> come right from the stack since most users of this just use a struct
> iw_event on the stack which is then memcpy()ed right into the userspace
> buffer. For example those bytes 5 through 8 ("50:8A:35:E0") in the first
> buffer above. This is generally considered a security problem.
Patch below might fix it. If it does, please send it on to Linus (or
akpm), stable and whoever else might be interested in backporting it
(distros? or do they cherrypick from stable?)
I'm unable to test it as I'll be away from my only 64-bit machine for at
least until the 19th or 20th.
Yeah, I know sparse warns about this on 32-bit machines... But it seems
useless to try to fix that warning.
johannes
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Subject: fix information leak in wireless extensions (on 64-bit architectures)
On 64-bit architectures wireless extensions leak information from the
kernel stack due to padding inside structs not being cleared before they
are copied to userspace.
This is available to unprivileged users since they can listen for
wireless events and obtain scan results.
This patch fixes it by explicitly clearing the padding.
Signed-off-by: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
---
include/net/iw_handler.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
--- wireless-dev.orig/include/net/iw_handler.h 2007-03-08 18:17:43.384642258 +0100
+++ wireless-dev/include/net/iw_handler.h 2007-03-08 18:28:12.704642258 +0100
@@ -484,6 +484,9 @@ iwe_stream_add_event(char * stream, /*
struct iw_event *iwe, /* Payload */
int event_len) /* Real size of payload */
{
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Check if it's possible */
if(likely((stream + event_len) < ends)) {
iwe->len = event_len;
@@ -505,6 +508,10 @@ iwe_stream_add_point(char * stream, /*
char * extra) /* More payload */
{
int event_len = IW_EV_POINT_LEN + iwe->u.data.length;
+
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Check if it's possible */
if(likely((stream + event_len) < ends)) {
iwe->len = event_len;
@@ -531,6 +538,9 @@ iwe_stream_add_value(char * event, /* E
struct iw_event *iwe, /* Payload */
int event_len) /* Real size of payload */
{
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Don't duplicate LCP */
event_len -= IW_EV_LCP_LEN;
@@ -558,6 +568,9 @@ iwe_stream_check_add_event(char * stream
int event_len, /* Size of payload */
int * perr) /* Error report */
{
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Check if it's possible, set error if not */
if(likely((stream + event_len) < ends)) {
iwe->len = event_len;
@@ -582,6 +595,10 @@ iwe_stream_check_add_point(char * stream
int * perr) /* Error report */
{
int event_len = IW_EV_POINT_LEN + iwe->u.data.length;
+
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Check if it's possible */
if(likely((stream + event_len) < ends)) {
iwe->len = event_len;
@@ -611,6 +628,9 @@ iwe_stream_check_add_value(char * event,
int event_len, /* Size of payload */
int * perr) /* Error report */
{
+ /* clear padding */
+ memset((char*)iwe + 4, 0, IW_EV_LCP_LEN - 4);
+
/* Don't duplicate LCP */
event_len -= IW_EV_LCP_LEN;
next prev parent reply other threads:[~2007-03-08 17:37 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 1:27 wireless extensions vs. 64-bit architectures Johannes Berg
2007-03-06 14:31 ` Johannes Berg
2007-03-06 17:13 ` Jean Tourrilhes
[not found] ` <20070306171316.GA19669-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-06 18:43 ` Michael Buesch
[not found] ` <200703061943.07350.mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
2007-03-07 1:42 ` Jean Tourrilhes
2007-03-07 2:03 ` Jean Tourrilhes
[not found] ` <20070307020310.GA20466-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-08 14:39 ` Johannes Berg
[not found] ` <1173364747.14001.7.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-08 16:51 ` Johannes Berg
2007-03-08 17:37 ` Johannes Berg [this message]
2007-03-08 18:49 ` Jean Tourrilhes
2007-03-08 19:08 ` Johannes Berg
[not found] ` <1173380909.3248.52.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-08 19:13 ` Jean Tourrilhes
2007-03-08 19:23 ` Johannes Berg
[not found] ` <20070308184954.GA24485-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-08 19:27 ` Johannes Berg
2007-03-08 19:34 ` Jouni Malinen
[not found] ` <20070308193412.GG23040-r/za7OOdgF0ztatW0fm/fQ@public.gmane.org>
2007-03-08 19:40 ` Johannes Berg
[not found] ` <1173382802.3248.68.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-08 22:11 ` Jean Tourrilhes
[not found] ` <20070308221128.GA24884-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-08 22:17 ` Randy Dunlap
[not found] ` <20070308141756.efdfd6da.randy.dunlap-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2007-03-08 22:30 ` Jean Tourrilhes
[not found] ` <20070308223058.GA24960-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-08 22:36 ` Johannes Berg
2007-03-08 22:34 ` David Miller
2007-03-08 22:49 ` Pavel Roskin
2007-03-08 22:22 ` Johannes Berg
[not found] ` <1173392526.3831.12.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-08 22:36 ` Jean Tourrilhes
2007-03-08 22:35 ` Johannes Berg
2007-03-09 21:35 ` Jean Tourrilhes
[not found] ` <20070309213531.GA28070-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-09 23:19 ` Jouni Malinen
[not found] ` <20070309231922.GF24143-r/za7OOdgF0ztatW0fm/fQ@public.gmane.org>
2007-03-10 1:01 ` Jean Tourrilhes
2007-03-11 17:40 ` Johannes Berg
[not found] ` <1173634801.3382.8.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-11 20:11 ` Ulrich Kunitz
[not found] ` <20070311201148.GA25938-WhJF3imHnk+bHbQv0o6mQ2hcgWyyV7dXYZdqe9AaVak@public.gmane.org>
2007-03-11 20:30 ` Michael Buesch
2007-03-12 17:56 ` Jean Tourrilhes
2007-03-12 18:21 ` Jouni Malinen
[not found] ` <20070312182149.GA1785-r/za7OOdgF0ztatW0fm/fQ@public.gmane.org>
2007-03-12 20:34 ` Jean Tourrilhes
[not found] ` <20070312175639.GA4048-yAE0UhLNZJawPNPzzlOzwdBPR1lH4CV8@public.gmane.org>
2007-03-13 19:42 ` Johannes Berg
[not found] ` <1173814925.12717.6.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2007-03-13 21:30 ` Jean Tourrilhes
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=1173375427.3248.33.camel@johannes.berg \
--to=johannes-cdvu00un1vgdhxzaddlk8q@public.gmane.org \
--cc=dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgarzik-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
--cc=jkm-r/za7OOdgF0ztatW0fm/fQ@public.gmane.org \
--cc=jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).