From nobody Wed May 20 19:38:59 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 4gLMKv5YlGz6fJR9 for ; Wed, 20 May 2026 19:38:59 +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 4gLMKv0w04z3WqG for ; Wed, 20 May 2026 19:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779305939; 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=zy14yx68VZvHtO9TFpPPfGpiz0trin5SnkbjqiTjT0I=; b=UiObYgDw6RTOtqdyTioPiakQYtbiyHSVO/lYnwbaP9zH2jOaN9z9sj+DMZrTqyxmLzgX73 PFOUBGpE47KesXCk0I6owCbUKKj7vaJeowzVAkV74EdmwHQvhAMUDEYIpPJh4+VPXGhVHI Hw527mIdtrDc7+MycVzVtIjTpGmbUuEyT7YZAs+sz/DQKPNY/AASBqo3aL9a9SSYo0gpT0 05rwnQzNYE4KU0iy9ag8PKkR6s+S+Lsx48D0kw4fLm6HEn8L2eCXz7IE/69jsNxfwRkTH/ E48Du8C1AzmvuVRE8NjI+fjqKMOv0ch7kAobGJ9TbgqVvqc0AUUa2itqAIJaoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779305939; a=rsa-sha256; cv=none; b=mOFBmbzMks6H0+aiWO8vnLBPTAoal3PH9tU0C7Q6Dwe2yduXYHA7xwQ9hRj2L25VPOK2kU ln475rk9SzWXGAymbVIjO17ldrbTJfL6fWrcy19jd2IJr3ndV/CPNR/OvoSNpWa7aoJ1MD OwkLviLtzqgjYwCYIFTOQYrs2wtfHbLgD7KRWapSKsQaxzdievYXsXE7IAV377N42s505Y hyC+q+XGxKehEVRLUWTU0X9a2YQCtzsPUcXPRPCWgSi/eJGlwxG6sbxC5FTEeklXuFpp1M kE/Nl9K6O5hUsy+0/IgxwXi4ZU5PyBCViXMgCKNxwOs5GXgdbtj5PT0xhv0IRw== 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=1779305939; 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=zy14yx68VZvHtO9TFpPPfGpiz0trin5SnkbjqiTjT0I=; b=DLJKlZl+LaytBNbWLWufMK10yKLwVXbNIPa8yA8kCTzq1BxIJtdrSzYEgCEvGZP2K631sJ 9vETdqlq2/3e36IO7Mctk3TZU01nnp4mNv8stPxMwBOoliQZha9fiO2oURaGMGWFrScZ9w KAIZoqom+SQRrNwPm5IdhmRsXd7yZA0ICDCXmS4V7Yd6qYBbBekXYVkDb0Ot8mX/Pgwv7T 1WMFUQuWjHvuCi981DkwbrKL/vW6TrC/8VDYdiPVuOePfdxD0s0Ksdl0Tlt5rNkmB0hpSH gIKNpwEn5W5ScJ+YHWq/PdLQo7ty85jRDYIHZY1kCulNsW6sbPob1G8kWn2BPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gLMKv0Cnyz1Dby for ; Wed, 20 May 2026 19:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37346 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 20 May 2026 19:38:59 +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: 5a135f8b45a1 - releng/15.1 - cap_net: do not allow new limits to drop keys from the old ones 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.1 X-Git-Reftype: branch X-Git-Commit: 5a135f8b45a1dc5ce8803c8a2a56e13dedc4bded Auto-Submitted: auto-generated Date: Wed, 20 May 2026 19:38:59 +0000 Message-Id: <6a0e0dd3.37346.39deb25b@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5a135f8b45a1dc5ce8803c8a2a56e13dedc4bded commit 5a135f8b45a1dc5ce8803c8a2a56e13dedc4bded Author: Mariusz Zaborski AuthorDate: 2026-05-12 08:33:41 +0000 Commit: Mark Johnston CommitDate: 2026-05-20 13:52:39 +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: re 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 7eb3fd691d64dd42f9d32e04cb9b5811fd7c8e55) --- 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 5887fe3c407e..67eec73cae7e 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -1122,12 +1122,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; @@ -1200,6 +1225,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) { @@ -1258,6 +1286,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) {