From nobody Wed May 20 19:40:41 2026 X-Original-To: dev-commits-src-branches@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 4gLMMt0SvKz6fJyR for ; Wed, 20 May 2026 19:40:42 +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 4gLMMs4cJXz3bNs for ; Wed, 20 May 2026 19:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779306041; 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=MjEDLvduV/BeMAHfPHBYhth15Rk039GJ0T+St5vVV2Y=; b=jHVn9M/I+4O3xEtsCbb8rxcmtpUavnkm1JF80XGSNojP7lwm+gW3hISQf6UzXFEK9vFESz 7W+fzxOEhsYEHr+ec5hLZwNL5+9VhTZduZTICQJ9FcjMSPErp7byGwI8KWB28bs8hLFBVo yVvh9O+Y8FxGZ1DiSRuDjYOOeQPSIC6nmJnI1BNjyfysmZnzqQnWG2C2SI3qVMiQAtjy+C sXvkMUYt9DiP4xzJ2nDSdZIQv8VGjwjlv+V4tfq6KJf5U58fdv1SVYhbW6neYXE0zxJJD8 C2vSN+aJeWNdietbcHwwwF0smp1s9EErEuAKxkrzgIZpKOOnhyPJSzTU1qFmGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779306041; a=rsa-sha256; cv=none; b=MzLEqa/yTUEQcqRAZFLj7p6iO384H66O/86onI7gKjR6Bs2c6LMsLfifKZZbPfSgUIsQpI THw0o9eCuIzPiwjLcD1KmH9arYA5SDjB6IZ/o2n+9vCY0scBSVU+FkvbG1gYPOEpYpja4O e0EEikZ7rme5PV5dfqdVRKPbXsGKoebEWnDC6skpmtQQslliT28xD2miDYtuNab1GlY/v4 E998rUCUBOFs0VsOZxmsZYtVVlsZf/Po0oNsGAMjCBuyODaLgTz8OHOzTlgijLlCX2qI+U kSHKNQeLJo+gbYzyS3a6QAIp2CxvcPAhHcKhDQWavJQaAsivwXKxXVbbLoIU/w== 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=1779306041; 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=MjEDLvduV/BeMAHfPHBYhth15Rk039GJ0T+St5vVV2Y=; b=f4cjBzTTUhzN1DnPOp4HwHwymY0WA+mFkK2cnQSZ3dO/Cxwlfmmr856DXo429I6CDygce/ b4XWhzv/3LG7mUMeEI/5A8nrnplk7OCFhem4i2L5tkGKJGBL0Td8vzOWflBAmBpgNvb0yC mJkYHP8pPvcPU/MQ2d3WrQrTn0IuKP31vBUU4FlbjXBxMKb5lA+MTVVGJrJdD/Yqsw5VY5 6vJ4CKDcAxN2EB8LaWWUSsMUf84nd5gklkIf2lUKAovjrf2lcWn48MAQa0VHpDY32pVFBN sB+BULQbCob4w5t4sIiL+AChm2xSfmE/Wzb/vJ9cKQy0N4EwRaV+u/4jbhXomw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gLMMs3zmBz1F6k for ; Wed, 20 May 2026 19:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3979b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 20 May 2026 19:40:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Mariusz Zaborski From: Mark Johnston Subject: git: b3baecf08405 - releng/14.3 - cap_net: do not allow new limits to drop keys from the old ones List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.3 X-Git-Reftype: branch X-Git-Commit: b3baecf084053e9f6f262ad9f85c8fcdc5bfe132 Auto-Submitted: auto-generated Date: Wed, 20 May 2026 19:40:41 +0000 Message-Id: <6a0e0e39.3979b.7ce5838d@gitrepo.freebsd.org> The branch releng/14.3 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b3baecf084053e9f6f262ad9f85c8fcdc5bfe132 commit b3baecf084053e9f6f262ad9f85c8fcdc5bfe132 Author: Mariusz Zaborski AuthorDate: 2026-05-12 08:33:41 +0000 Commit: Mark Johnston CommitDate: 2026-05-20 02:12:20 +0000 cap_net: do not allow new limits to drop keys from the old ones If the old limit had family/hosts/sockaddr set, the new limit must have them too. Before, a missing key in the new limit was treated as "allow any", which let a caller silently extend their limits. Approved by: so Security: FreeBSD-SA-26:24.cap_net Security: CVE-2026-45254 Reported by: Joshua Rogers of AISLE Research Team Reviewed by: markj MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D56991 (cherry picked from commit d705a519525f2acae3c1efba11436ec6ee8aea0a) (cherry picked from commit b79faca1c5964d89c125d02de35928b733041f3f) --- lib/libcasper/services/cap_net/cap_net.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/libcasper/services/cap_net/cap_net.c b/lib/libcasper/services/cap_net/cap_net.c index 40d18319ae28..303a8e4b2120 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -1099,12 +1099,37 @@ net_connect(const nvlist_t *limits, nvlist_t *nvlin, nvlist_t *nvlout) return (0); } +/* + * If the old sublimit restricted a subkey, the new one must too; + * a missing subkey means "allow any" at request time. + */ +static bool +verify_subkeys_present(const nvlist_t *oldfunclimits, + const nvlist_t *newfunclimit) +{ + void *cookie; + const char *name; + + if (oldfunclimits == NULL) + return (true); + + cookie = NULL; + while ((name = nvlist_next(oldfunclimits, NULL, &cookie)) != NULL) { + if (!nvlist_exists(newfunclimit, name)) + return (false); + } + return (true); +} + static bool verify_only_sa_newlimts(const nvlist_t *oldfunclimits, const nvlist_t *newfunclimit) { void *cookie; + if (!verify_subkeys_present(oldfunclimits, newfunclimit)) + return (false); + cookie = NULL; while (nvlist_next(newfunclimit, NULL, &cookie) != NULL) { void *sacookie; @@ -1177,6 +1202,9 @@ verify_addr2name_newlimits(const nvlist_t *oldlimits, LIMIT_NV_ADDR2NAME, NULL); } + if (!verify_subkeys_present(oldfunclimits, newfunclimit)) + return (false); + cookie = NULL; while (nvlist_next(newfunclimit, NULL, &cookie) != NULL) { if (strcmp(cnvlist_name(cookie), "sockaddr") == 0) { @@ -1235,6 +1263,9 @@ verify_name2addr_newlimits(const nvlist_t *oldlimits, LIMIT_NV_NAME2ADDR, NULL); } + if (!verify_subkeys_present(oldfunclimits, newfunclimit)) + return (false); + cookie = NULL; while (nvlist_next(newfunclimit, NULL, &cookie) != NULL) { if (strcmp(cnvlist_name(cookie), "hosts") == 0) {