netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: urs.thuermann@volkswagen.de, netdev@vger.kernel.org, security@kernel.org
Subject: Re: [SECURITY] CAN info leak/minor heap overflow
Date: Tue, 02 Nov 2010 20:43:16 +0100	[thread overview]
Message-ID: <4CD069D4.7010801@hartkopp.net> (raw)
In-Reply-To: <1288722503.2504.14.camel@dan>

Hello Dan,

On 02.11.2010 19:28, Dan Rosenberg wrote:
> In bcm_connect() (in net/can/bcm.c), I noticed the following code:
> 
> 	sprintf(bo->procname, "%p", sock);
> 
> "procname" is a 9-byte char array.  This code is wrong on two levels.
> First, leaking a kernel address via a /proc filename is bad.

Why is this bad? Can the addresses of CAN-BCM sock structs be used for
anything from userspace?

For me they are just intented to be unique numbers ...

> Secondly,
> on 64-bit platforms, up to 17 bytes may be copied into the buffer.

Hm - that's indeed not wanted. Will send a patch at least for this issue.

> Fortunately, structure padding will most likely prevent this from being
> a problem, except for the trailing NULL byte, which may overwrite the
> first byte of the next heap object.  Please name your procfile in a way
> that doesn't leak information and fits into the desired name buffer.
> 
> -Dan
> 

Regards,
Oliver



  reply	other threads:[~2010-11-02 19:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 18:28 [SECURITY] CAN info leak/minor heap overflow Dan Rosenberg
2010-11-02 19:43 ` Oliver Hartkopp [this message]
2010-11-02 19:53   ` Dan Rosenberg
2010-11-02 19:57     ` [Security] " Linus Torvalds
2010-11-02 20:19       ` Oliver Hartkopp
2010-11-02 20:16     ` Oliver Hartkopp
2010-11-05 18:33 ` [PATCH] Fix " Urs Thuermann
2010-11-09  7:52   ` Oliver Hartkopp
2010-11-09 17:05     ` David Miller
2010-11-10  6:52       ` Oliver Hartkopp
2010-11-10 17:51         ` David Miller
2010-11-10 22:10           ` Oliver Hartkopp

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=4CD069D4.7010801@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=drosenberg@vsecurity.com \
    --cc=netdev@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=urs.thuermann@volkswagen.de \
    /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).