From nobody Tue Nov 17 17:06:12 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 4jTWN44ydHz71RrT for ; Tue, 17 Nov 2026 17:06:12 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTWN41F9Vz4JTP for ; Tue, 17 Nov 2026 17:06:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935172; 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=8YhcMwzBzfX3AP+AmV7TMu2OPNJ3cEnuBFrF1XNpdKM=; b=YJz/hcPvhUGXNXHKmiC2ew8xqE1ptkKtqBR/3w8oii7ZsG60P7WqSn7l8a4lBXfRcwivyn VFgk41nX/lrQknTdrE8Vf0RMw4nV77nvFFEFJ6k+8Ri9DWiWQgjCdRzJa/QWfWJaZueBWf A8LKYXn+DtFI+cYuJxxmMO1w7jGkRzIaoychZUmr05vy6sUBizcDM8hRwlmNDMhmIcUyCF bAESMDVSBzCFAmTVJmWg4WnD5GLmeBarNT4OBH/p/bCTsMRlYdmtp5s9fRJWT60s6pjVz1 hJ5i5usV7XF+Qcwb/aNNhuiyd95MKYkMhUn7XFS9DHwD2vwCbf5o+ukNybSHog== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935172; b=wqUJ790evN77zRe0o5OgPz3qFNJjxWd9RRq2Qz7IWsJFnXNGmK3NNieEZuXfSTniET+QbV 6m3DJMrkAn8/l6aN1oOJRar2pi4h0t+1af65tjjyj8E7k15U0VkQ7CNJrKhODUC9yz+9da VZw79U1KrBPUTIkAbLg5ZEoiWcjmIwXUP1Q+hvH3eKyf3Df0hkmhmTiHALw9WCIGLFwqtq QfkDm6Tq2i/9HP9lTixhBm+G8IhZ/IoyQaY1ulTYy7206n0qBq7nxzG8NAtRrNjyTzdfI7 Yg9kaU4KgLtjxrWOxk/zD+6P6tl87dn6/+rLCQatDUnl2HDoP4QfYFEiDX2d5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935172; 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=8YhcMwzBzfX3AP+AmV7TMu2OPNJ3cEnuBFrF1XNpdKM=; b=a8tW79jfc5Pk8g4gsBQ+cFXFVF2Puh/4hnLAjcDxHLqKgQIy7W4mg7vNbfnlUoAVG3qa28 cTFWN+xWiYh1VExK1kLVLgJsI1O5V1V9u2xByVNDpN8aJEWY6LmvXQ9CYFFPCPxdla0y5P JksnWl/k8w+RZoR/BudPTOjN93xQvD42oJWV2P0sxVL1xnJLh1wRi4Dxr+JvGqQG+ghecE 2xgiYeA8WyTdw66+vGR1F7Xgv/h9Appb7tFccsS5vDqkfZpHcTjXBkwqN7qd7w6iY9hgNd RewIegb9+YipWS4iFgv/l7G9Pa5jglV8Tiu3sMwxxAUjPpD3ywjlHy6zsgEHgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTWN40wPVzrpg for ; Tue, 17 Nov 2026 17:06:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1f7d1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:06:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Maxim Konovalov From: Mark Johnston Subject: git: 870ce74ad739 - stable/15 - bsnmp: mask reserved SNMPv3 msgFlags bits on input List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 870ce74ad739ef535c9a4870b5e5a30f7e0710b6 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:06:12 +0000 Message-Id: <6afc8984.1f7d1.1d07619@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=870ce74ad739ef535c9a4870b5e5a30f7e0710b6 commit 870ce74ad739ef535c9a4870b5e5a30f7e0710b6 Author: Maxim Konovalov AuthorDate: 2026-11-12 00:43:05 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 16:57:23 +0000 bsnmp: mask reserved SNMPv3 msgFlags bits on input snmp_pdu_decode_header() reads the msgFlags octet straight into pdu->flags and never sanitises it. Only bits 0..2 are defined on the wire (authFlag, privFlag, reportableFlag). Bit 7 (0x80) is bsnmp's internal SNMP_MSG_AUTODISCOVER marker: it shares the same field and is tested later as "this is discovery, skip USM and VACM". Because the byte is taken verbatim from an unauthenticated peer, a client that sets bit 7 of msgFlags has (pdu->flags & SNMP_MSG_AUTODISCOVER) read true straight after header decode, forging the discovery state. A noAuthNoPriv user -- which has no digest to verify -- can thus mark an ordinary request as discovery and have it bypass the VACM access check, operating outside its configured views. Keep only the three defined wire bits when decoding msgFlags, so the internal marker can never be set from the network. Approved by: so Security: FreeBSD-SA-26:89.bsnmp Reviewed by: harti Fixes: 135f7de5ddb6 --- contrib/bsnmp/lib/snmp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/bsnmp/lib/snmp.c b/contrib/bsnmp/lib/snmp.c index d1dabc8884a0..acdf5df0c683 100644 --- a/contrib/bsnmp/lib/snmp.c +++ b/contrib/bsnmp/lib/snmp.c @@ -523,6 +523,13 @@ snmp_pdu_decode_header(struct asn_buf *b, struct snmp_pdu *pdu) snmp_error("cannot decode msg flags"); return (SNMP_CODE_FAILED); } + /* + * msgFlags is attacker-controlled. Keep only the three + * defined wire bits, so a client cannot forge an internal + * marker that shares this byte (SNMP_MSG_AUTODISCOVER). + */ + pdu->flags &= (SNMP_MSG_AUTH_FLAG | SNMP_MSG_PRIV_FLAG | + SNMP_MSG_REPORT_FLAG); if (asn_get_integer(b, &pdu->security_model) != ASN_ERR_OK) { snmp_error("cannot decode msg size");