From patchwork Mon May 13 12:18:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1934709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VdJSR2lrpz20dC for ; Mon, 13 May 2024 22:19:02 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1s6Udl-0001p9-Md; Mon, 13 May 2024 12:18:49 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1s6Udj-0001oB-RA for kernel-team@lists.ubuntu.com; Mon, 13 May 2024 12:18:47 +0000 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9CBAA3F16B for ; Mon, 13 May 2024 12:18:46 +0000 (UTC) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7928d8217caso555542685a.3 for ; Mon, 13 May 2024 05:18:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715602725; x=1716207525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pqaqmKFcmePngOgxlqfeC7tFzoaxd68tqH7MYpoAclc=; b=tHuAK1gPCwIDJIl7bhunjBLzrIT7I876ylf/uDqRYsYITjFTqGlZHLcZLAX2ZDUhrO DaNo3xV4EkILlYCqffoQXlvQfYCOdkPUHWWnicCGBD1A3u7PJRedKvU9NPbI5t47bo+G TQRsyKR4PHnJqjn1f9l56PdE5dSnR0qmZfDqursI5kA8moSRF5GhTW1XGWwQRsjn5M9U 7Poe53ug1u50I9wsQqZEI1oOzxR0LIKU52jYeLDRvi87ZPEi3MNUHBaszcFgH3kJEerN abxzCBTAl7E3x79RNqvth+fdgDZIaBjewhILiBxn7BniZ3ZBEbrNCuhLqzoPjh4+FVxe OIIg== X-Gm-Message-State: AOJu0YwgC6/RcB/+rNTAopU6nXlWq9hSIqYxOfZL3TANtMRdKB1OZbR3 zFq0M2Fo8JmLRuqo95ChgMn/AI0fqvVqTY9dubMTLVqb5f9kPGIN64ZB+sSE9zRoqGZnfeGz9h0 29xeSHP8j4z5cOkgqqbgpCs7YqTV4RmP79UKL457GFZP1fw3OAIIvPV2AKJ6fuVuqCNVcHA831O pnC7glioOtnWXKBlw= X-Received: by 2002:a05:620a:1905:b0:792:bf70:25c2 with SMTP id af79cd13be357-792c757647fmr1211079485a.3.1715602725350; Mon, 13 May 2024 05:18:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS9/tKhl3yVKvCGOehcL2hhwvqiS7GrIwY/WEr8IHOMLbhwRVz392nCTMnVJSwth4KtXi8Ew== X-Received: by 2002:a05:620a:1905:b0:792:bf70:25c2 with SMTP id af79cd13be357-792c757647fmr1211077185a.3.1715602724887; Mon, 13 May 2024 05:18:44 -0700 (PDT) Received: from smtp.gmail.com ([2001:67c:1562:8007::aac:48f9]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf27f99dsm450991885a.37.2024.05.13.05.18.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 05:18:44 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][F][PATCH 1/1] netfilter: nf_tables: disallow anonymous set with timeout flag Date: Mon, 13 May 2024 14:18:27 +0200 Message-Id: <20240513121827.10658-3-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513121827.10658-1-bethany.jamison@canonical.com> References: <20240513121827.10658-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Pablo Neira Ayuso commit 16603605b667b70da974bea8216c93e7db043bf1 upstream. Anonymous sets are never used with timeout from userspace, reject this. Exception to this rule is NFT_SET_EVAL to ensure legacy meters still work. Cc: stable@vger.kernel.org Fixes: 761da2935d6e ("netfilter: nf_tables: add set timeout API support") Reported-by: lonial con Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman (cherry picked from commit e9a0d3f376eb356d54ffce36e7cc37514cbfbd6f linux-5.4.y) CVE-2024-26642 Signed-off-by: Bethany Jamison --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index b3a4fc784841b..7e85606c9e59e 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3769,6 +3769,9 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, if ((flags & (NFT_SET_EVAL | NFT_SET_OBJECT)) == (NFT_SET_EVAL | NFT_SET_OBJECT)) return -EOPNOTSUPP; + if ((flags & (NFT_SET_ANONYMOUS | NFT_SET_TIMEOUT | NFT_SET_EVAL)) == + (NFT_SET_ANONYMOUS | NFT_SET_TIMEOUT)) + return -EOPNOTSUPP; } dtype = 0;