From nobody Thu Oct 23 22:56:41 2025 X-Original-To: dev-commits-src-main@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 4ct1cT66Zkz6Dn34; Thu, 23 Oct 2025 22:56:41 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ct1cT5M8Bz3LKs; Thu, 23 Oct 2025 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761260201; 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=7+mdvXEd8go2umXKVNmSWHmBRpGHolodHO2VAg6gVEQ=; b=mCdVU83RKpsAO31XZHk7OHDswHyTH82Jvf0KXVlRqJZKOYni/xN+9Bzjv3z3hI7fPKmFAd c2lz7kxZf0gDaAt1mtSHJe2PVrspOI2sSZrwLodhjKPyFcwZMqH3aZxz9hHApxTqPmwjbn rS8RJKHVYNflQmOEWoqsedyVCt0SN4nmT/n03orBnN0eKG2+VUotQKuxDNPGki44V1834O CQe937kAx5xJ8N2yTnnTt6uTjxhptAr9hmXUtRzzlj+ZoFNR/SkhgMNEnPMKdlHtayDqZJ KangBCdXdGBKW2VwH5kFvinqSYuZLiPi1RmpDa11An2Oh4k3/ljrAAHXycM9WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761260201; 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=7+mdvXEd8go2umXKVNmSWHmBRpGHolodHO2VAg6gVEQ=; b=pdQxh29+FwxkxGupHe0G5+fktmnfVdXGy/wZGRC2ILUGpuTXWUZXSIe33eqxCA6iNnnJZ4 aTcpAZ7gzykJGGCeJTU+3niGRdaZdxpanNNFBmZSU1q9Fd4kM8VRWdL8lZWRadtAvRlQ05 sKSAen9p79MnaFzX9h69hRHu7+Y+7cyks6meQkcNxkoNIlZ392XhmHdi5izAv97StCbeph Q7cVCATBGxptg8XZihy9lqEFVj1I0fL7GavoqhatdZKW+RtF5YY9af+fIMKEKGBbMv0THk PcVhsVH0Utmul/wPc1MACn+Tl9jzgwUcFgVJ7JzkkifeeLrzXwuIwtuI0qPFPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761260201; a=rsa-sha256; cv=none; b=bBzrVS9b82VIgtUPNJvyEhgfOvrgnWaohGMm1RKPl5u96D7ebCPxqEV9P6FqqFeh+4TxYQ nfjzr1D/lgGlFTlP51XQtISWox/WYcX7UwcLP4/jt6v4uFmh2/bu6O5oMuUNHf/IzP60QH yjVgFKd/665nQVl/kUL8xbOmksI5UfdVBRsomhCV0AZ96zi9sfi4ArhYRC5EvCgAlFXd7L OZX8eCMbpjgyiYewrQ9j6jGOytVUisCg50DF2Zw0jYaPufcp1R2VnlPLIsO08B4cQLQvSI rY8gwr9RVCzWR8qcESPMN44gcGmIKuwJIb9oT6F7PjwZ3UAhACJ8SnYcOaLKmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4ct1cT4y6Gzbt5; Thu, 23 Oct 2025 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59NMufkc049902; Thu, 23 Oct 2025 22:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59NMufOn049899; Thu, 23 Oct 2025 22:56:41 GMT (envelope-from git) Date: Thu, 23 Oct 2025 22:56:41 GMT Message-Id: <202510232256.59NMufOn049899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 6535e9308a26 - main - ipfilter: Plug ip_nat kernel information leak List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 6535e9308a26e17023831fe68fb71d2febf2a002 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=6535e9308a26e17023831fe68fb71d2febf2a002 commit 6535e9308a26e17023831fe68fb71d2febf2a002 Author: Cy Schubert AuthorDate: 2025-10-22 15:59:26 +0000 Commit: Cy Schubert CommitDate: 2025-10-23 22:56:28 +0000 ipfilter: Plug ip_nat kernel information leak ipf_nat_getent() allocates a variable-sized nat_save_t buffer with KMALLOCS() (which does not zero memory) and then copies only a subset of fields into it before returning the object to userland using ipf_outobjsz(). Because the structure is not fully initialized on all paths, uninitialized kernel heap bytes can be copied back to user space, resulting in an information leak. We fix this by zeroing out the data structure immediately after allocation. Reported by: Ilja Van Sprundel Reviewed by: emaste MFC after: 3 days Differential revision: https://reviews.freebsd.org/D53274 --- sys/netpfil/ipfilter/netinet/ip_nat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/ipfilter/netinet/ip_nat.c b/sys/netpfil/ipfilter/netinet/ip_nat.c index 972511f43bd5..53c180cdfbca 100644 --- a/sys/netpfil/ipfilter/netinet/ip_nat.c +++ b/sys/netpfil/ipfilter/netinet/ip_nat.c @@ -1771,6 +1771,7 @@ ipf_nat_getent(ipf_main_softc_t *softc, caddr_t data, int getlock) IPFERROR(60029); return (ENOMEM); } + bzero(ipn, ipns.ipn_dsize); if (getlock) { READ_ENTER(&softc->ipf_nat);