From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 714D3C10F14 for ; Wed, 2 Oct 2019 18:39:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 558CA21783 for ; Wed, 2 Oct 2019 18:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728863AbfJBSjC (ORCPT ); Wed, 2 Oct 2019 14:39:02 -0400 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:40530 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfJBSjC (ORCPT ); Wed, 2 Oct 2019 14:39:02 -0400 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1iFjWa-0004gM-DQ; Wed, 02 Oct 2019 20:38:56 +0200 Date: Wed, 2 Oct 2019 20:38:56 +0200 From: Florian Westphal To: Eric Dumazet Cc: "David S . Miller" , netdev , Eric Dumazet , Florian Westphal , Hannes Frederic Sowa , syzbot Subject: Re: [PATCH net] ipv6: drop incoming packets having a v4mapped source address Message-ID: <20191002183856.GA13866@breakpoint.cc> References: <20191002163855.145178-1-edumazet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191002163855.145178-1-edumazet@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Eric Dumazet wrote: > The dual stack API automatically forces the traffic to be IPv4 > if v4mapped addresses are used at bind() or connect(), so it makes > no sense to allow IPv6 traffic to use the same v4mapped class. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Eric Dumazet > Cc: Florian Westphal > Cc: Hannes Frederic Sowa > Reported-by: syzbot > --- > net/ipv6/ip6_input.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c > index d432d0011c160f41aec09640e95179dd7b364cfc..2bb0b66181a741c7fb73cacbdf34c5160f52d186 100644 > --- a/net/ipv6/ip6_input.c > +++ b/net/ipv6/ip6_input.c > @@ -223,6 +223,16 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev, > if (ipv6_addr_is_multicast(&hdr->saddr)) > goto err; > > + /* While RFC4291 is not explicit about v4mapped addresses > + * in IPv6 headers, it seems clear linux dual-stack > + * model can not deal properly with these. > + * Security models could be fooled by ::ffff:127.0.0.1 for example. > + * > + * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 > + */ > + if (ipv6_addr_v4mapped(&hdr->saddr)) > + goto err; > + Any reason to only consider ->saddr instead of checking daddr as well?