From: Jan Kiszka <jan.kiszka@siemens.com>
To: Petr Matousek <pmatouse@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] slirp: udp: fix NULL pointer dereference because of uninitialized socket
Date: Wed, 17 Sep 2014 18:00:25 +0200 [thread overview]
Message-ID: <5419B019.5060103@siemens.com> (raw)
In-Reply-To: <20140917114130.GT9321@dhcp-25-225.brq.redhat.com>
On 2014-09-17 13:41, Petr Matousek wrote:
> When guest sends udp packet with source port and source addr 0,
> uninitialized socket is picked up when looking for matching and already
> created udp sockets, and later passed to sosendto() where NULL pointer
> dereference is hit during so->slirp->vnetwork_mask.s_addr access.
>
> Fix this by checking that the socket is in initialized state.
>
> This is CVE-2014-3640.
>
> Signed-off-by: Petr Matousek <pmatouse@redhat.com>
> Reported-by: Xavier Mehrenberger <xavier.mehrenberger@airbus.com>
> Reported-by: Stephane Duverger <stephane.duverger@eads.net>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> slirp/udp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/slirp/udp.c b/slirp/udp.c
> index 8cc6cb6..4affcc6 100644
> --- a/slirp/udp.c
> +++ b/slirp/udp.c
> @@ -152,7 +152,7 @@ udp_input(register struct mbuf *m, int iphlen)
> * Locate pcb for datagram.
> */
> so = slirp->udp_last_so;
> - if (so->so_lport != uh->uh_sport ||
> + if (!so->so_state || so->so_lport != uh->uh_sport ||
I think it would be clearer to test so against &slirp->udb. That's done
later on in this code as well to differentiate between valid sockets and
this stub.
Jan
> so->so_laddr.s_addr != ip->ip_src.s_addr) {
> struct socket *tmp;
>
>
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
prev parent reply other threads:[~2014-09-17 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 11:41 [Qemu-devel] [PATCH] slirp: udp: fix NULL pointer dereference because of uninitialized socket Petr Matousek
2014-09-17 14:18 ` Michael S. Tsirkin
2014-09-17 16:00 ` Jan Kiszka [this message]
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=5419B019.5060103@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=pmatouse@redhat.com \
--cc=qemu-devel@nongnu.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 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.