Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2827772pxb; Mon, 1 Nov 2021 02:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYQedq89X9tLBZabGGz3B6vrBhetPn3EMBXhhu2VlG/rQwA5k0a+BVp2oaqmxissEcBrJX X-Received: by 2002:aa7:cb92:: with SMTP id r18mr39986522edt.282.1635759592696; Mon, 01 Nov 2021 02:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759592; cv=none; d=google.com; s=arc-20160816; b=yOVn1vF0FB7j/sJpVXcf8Hi27DV7FqN+2+Hv228IDrEdZepbPkHyUzZHVQtikp0b9B Ib2SFgX5YEaX3zAASL/GBEUWg/QpZXaA1GT3w5SgwywpOgvujilR46byqlF3EjZtQOS3 9cBWDOvS8zoIwGG9PPhI0G5jC+Q270IWlGJuPNiiFQQvOd2dAaN+VSWEAgjV29hsydNh PBQJ6KO4TBk+NR5sHAWYl+J1sfdKC0dRjM/h1nMaqYb0BFrNG9GUyGHyy6bek9RNH/+Y wf0O/q4IkhSyHI+hQYJ6Uw/gaQRGXs8uoUrSl4aaHocAX6ky+L9TjN+jr9bjlzZpwMr4 KY2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+3RKZ3B/dIkeNDCGsCkFssddCCkDYMQCh9Q4dOuNYEo=; b=US7L1AjfTnT/YKPIbhtLeLjnZOyIFURBqHQf5SdFmgdrhhgi+Abpvbnjg/7PguQGym EtPuLCtpDle0F3a3lVtT9gSlJnETHUq5wL03hJLq3RDdl1+De0BESFgrzX99BWS5dRmS Ra5+V3Ts7auqBFsy+Mpjd62bw0wEu9a9gwokudYfkK86M2Wi9w0J0rCddGau473rQYAA 6JG/uc0qEwzwwsDb0DEkBJkvAPTp/ltgt8v9eTVYpl7G2HnibEaNkMF1+Kx+ROHFTpQ3 lWLCmcoCJfLJr19Rj3dg5muu3zRd7hjKhpO83UqV9zdQwTMZB+wiUeaiw+Mmr47ajODU Lhfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JEJnDxRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si29509203edz.276.2021.11.01.02.39.29; Mon, 01 Nov 2021 02:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JEJnDxRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233528AbhKAJkQ (ORCPT + 99 others); Mon, 1 Nov 2021 05:40:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:43700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233230AbhKAJh7 (ORCPT ); Mon, 1 Nov 2021 05:37:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A4B6E60187; Mon, 1 Nov 2021 09:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758826; bh=Id8fWUsxCWOHV6k4CE1usYI6rxkOxb+zQWMlbsryPUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEJnDxRpbGVQ3COi6CWE2nZ3t8yvH38NGRyu8ctt+Mko7NuwPbkdjuAik+kJxn4aS iROPs6d+4O15FEY/j6/oXKDX8hhAvnBu10qqw9y677kJ4gHIfiMOaocHOuH4fxZfqY xJYrPxXAUgZeobrn+UjmYiDPjpynpjyGRNe4CxS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Marcelo Ricardo Leitner , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 68/77] sctp: add vtag check in sctp_sf_violation Date: Mon, 1 Nov 2021 10:17:56 +0100 Message-Id: <20211101082525.833757923@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit aa0f697e45286a6b5f0ceca9418acf54b9099d99 ] sctp_sf_violation() is called when processing HEARTBEAT_ACK chunk in cookie_wait state, and some other places are also using it. The vtag in the chunk's sctphdr should be verified, otherwise, as later in chunk length check, it may send abort with the existent asoc's vtag, which can be exploited by one to cook a malicious chunk to terminate a SCTP asoc. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sctp/sm_statefuns.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 0cfbf6046bf8..324c0222d9e6 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -4549,6 +4549,9 @@ enum sctp_disposition sctp_sf_violation(struct net *net, { struct sctp_chunk *chunk = arg; + if (!sctp_vtag_verify(chunk, asoc)) + return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); + /* Make sure that the chunk has a valid length. */ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, -- 2.33.0