From nobody Wed May 27 13:41:45 2026 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 4gQW4V1xt9z6f3fD for ; Wed, 27 May 2026 13:41:46 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQW4T5wskz4Jjr for ; Wed, 27 May 2026 13:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779889305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ayg7sYNZFPZz03UuE7yB7EEuhWXnMeCZIZslL3DZxS4=; b=fdshHyq4whRekuuPv7RD6XQ54MGT8KpOrHENOxpsbVcq4wurfGiSHFybQn3sHaBLozLBc8 bTMu3qfPb7WPBBuvGm4a6f5O8o4Ul8WbOw3BFVNF7VjlYsZpXDuHtP9PFKpjHz1ieVZeop rq1s+I8dwuq97AgEr+q2o8nB8c3Se7P0Rjwqnht/Iz0WY3POkf9qKAMQifEQfAF/MkK7Ic VaASybqq500EVi6DEWOQQsuElKwQuY9UqHpx7VepkdmUWKfhBPeF0lqyBwXUzfpk8EMH4I r/I20PVHjxEZzENIhXofDl2qCaQaRe8WPDg7GI0jW3g6Nb1iwyhaUzksfhZa/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779889305; a=rsa-sha256; cv=none; b=LpVZxyDN5OelhvF6Ocw9PkYlwD0s+xC9AmqeeBxT00Pj1iy5loN86GDc0FFXcbud4Zh4j4 5gVLIDk2P6BmV/F7RjBZIu1LyWSWN5RRzCwIigYEc3MiKamN56Sxv38TiHFJ1nYjyUDB8T 5AS48K2EEk+L3mWxLukBJn2N+K4yKoDUklXIrfg4HrlVFo7LdvCn4pwhE0+WWTozqfTQP2 jnA02HY7YDCymZoyDFUjJYt4Ar+0w6hRE4EHZO9xcAxFiGvYjgOOqTGGOv2G429rRgnVbt iKCLJdJCkvOkC9wLZFk5FDzUy0W3JvX9SLEKFzNz6ccqN+VBhpDKl4Jsw9/eCQ== 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=1779889305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ayg7sYNZFPZz03UuE7yB7EEuhWXnMeCZIZslL3DZxS4=; b=exH4VWqdw2D/A8/0pvHGauC1OLNz9CUJx+rghFFS2PWjUhjGTOUPUW+nBcOJx5o2M4kMjj +orMGSkC1WZ7Thg9j6NivK/tJxoACc42YnjeAN3vQnGG5D5sSWL58WSmE0DyrpHZKYIAtc wb+iEuq/1H0FUH2hDU5kMLR0BsuCVRwuV3aJlY4poyUKZcTp1XzNieEgJDtOXZKYn85+H/ 7Ut1lWuU1yLKeR/I6PTxaa5W42zGjHXOqnsnOEXJec+DRcqtRY8HvW8TXEKuak2dlAtVco YezGvpG8qNMf5zjjNvu7zElp4XkET9m8fuZ9mrkSnGCCNWH2Q7yZAQmzNVQ3fQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQW4T5W2bz11L8 for ; Wed, 27 May 2026 13:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c80c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 13:41:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Teddy Engel From: Cy Schubert Subject: git: 2349f5a91587 - stable/15 - ipfilter: Fix NULL dereferences in ipf_checkicmp6matchingstate() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 2349f5a91587eaf00c02ae49b0471cf191bec73a Auto-Submitted: auto-generated Date: Wed, 27 May 2026 13:41:45 +0000 Message-Id: <6a16f499.1c80c.2202e9c1@gitrepo.freebsd.org> The branch stable/15 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=2349f5a91587eaf00c02ae49b0471cf191bec73a commit 2349f5a91587eaf00c02ae49b0471cf191bec73a Author: Teddy Engel AuthorDate: 2026-05-19 21:36:33 +0000 Commit: Cy Schubert CommitDate: 2026-05-27 13:41:26 +0000 ipfilter: Fix NULL dereferences in ipf_checkicmp6matchingstate() Add NULL checks for ic6 (the ICMPv6 header pointer from fin->fin_dp) and oic (the inner ICMPv6 header from ofin.fin_dp after ipf_makefrip). These pointers can be NULL when processing malformed ICMPv6 error packets with extension headers. Also fix the length validation: the original check (fin->fin_plen < sizeof(ip6_t)) could never trigger because an earlier check already ensures fin->fin_plen >= ICMP6ERR_MINPKTLEN (48). Replace with a proper check that fin->fin_dlen contains at least ICMPERR_ICMPHLEN + sizeof(ip6_t) bytes to ensure sufficient data exists for both the ICMPv6 error header and the embedded IPv6 header. PR: 288333 MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2214 Signed-off-by: Teddy Engel (cherry picked from commit c028080749c09e68c555155df0e9f681ba63c6ae) --- sys/netpfil/ipfilter/netinet/ip_state.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_state.c b/sys/netpfil/ipfilter/netinet/ip_state.c index 8a21e7593995..774e04b36fd4 100644 --- a/sys/netpfil/ipfilter/netinet/ip_state.c +++ b/sys/netpfil/ipfilter/netinet/ip_state.c @@ -4364,9 +4364,13 @@ ipf_checkicmp6matchingstate(fr_info_t *fin) } ic6 = fin->fin_dp; + if (ic6 == NULL) { + SBUMPD(ipf_state_stats, iss_icmp6_miss); + return (NULL); + } oip6 = (ip6_t *)((char *)ic6 + ICMPERR_ICMPHLEN); - if (fin->fin_plen < sizeof(*oip6)) { + if (fin->fin_dlen < ICMPERR_ICMPHLEN + sizeof(*oip6)) { SBUMPD(ipf_state_stats, iss_icmp_short); return (NULL); } @@ -4408,6 +4412,10 @@ ipf_checkicmp6matchingstate(fr_info_t *fin) if (oip6->ip6_nxt == IPPROTO_ICMPV6) { oic = ofin.fin_dp; + if (oic == NULL) { + SBUMPD(ipf_state_stats, iss_icmp6_miss); + return (NULL); + } /* * an ICMP error can only be generated as a result of an * ICMP query, not as the response on an ICMP error