From nobody Tue Aug 01 20:03:55 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RFmJt1BKjz4pnrB; Tue, 1 Aug 2023 20:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RFmJq73bcz3GYF; Tue, 1 Aug 2023 20:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690920236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UZu3oGBb3goOR0OtpGoJxp+bKvA21+NrkaWi8XWWUCg=; b=j+VuS5rOzv5h52xGmNqvMMYnmrpCrICVJ9u2cRdwmg4nzaLB34MNidBVYi5CIw9HFic0ZL SnIyZEAkDGwZvnFQdFyZ6sC9N74f/O6YVTlrnBQJ9u4TtWPnLOk9ZMI0SVlUJc2ty2Gb4l 9AVkfOjsnH9qqzFSTVyM1dlHocf8JW64huAfzgSfQtuZ0AobTaFMIunQUY+0ZzESMWnL8L HO/Fi9BYe8V1vhGnjC2otCvqbnUZz/sec9z5eoQazYzXyayo5F1D46+fxWjr8OgepApvTz keHzi7OPPtthu2habBe9ESN+7WLra4Wb38NJaRi9K5rVkCM1unkjO0hsGLEhsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690920236; a=rsa-sha256; cv=none; b=MX7YC4k/NKk60mfpSyMOFIT9s4pNtRi9DVF1HkOsT3yRbM9+BR/+YFRK0WkTEKSDlYdQhg a1isx86KPBxkq6jcaPQMYANj13Xv4S5DXNBw43NWncCnEKm6WGY1nP/zFEMWus/2xBZ7BB chvXrfLCz+Yf4eeQ5ZtA2cK8xihzi6ZX6uUdBmj1hxxoJEFw5DkeE4JdvGwPNgic/E+c/i 8hkJhCxowsfjrPvX3s7zAxvNCIpXrxrokGvc8GJO1g3qJbN4r8IaY6AKH9v1H83EAfUYIG DzQSnVjbGAQyLpO4ZInEXj/RNI+RnMQ5zKMRLtfWk2tK8YRosP/U04uomgv6LA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690920236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UZu3oGBb3goOR0OtpGoJxp+bKvA21+NrkaWi8XWWUCg=; b=ZyLsdm8k6PmPEcnfWlulRqRdVB1jfZgh23MQcvxt074hcjUBzTKfv++2J7Oc8bsHwt2JH7 CT1B7g/p0JnrqSXTsSYctZ0ondwY+8czK24g4CtfCfOW8KXppTQb3CzH5klEfYX2c74gob dY8fBPtuDJ2V8jfOZ+8LiEu92xK4tH/Ic/K4wsWq/iLOT1x9ysG/kMXm25ldZNPtNoukNy k0hGprdK+2tOd5Q2X36VNwUK/vQZtorZ+nk/8uP8aqBX4dGkjp0gUKUakV36KllVfqdIJ+ l7iLEYQWB9xJiOmrZwC4Klj7z/FjgOj2kMTkr5wybJ/k7tzvOf650jPRjBY+zw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RFmJq66KhzqvM; Tue, 1 Aug 2023 20:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 371K3t1f012825; Tue, 1 Aug 2023 20:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 371K3tcM012824; Tue, 1 Aug 2023 20:03:55 GMT (envelope-from git) Date: Tue, 1 Aug 2023 20:03:55 GMT Message-Id: <202308012003.371K3tcM012824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9515f04fe3b1 - stable/13 - frag6: Avoid a possible integer overflow in fragment handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9515f04fe3b12b9e6ef6c802b647dd4cbdba621b Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9515f04fe3b12b9e6ef6c802b647dd4cbdba621b commit 9515f04fe3b12b9e6ef6c802b647dd4cbdba621b Author: Jonathan T. Looney AuthorDate: 2023-08-01 14:58:34 +0000 Commit: Mark Johnston CommitDate: 2023-08-01 19:49:07 +0000 frag6: Avoid a possible integer overflow in fragment handling Reviewed by: kp, markj, bz Approved by: so Security: FreeBSD-SA-23:06.ipv6 Security: CVE-2023-3107 (cherry picked from commit ff3d1a3f9d71e706f320f51bae258e4e1a51b388) --- sys/netinet6/frag6.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index e0857d3af3e8..023470b20033 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -806,6 +806,11 @@ postinsert: /* Adjust offset to point where the original next header starts. */ offset = ip6af->ip6af_offset - sizeof(struct ip6_frag); free(ip6af, M_FRAG6); + if ((u_int)plen + (u_int)offset - sizeof(struct ip6_hdr) > + IPV6_MAXPACKET) { + frag6_freef(q6, bucket); + goto dropfrag; + } ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_plen = htons((u_short)plen + offset - sizeof(struct ip6_hdr)); if (q6->ip6q_ecn == IPTOS_ECN_CE)