Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1823034rwo; Sun, 23 Jul 2023 01:04:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGhkU4q/gUkxcViId/R6HgNQs4UxSVi3vtBkkeWrgj0Jzdk23D4hupTUcGYY72RPPtYho3k X-Received: by 2002:a05:6e02:f47:b0:345:fbdc:bb78 with SMTP id y7-20020a056e020f4700b00345fbdcbb78mr4692456ilj.29.1690099487571; Sun, 23 Jul 2023 01:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690099487; cv=none; d=google.com; s=arc-20160816; b=nZUvXH3clX0V3gaP2Cxqv6ryabuRKA0wFzVL/UF7nY8WhZyF3ILcedxSuhJn9/3mx1 I8Z3ZStEZRb7+TmaJFL1vVddWLIhvv9H60Q6MuLdItB/VY3x784H6L130ITe+YOyMhdv MNkYty3umaVU/Mku603yweZs4mWSOLelcZMdRya7tvGuGTlyHOvPwCwaD8daQbiuZpBh NbeDjM3WCfp/XYNE1RhLF7hRYsNKvpyrlw/JqJiJLyfQ+tZs+lKokc5gQN/j12tMoJAc c2E7yMHwf8YaEZzI6mshC92Ho0ruf18gEWm2p1URRyf1wtkcwxTbwVX++/KOqYfZQoFs h4Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=wzKj0ZU3k8XM2Qbx5jfJ/pauhJDgZnnlnyFsZxpgpEc=; fh=7p6h4zLGIiXj4NR3UpPWFEfInqn1MZxapWyfkzl/v9k=; b=jAQJ/m/3Wu/yj7LEyz7pzjXfWmXBNPuOhx8sk8FcWf9udtdRZs6O5b+pWUvAhFDNj/ sTotLdbkIZgpSZhrvNCtOX0sBz39kePATv3G1Lw8q4KOQPVPrHSOVufuHqhoca3vchIA +FF48jSPytzIjvqU770jBgoBZhEYdC2DzPwaKpb8XsLS+ShqCa9kP1RpZOtMNXwwBSCI TxV7C539aFHEN/cHLhzEiVAXf9hltqdcSg/9P4ndHJMrecrxlr7gTPlPjPlx+5rwqwvh 1ze53MfzWTiyS9HPr9gdrugg4Ua5jD8BL32A4rFTXbRQR4WcULLf2OwlARqwFj2Qq/Yt FNmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a637017000000b005579a12f405si6848916pgc.200.2023.07.23.01.04.35; Sun, 23 Jul 2023 01:04:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbjGWHlh (ORCPT + 99 others); Sun, 23 Jul 2023 03:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjGWHlf (ORCPT ); Sun, 23 Jul 2023 03:41:35 -0400 Received: from zg8tndyumtaxlji0oc4xnzya.icoremail.net (zg8tndyumtaxlji0oc4xnzya.icoremail.net [46.101.248.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEAB31722 for ; Sun, 23 Jul 2023 00:41:32 -0700 (PDT) Received: from localhost.localdomain (unknown [36.24.99.225]) by mail-app3 (Coremail) with SMTP id cC_KCgDHzw+X2bxk5h9_Cw--.18638S4; Sun, 23 Jul 2023 15:41:11 +0800 (CST) From: Lin Ma To: steffen.klassert@secunet.com, herbert@gondor.apana.org.au, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lin Ma Subject: [PATCH v1] xfrm: add forgotten nla_policy for XFRMA_MTIMER_THRESH Date: Sun, 23 Jul 2023 15:41:10 +0800 Message-Id: <20230723074110.3705047-1-linma@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgDHzw+X2bxk5h9_Cw--.18638S4 X-Coremail-Antispam: 1UD129KBjvJXoW7Kry7WFWxZF1rXFy3Cw1UAwb_yoW8WF18pF W8C34xCwnrX34jkwnruFn2ga1Iga47XFyDGF9IvFyrA3ZIg3Z0g34fC34aq3yvyF4rJFW7 AF4ayry5KF1q9rUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkS14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r4x MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJV W8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUYMKZDUUUU X-CM-SenderInfo: qtrwiiyqvtljo62m3hxhgxhubq/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous commit 4e484b3e969b ("xfrm: rate limit SA mapping change message to user space") added one additional attribute named XFRMA_MTIMER_THRESH and described its type at compat_policy (net/xfrm/xfrm_compat.c). However, the author forgot to also describe the nla_policy at xfrma_policy (net/xfrm/xfrm_user.c). Hence, this suppose NLA_U32 (4 bytes) value can be faked as empty (0 bytes) by a malicious user, which leads to 4 bytes overflow read and heap information leak when parsing nlattrs. To exploit this, one malicious user can spray the SLUB objects and then leverage this 4 bytes OOB read to leak the heap data into x->mapping_maxage (see xfrm_update_ae_params(...)), and leak it to userspace via copy_to_user_state_extra(...). The above bug is assigned CVE-2023-3773. To fix it, this commit just completes the nla_policy description for XFRMA_MTIMER_THRESH, which enforces the length check and avoids such OOB read. Fixes: 4e484b3e969b ("xfrm: rate limit SA mapping change message to user space") Signed-off-by: Lin Ma --- net/xfrm/xfrm_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index c34a2a06ca94..ab0e73c1e352 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3035,6 +3035,7 @@ const struct nla_policy xfrma_policy[XFRMA_MAX+1] = { [XFRMA_SET_MARK] = { .type = NLA_U32 }, [XFRMA_SET_MARK_MASK] = { .type = NLA_U32 }, [XFRMA_IF_ID] = { .type = NLA_U32 }, + [XFRMA_MTIMER_THRESH] = { .type = NLA_U32 }, }; EXPORT_SYMBOL_GPL(xfrma_policy); -- 2.17.1